diff --git a/src/components/structures/UserSettings.js b/src/components/structures/UserSettings.js index e2f183d92a..23b28e0a0a 100644 --- a/src/components/structures/UserSettings.js +++ b/src/components/structures/UserSettings.js @@ -21,7 +21,6 @@ var dis = require("../../dispatcher"); var q = require('q'); var version = require('../../../package.json').version; var UserSettingsStore = require('../../UserSettingsStore'); -var ChangeDisplayName = require("../views/settings/ChangeDisplayName"); module.exports = React.createClass({ displayName: 'UserSettings', @@ -152,6 +151,31 @@ module.exports = React.createClass({ ); }, + onPasswordChangeError: function(err) { + var errMsg = err.error || ""; + if (err.httpStatus === 403) { + errMsg = "Failed to change password. Is your password correct?"; + } + else if (err.httpStatus) { + errMsg += ` (HTTP status ${err.httpStatus})`; + } + var ErrorDialog = sdk.getComponent("dialogs.ErrorDialog"); + Modal.createDialog(ErrorDialog, { + title: "Error", + description: errMsg + }); + }, + + onPasswordChanged: function() { + var ErrorDialog = sdk.getComponent("dialogs.ErrorDialog"); + Modal.createDialog(ErrorDialog, { + title: "Success", + description: `Your password was successfully changed. You will not + receive push notifications on other devices until you + log back in to them.` + }); + }, + onLogoutPromptCancel: function() { this.logoutModal.closeDialog(); }, @@ -180,6 +204,9 @@ module.exports = React.createClass({ } // can only get here if phase is UserSettings.DISPLAY var RoomHeader = sdk.getComponent('rooms.RoomHeader'); + var ChangeDisplayName = sdk.getComponent("views.settings.ChangeDisplayName"); + var ChangePassword = sdk.getComponent("views.settings.ChangePassword"); + return (