mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-09-01 05:29:20 +03:00
Added support for JavaScript FormData
As preparation for 2FA plugins and easier Fetch calls
This commit is contained in:
parent
5a0f6c2b9f
commit
0a69c6410d
5 changed files with 26 additions and 31 deletions
|
|
@ -104,17 +104,19 @@ class LoginUserView extends AbstractViewCenter {
|
|||
}
|
||||
|
||||
submitCommand(self, event) {
|
||||
let email = this.email().trim(),
|
||||
valid = event.target.form.reportValidity() && email,
|
||||
pass = this.password();
|
||||
let form = event.target.form,
|
||||
data = new FormData(form),
|
||||
email = this.email().trim(),
|
||||
valid = form.reportValidity() && email;
|
||||
|
||||
this.emailError(!email);
|
||||
this.passwordError(!pass);
|
||||
this.passwordError(!this.password());
|
||||
this.formError(!valid);
|
||||
|
||||
if (valid) {
|
||||
this.submitRequest(true);
|
||||
|
||||
data.set('Language', this.bSendLanguage ? this.language() : '');
|
||||
data.set('SignMe', this.signMe() ? 1 : 0);
|
||||
Remote.login(
|
||||
(iError, oData) => {
|
||||
if (iError) {
|
||||
|
|
@ -129,10 +131,7 @@ class LoginUserView extends AbstractViewCenter {
|
|||
rl.route.reload();
|
||||
}
|
||||
},
|
||||
email,
|
||||
pass,
|
||||
!!this.signMe(),
|
||||
this.bSendLanguage ? this.language() : ''
|
||||
data
|
||||
);
|
||||
|
||||
Local.set(ClientSideKeyName.LastSignMe, this.signMe() ? '-1-' : '-0-');
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue