mirror of
https://github.com/vector-im/element-web.git
synced 2024-11-16 13:14:58 +08:00
de-lint PasswordReset
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
parent
b98c105dcc
commit
fdd8df87b0
@ -132,7 +132,6 @@ src/MatrixClientPeg.js
|
|||||||
src/Modal.js
|
src/Modal.js
|
||||||
src/Notifier.js
|
src/Notifier.js
|
||||||
src/ObjectUtils.js
|
src/ObjectUtils.js
|
||||||
src/PasswordReset.js
|
|
||||||
src/PlatformPeg.js
|
src/PlatformPeg.js
|
||||||
src/Presence.js
|
src/Presence.js
|
||||||
src/ratelimitedfunc.js
|
src/ratelimitedfunc.js
|
||||||
|
@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
|
|||||||
limitations under the License.
|
limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
var Matrix = require("matrix-js-sdk");
|
import * as Matrix from 'matrix-js-sdk';
|
||||||
import { _t } from './languageHandler';
|
import { _t } from './languageHandler';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -34,7 +34,7 @@ class PasswordReset {
|
|||||||
constructor(homeserverUrl, identityUrl) {
|
constructor(homeserverUrl, identityUrl) {
|
||||||
this.client = Matrix.createClient({
|
this.client = Matrix.createClient({
|
||||||
baseUrl: homeserverUrl,
|
baseUrl: homeserverUrl,
|
||||||
idBaseUrl: identityUrl
|
idBaseUrl: identityUrl,
|
||||||
});
|
});
|
||||||
this.clientSecret = this.client.generateClientSecret();
|
this.clientSecret = this.client.generateClientSecret();
|
||||||
this.identityServerDomain = identityUrl.split("://")[1];
|
this.identityServerDomain = identityUrl.split("://")[1];
|
||||||
@ -53,7 +53,7 @@ class PasswordReset {
|
|||||||
this.sessionId = res.sid;
|
this.sessionId = res.sid;
|
||||||
return res;
|
return res;
|
||||||
}, function(err) {
|
}, function(err) {
|
||||||
if (err.errcode == 'M_THREEPID_NOT_FOUND') {
|
if (err.errcode === 'M_THREEPID_NOT_FOUND') {
|
||||||
err.message = _t('This email address was not found');
|
err.message = _t('This email address was not found');
|
||||||
} else if (err.httpStatus) {
|
} else if (err.httpStatus) {
|
||||||
err.message = err.message + ` (Status ${err.httpStatus})`;
|
err.message = err.message + ` (Status ${err.httpStatus})`;
|
||||||
@ -75,16 +75,15 @@ class PasswordReset {
|
|||||||
threepid_creds: {
|
threepid_creds: {
|
||||||
sid: this.sessionId,
|
sid: this.sessionId,
|
||||||
client_secret: this.clientSecret,
|
client_secret: this.clientSecret,
|
||||||
id_server: this.identityServerDomain
|
id_server: this.identityServerDomain,
|
||||||
}
|
},
|
||||||
}, this.password).catch(function(err) {
|
}, this.password).catch(function(err) {
|
||||||
if (err.httpStatus === 401) {
|
if (err.httpStatus === 401) {
|
||||||
err.message = _t('Failed to verify email address: make sure you clicked the link in the email');
|
err.message = _t('Failed to verify email address: make sure you clicked the link in the email');
|
||||||
}
|
} else if (err.httpStatus === 404) {
|
||||||
else if (err.httpStatus === 404) {
|
err.message =
|
||||||
err.message = _t('Your email address does not appear to be associated with a Matrix ID on this Homeserver.');
|
_t('Your email address does not appear to be associated with a Matrix ID on this Homeserver.');
|
||||||
}
|
} else if (err.httpStatus) {
|
||||||
else if (err.httpStatus) {
|
|
||||||
err.message += ` (Status ${err.httpStatus})`;
|
err.message += ` (Status ${err.httpStatus})`;
|
||||||
}
|
}
|
||||||
throw err;
|
throw err;
|
||||||
|
Loading…
Reference in New Issue
Block a user