mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-09-06 07:57:02 +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;
|
this.Remote = Remote;
|
||||||
}
|
}
|
||||||
|
|
||||||
logoutReload() {
|
logoutReload(url) {
|
||||||
const url = logoutLink();
|
url = url || logoutLink();
|
||||||
|
|
||||||
if (location.href !== url) {
|
if (location.href !== url) {
|
||||||
setTimeout(() => location.href = url, 100);
|
setTimeout(() => location.href = url, 100);
|
||||||
} else {
|
} else {
|
||||||
rl.route.reload();
|
rl.route.reload();
|
||||||
}
|
}
|
||||||
|
// this does not work due to ViewModelClass.__builded = true;
|
||||||
|
// rl.settings.set('Auth', false);
|
||||||
|
// rl.app.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
bootstart() {
|
bootstart() {
|
||||||
|
|
|
||||||
|
|
@ -200,14 +200,7 @@ export class AppUser extends AbstractApp {
|
||||||
}
|
}
|
||||||
|
|
||||||
logout() {
|
logout() {
|
||||||
Remote.request('Logout', () => {
|
Remote.request('Logout', () => rl.logoutReload(Settings.app('customLogoutLink')));
|
||||||
const customLogoutLink = Settings.app('customLogoutLink');
|
|
||||||
if (customLogoutLink) {
|
|
||||||
location.href = customLogoutLink;
|
|
||||||
} else {
|
|
||||||
rl.logoutReload()
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bootstart() {
|
bootstart() {
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@ export const
|
||||||
* @returns {string}
|
* @returns {string}
|
||||||
*/
|
*/
|
||||||
i18n = (key, valueList, defaulValue) => {
|
i18n = (key, valueList, defaulValue) => {
|
||||||
let result = defaulValue || key;
|
let result = null == defaulValue ? key : defaulValue;
|
||||||
let path = key.split('/');
|
let path = key.split('/');
|
||||||
if (I18N_DATA[path[0]] && path[1]) {
|
if (I18N_DATA[path[0]] && path[1]) {
|
||||||
result = I18N_DATA[path[0]][path[1]] || result;
|
result = I18N_DATA[path[0]][path[1]] || result;
|
||||||
|
|
|
||||||
|
|
@ -26,13 +26,13 @@ export class AskPopupView extends AbstractViewPopup {
|
||||||
yesClick() {
|
yesClick() {
|
||||||
this.close();
|
this.close();
|
||||||
|
|
||||||
isFunction(this.fYesAction) && this.fYesAction();
|
isFunction(this.fYesAction) && this.fYesAction(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
noClick() {
|
noClick() {
|
||||||
this.close();
|
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 => {
|
return new Promise(resolve => {
|
||||||
this.showModal([
|
this.showModal([
|
||||||
sAskDesc,
|
sAskDesc,
|
||||||
() => resolve(this.__vm.passphrase()),
|
view => resolve(view.passphrase()),
|
||||||
() => resolve(null),
|
() => resolve(null),
|
||||||
true,
|
true,
|
||||||
1,
|
1,
|
||||||
|
|
@ -99,7 +99,7 @@ AskPopupView.credentials = function(sAskDesc, btnText) {
|
||||||
return new Promise(resolve => {
|
return new Promise(resolve => {
|
||||||
this.showModal([
|
this.showModal([
|
||||||
sAskDesc,
|
sAskDesc,
|
||||||
() => resolve({username:this.__vm.username(), password:this.__vm.passphrase()}),
|
view => resolve({username:view.username(), password:view.passphrase()}),
|
||||||
() => resolve(null),
|
() => resolve(null),
|
||||||
true,
|
true,
|
||||||
3,
|
3,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue