mirror of
https://github.com/the-djmaze/snappymail.git
synced 2024-09-20 07:35:55 +08:00
allow multi-account in nc with oauth login
This commit is contained in:
parent
fa15742edb
commit
97c0f81a2e
|
@ -60,10 +60,9 @@ export class AbstractViewPopup extends AbstractView
|
|||
this.keyScope.scope = name;
|
||||
this.modalVisible = ko.observable(false).extend({ rateLimit: 0 });
|
||||
this.close = () => this.modalVisible(false);
|
||||
this.tryToClose = () => (false === this.onClose()) || this.close();
|
||||
addShortcut('escape,close', '', name, () => {
|
||||
if (this.modalVisible() && false !== this.onClose()) {
|
||||
this.close();
|
||||
}
|
||||
this.modalVisible() && this.tryToClose();
|
||||
return false;
|
||||
// return true; Issue with supported modal close
|
||||
});
|
||||
|
|
|
@ -167,7 +167,7 @@ const
|
|||
if (screenName && fireEvent('sm-show-screen', screenName + (subPart ? '/' + subPart : ''), 1)) {
|
||||
// Close all popups
|
||||
for (let vm of visiblePopups) {
|
||||
(false === vm.onClose()) || vm.close();
|
||||
vm.tryToClose();
|
||||
}
|
||||
|
||||
let vmScreen = screen(screenName);
|
||||
|
|
|
@ -298,7 +298,7 @@ export class ComposePopupView extends AbstractViewPopup {
|
|||
]
|
||||
});
|
||||
|
||||
this.tryToClose = this.tryToClose.debounce(200);
|
||||
this.doClose = this.doClose.debounce(200);
|
||||
|
||||
this.iTimer = 0;
|
||||
|
||||
|
@ -665,7 +665,7 @@ export class ComposePopupView extends AbstractViewPopup {
|
|||
this.saveCommand();
|
||||
}
|
||||
|
||||
this.tryToClose();
|
||||
this.doClose();
|
||||
}
|
||||
|
||||
contactsCommand() {
|
||||
|
@ -1072,7 +1072,7 @@ export class ComposePopupView extends AbstractViewPopup {
|
|||
}, 100);
|
||||
}
|
||||
|
||||
tryToClose() {
|
||||
doClose() {
|
||||
if (AskPopupView.hidden()) {
|
||||
if (ComposePopupView.inEdit() || (this.isEmptyForm() && !this.draftUid())) {
|
||||
this.close();
|
||||
|
@ -1218,7 +1218,7 @@ export class ComposePopupView extends AbstractViewPopup {
|
|||
});
|
||||
|
||||
addShortcut('escape,close', 'shift', ScopeCompose, () => {
|
||||
this.tryToClose();
|
||||
this.doClose();
|
||||
return false;
|
||||
});
|
||||
|
||||
|
|
|
@ -314,10 +314,6 @@ export class ContactsPopupView extends AbstractViewPopup {
|
|||
}
|
||||
}
|
||||
|
||||
tryToClose() {
|
||||
(false === this.onClose()) || this.close();
|
||||
}
|
||||
|
||||
onClose() {
|
||||
const contact = this.contact();
|
||||
if (AskPopupView.hidden() && contact?.hasChanges()) {
|
||||
|
|
|
@ -90,8 +90,15 @@ class NextcloudPlugin extends \RainLoop\Plugins\AbstractPlugin
|
|||
public function beforeLogin(\RainLoop\Model\Account $oAccount, \MailSo\Net\NetClient $oClient, \MailSo\Net\ConnectSettings $oSettings) : void
|
||||
{
|
||||
// https://apps.nextcloud.com/apps/oidc_login
|
||||
$ocUser = \OC::$server->getUserSession()->getUser();
|
||||
$sNcEmail = $ocUser->getEMailAddress() ?: $ocUser->getPrimaryEMailAddress();
|
||||
|
||||
// Only login with OIDC access token if
|
||||
// it is enabled in config, the user is currently logged in with OIDC
|
||||
// and the current snappymail account is the OIDC account
|
||||
if (\OC::$server->getConfig()->getAppValue('snappymail', 'snappymail-autologin-oidc', false)
|
||||
&& \OC::$server->getSession()->get('is_oidc')
|
||||
&& $sNcEmail === $oSettings->username
|
||||
// && $oClient->supportsAuthType('OAUTHBEARER') // v2.28
|
||||
) {
|
||||
$sAccessToken = \OC::$server->getSession()->get('oidc_access_token');
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<header class="g-ui-user-select-none">
|
||||
<a href="#" class="close" data-bind="click: close">×</a>
|
||||
<a href="#" class="close" data-bind="click: tryToClose">×</a>
|
||||
<h3 data-bind="visible: !edit()" data-i18n="POPUPS_IDENTITY/TITLE_ADD_IDENTITY"></h3>
|
||||
<h3 data-bind="visible: edit" data-i18n="POPUPS_IDENTITY/TITLE_UPDATE_IDENTITY"></h3>
|
||||
</header>
|
||||
|
|
Loading…
Reference in a new issue