Skip to content

Commit

Permalink
Improve some login/logout handling
Browse files Browse the repository at this point in the history
  • Loading branch information
the-djmaze committed Oct 18, 2022
1 parent b77854e commit 93d8b5a
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 16 deletions.
8 changes: 5 additions & 3 deletions dev/App/Abstract.js
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
9 changes: 1 addition & 8 deletions dev/App/User.js
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
2 changes: 1 addition & 1 deletion dev/Common/Translator.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
8 changes: 4 additions & 4 deletions dev/View/Popup/Ask.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

/**
Expand Down Expand Up @@ -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,
Expand All @@ -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,
Expand Down

0 comments on commit 93d8b5a

Please sign in to comment.