de-lint PasswordReset
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>pull/21833/head
parent
b98c105dcc
commit
fdd8df87b0
|
@ -132,7 +132,6 @@ src/MatrixClientPeg.js
|
|||
src/Modal.js
|
||||
src/Notifier.js
|
||||
src/ObjectUtils.js
|
||||
src/PasswordReset.js
|
||||
src/PlatformPeg.js
|
||||
src/Presence.js
|
||||
src/ratelimitedfunc.js
|
||||
|
|
|
@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
|
|||
limitations under the License.
|
||||
*/
|
||||
|
||||
var Matrix = require("matrix-js-sdk");
|
||||
import * as Matrix from 'matrix-js-sdk';
|
||||
import { _t } from './languageHandler';
|
||||
|
||||
/**
|
||||
|
@ -34,7 +34,7 @@ class PasswordReset {
|
|||
constructor(homeserverUrl, identityUrl) {
|
||||
this.client = Matrix.createClient({
|
||||
baseUrl: homeserverUrl,
|
||||
idBaseUrl: identityUrl
|
||||
idBaseUrl: identityUrl,
|
||||
});
|
||||
this.clientSecret = this.client.generateClientSecret();
|
||||
this.identityServerDomain = identityUrl.split("://")[1];
|
||||
|
@ -53,7 +53,7 @@ class PasswordReset {
|
|||
this.sessionId = res.sid;
|
||||
return res;
|
||||
}, 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');
|
||||
} else if (err.httpStatus) {
|
||||
err.message = err.message + ` (Status ${err.httpStatus})`;
|
||||
|
@ -75,16 +75,15 @@ class PasswordReset {
|
|||
threepid_creds: {
|
||||
sid: this.sessionId,
|
||||
client_secret: this.clientSecret,
|
||||
id_server: this.identityServerDomain
|
||||
}
|
||||
id_server: this.identityServerDomain,
|
||||
},
|
||||
}, this.password).catch(function(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) {
|
||||
err.message = _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 === 404) {
|
||||
err.message =
|
||||
_t('Your email address does not appear to be associated with a Matrix ID on this Homeserver.');
|
||||
} else if (err.httpStatus) {
|
||||
err.message += ` (Status ${err.httpStatus})`;
|
||||
}
|
||||
throw err;
|
||||
|
|
Loading…
Reference in New Issue