mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-29 03:59:21 +03:00
Improved the Switch account system for better feedback to user
This commit is contained in:
parent
597ea21b70
commit
739aeaded5
42 changed files with 76 additions and 49 deletions
|
|
@ -119,6 +119,7 @@ export const Notification = {
|
|||
|
||||
AccountAlreadyExists: 801,
|
||||
AccountDoesNotExist: 802,
|
||||
AccountSwitchFailed: 803,
|
||||
|
||||
MailServerError: 901,
|
||||
ClientViewError: 902,
|
||||
|
|
|
|||
|
|
@ -48,21 +48,6 @@ class RemoteUserFetch extends AbstractFetchRemote {
|
|||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {?Function} fCallback
|
||||
* @param {FormData} oData
|
||||
*/
|
||||
login(fCallback, oData) {
|
||||
this.defaultRequest(fCallback, 'Login', oData);
|
||||
}
|
||||
|
||||
/*
|
||||
// TODO SystemDropDownUserView.accountClick
|
||||
switchAccount(fCallback, email) {
|
||||
this.defaultRequest(fCallback, 'AccountSwitch', {Email:email});
|
||||
}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @param {?Function} fCallback
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -99,7 +99,7 @@ class LoginUserView extends AbstractViewLogin {
|
|||
this.submitRequest(true);
|
||||
data.set('Language', this.bSendLanguage ? this.language() : '');
|
||||
data.set('SignMe', this.signMe() ? 1 : 0);
|
||||
Remote.login(
|
||||
Remote.defaultRequest(
|
||||
(iError, oData) => {
|
||||
if (iError) {
|
||||
this.submitRequest(false);
|
||||
|
|
@ -114,7 +114,7 @@ class LoginUserView extends AbstractViewLogin {
|
|||
// rl.route.reload();
|
||||
}
|
||||
},
|
||||
data
|
||||
'Login', data
|
||||
);
|
||||
|
||||
Local.set(ClientSideKeyName.LastSignMe, this.signMe() ? '-1-' : '-0-');
|
||||
|
|
|
|||
|
|
@ -16,7 +16,8 @@ import { doc, Settings, leftPanelDisabled } from 'Common/Globals';
|
|||
|
||||
import { ThemeStore } from 'Stores/Theme';
|
||||
|
||||
//import Remote from 'Remote/User/Fetch';
|
||||
import Remote from 'Remote/User/Fetch';
|
||||
import { getNotification } from 'Common/Translator';
|
||||
|
||||
export class SystemDropDownUserView extends AbstractViewRight {
|
||||
constructor() {
|
||||
|
|
@ -46,27 +47,22 @@ export class SystemDropDownUserView extends AbstractViewRight {
|
|||
}
|
||||
|
||||
accountClick(account, event) {
|
||||
/* TODO
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
Remote.switchAccount(
|
||||
(iError, oData) => {
|
||||
if (iError) {
|
||||
console.dir({
|
||||
iError: iError,
|
||||
oData: oData
|
||||
})
|
||||
} else {
|
||||
rl.setData(oData.Result);
|
||||
// rl.route.reload();
|
||||
}
|
||||
},
|
||||
account.email
|
||||
);
|
||||
*/
|
||||
if (account && 0 === event.button) {
|
||||
AccountUserStore.loading(true);
|
||||
setTimeout(() => AccountUserStore.loading(false), 1000);
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
Remote.defaultRequest(
|
||||
(iError/*, oData*/) => {
|
||||
if (iError) {
|
||||
AccountUserStore.loading(false);
|
||||
alert(getNotification(iError).replace('%EMAIL%', account.email));
|
||||
} else {
|
||||
// This does not work yet
|
||||
// rl.setData(oData.Result);
|
||||
location.reload();
|
||||
}
|
||||
}, 'AccountSwitch', {Email:account.email}
|
||||
);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
@ -97,7 +93,6 @@ export class SystemDropDownUserView extends AbstractViewRight {
|
|||
doc.cookie = 'rllayout=' + (mobile ? 'mobile' : 'desktop');
|
||||
ThemeStore.isMobile(mobile);
|
||||
leftPanelDisabled(mobile);
|
||||
// location.reload();
|
||||
}
|
||||
|
||||
logoutClick() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue