mirror of
https://github.com/element-hq/element-web
synced 2024-11-23 17:56:01 +03:00
Remove id_server param for password reset
For HSes that no longer need it, remove the id_server param from password reset. Part of https://github.com/vector-im/riot-web/issues/10941
This commit is contained in:
parent
7113772f9d
commit
0c51e41ea4
2 changed files with 22 additions and 14 deletions
|
@ -1,5 +1,6 @@
|
|||
/*
|
||||
Copyright 2015, 2016 OpenMarket Ltd
|
||||
Copyright 2019 The Matrix.org Foundation C.I.C.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
|
@ -72,15 +73,21 @@ class PasswordReset {
|
|||
* with a "message" property which contains a human-readable message detailing why
|
||||
* the reset failed, e.g. "There is no mapped matrix user ID for the given email address".
|
||||
*/
|
||||
checkEmailLinkClicked() {
|
||||
return this.client.setPassword({
|
||||
type: "m.login.email.identity",
|
||||
threepid_creds: {
|
||||
async checkEmailLinkClicked() {
|
||||
const creds = {
|
||||
sid: this.sessionId,
|
||||
client_secret: this.clientSecret,
|
||||
id_server: this.identityServerDomain,
|
||||
},
|
||||
}, this.password).catch(function(err) {
|
||||
};
|
||||
if (await this.doesServerRequireIdServerParam()) {
|
||||
creds.id_server = this.identityServerDomain;
|
||||
}
|
||||
|
||||
try {
|
||||
await this.client.setPassword({
|
||||
type: "m.login.email.identity",
|
||||
threepid_creds: creds,
|
||||
}, this.password);
|
||||
} catch (err) {
|
||||
if (err.httpStatus === 401) {
|
||||
err.message = _t('Failed to verify email address: make sure you clicked the link in the email');
|
||||
} else if (err.httpStatus === 404) {
|
||||
|
@ -90,7 +97,7 @@ class PasswordReset {
|
|||
err.message += ` (Status ${err.httpStatus})`;
|
||||
}
|
||||
throw err;
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -117,17 +117,18 @@ module.exports = createReactClass({
|
|||
});
|
||||
},
|
||||
|
||||
onVerify: function(ev) {
|
||||
onVerify: async function(ev) {
|
||||
ev.preventDefault();
|
||||
if (!this.reset) {
|
||||
console.error("onVerify called before submitPasswordReset!");
|
||||
return;
|
||||
}
|
||||
this.reset.checkEmailLinkClicked().done((res) => {
|
||||
try {
|
||||
await this.reset.checkEmailLinkClicked();
|
||||
this.setState({ phase: PHASE_DONE });
|
||||
}, (err) => {
|
||||
} catch (err) {
|
||||
this.showErrorDialog(err.message);
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
onSubmitForm: async function(ev) {
|
||||
|
|
Loading…
Reference in a new issue