From fdd8df87b0ed1ee3c4c719c0234f7a30fad1462c Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Sat, 1 Jul 2017 14:31:59 +0100 Subject: [PATCH] de-lint PasswordReset Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- .eslintignore.errorfiles | 1 - src/PasswordReset.js | 19 +++++++++---------- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/.eslintignore.errorfiles b/.eslintignore.errorfiles index 57639aa3a5..9fd55dca7f 100644 --- a/.eslintignore.errorfiles +++ b/.eslintignore.errorfiles @@ -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 diff --git a/src/PasswordReset.js b/src/PasswordReset.js index 0739ca0a24..71fc4f6b31 100644 --- a/src/PasswordReset.js +++ b/src/PasswordReset.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;