mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-28 03:29:20 +03:00
Improve some login/logout handling
This commit is contained in:
parent
b77854e421
commit
93d8b5a419
4 changed files with 11 additions and 16 deletions
|
|
@ -17,14 +17,16 @@ export class AbstractApp {
|
|||
this.Remote = Remote;
|
||||
}
|
||||
|
||||
logoutReload() {
|
||||
const url = logoutLink();
|
||||
|
||||
logoutReload(url) {
|
||||
url = url || logoutLink();
|
||||
if (location.href !== url) {
|
||||
setTimeout(() => location.href = url, 100);
|
||||
} else {
|
||||
rl.route.reload();
|
||||
}
|
||||
// this does not work due to ViewModelClass.__builded = true;
|
||||
// rl.settings.set('Auth', false);
|
||||
// rl.app.start();
|
||||
}
|
||||
|
||||
bootstart() {
|
||||
|
|
|
|||
|
|
@ -200,14 +200,7 @@ export class AppUser extends AbstractApp {
|
|||
}
|
||||
|
||||
logout() {
|
||||
Remote.request('Logout', () => {
|
||||
const customLogoutLink = Settings.app('customLogoutLink');
|
||||
if (customLogoutLink) {
|
||||
location.href = customLogoutLink;
|
||||
} else {
|
||||
rl.logoutReload()
|
||||
}
|
||||
});
|
||||
Remote.request('Logout', () => rl.logoutReload(Settings.app('customLogoutLink')));
|
||||
}
|
||||
|
||||
bootstart() {
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ export const
|
|||
* @returns {string}
|
||||
*/
|
||||
i18n = (key, valueList, defaulValue) => {
|
||||
let result = defaulValue || key;
|
||||
let result = null == defaulValue ? key : defaulValue;
|
||||
let path = key.split('/');
|
||||
if (I18N_DATA[path[0]] && path[1]) {
|
||||
result = I18N_DATA[path[0]][path[1]] || result;
|
||||
|
|
|
|||
|
|
@ -26,13 +26,13 @@ export class AskPopupView extends AbstractViewPopup {
|
|||
yesClick() {
|
||||
this.close();
|
||||
|
||||
isFunction(this.fYesAction) && this.fYesAction();
|
||||
isFunction(this.fYesAction) && this.fYesAction(this);
|
||||
}
|
||||
|
||||
noClick() {
|
||||
this.close();
|
||||
|
||||
isFunction(this.fNoAction) && this.fNoAction();
|
||||
isFunction(this.fNoAction) && this.fNoAction(this);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -86,7 +86,7 @@ AskPopupView.password = function(sAskDesc, btnText) {
|
|||
return new Promise(resolve => {
|
||||
this.showModal([
|
||||
sAskDesc,
|
||||
() => resolve(this.__vm.passphrase()),
|
||||
view => resolve(view.passphrase()),
|
||||
() => resolve(null),
|
||||
true,
|
||||
1,
|
||||
|
|
@ -99,7 +99,7 @@ AskPopupView.credentials = function(sAskDesc, btnText) {
|
|||
return new Promise(resolve => {
|
||||
this.showModal([
|
||||
sAskDesc,
|
||||
() => resolve({username:this.__vm.username(), password:this.__vm.passphrase()}),
|
||||
view => resolve({username:view.username(), password:view.passphrase()}),
|
||||
() => resolve(null),
|
||||
true,
|
||||
3,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue