2016-01-12 20:20:16 +03:00
|
|
|
/*
|
|
|
|
Copyright 2015, 2016 OpenMarket Ltd
|
2019-02-06 18:10:16 +03:00
|
|
|
Copyright 2017, 2018, 2019 New Vector Ltd
|
2019-08-23 20:43:55 +03:00
|
|
|
Copyright 2019 The Matrix.org Foundation C.I.C.
|
2016-01-12 20:20:16 +03:00
|
|
|
|
|
|
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
you may not use this file except in compliance with the License.
|
|
|
|
You may obtain a copy of the License at
|
|
|
|
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
See the License for the specific language governing permissions and
|
|
|
|
limitations under the License.
|
|
|
|
*/
|
|
|
|
|
2017-10-27 03:23:50 +03:00
|
|
|
import React from 'react';
|
2019-08-30 12:27:51 +03:00
|
|
|
import createReactClass from 'create-react-class';
|
2017-12-26 04:03:18 +03:00
|
|
|
import PropTypes from 'prop-types';
|
2017-05-25 13:39:08 +03:00
|
|
|
import { _t } from '../../../languageHandler';
|
2019-12-20 04:19:56 +03:00
|
|
|
import * as sdk from '../../../index';
|
2017-10-27 03:23:50 +03:00
|
|
|
import Modal from "../../../Modal";
|
2018-04-06 12:27:03 +03:00
|
|
|
import SdkConfig from "../../../SdkConfig";
|
2017-10-27 03:23:50 +03:00
|
|
|
import PasswordReset from "../../../PasswordReset";
|
2019-06-05 08:41:59 +03:00
|
|
|
import AutoDiscoveryUtils, {ValidatedServerConfig} from "../../../utils/AutoDiscoveryUtils";
|
2019-06-11 04:28:32 +03:00
|
|
|
import classNames from 'classnames';
|
2019-12-13 05:31:52 +03:00
|
|
|
import AuthPage from "../../views/auth/AuthPage";
|
2016-01-12 20:20:16 +03:00
|
|
|
|
2019-02-06 19:30:53 +03:00
|
|
|
// Phases
|
|
|
|
// Show controls to configure server details
|
|
|
|
const PHASE_SERVER_DETAILS = 0;
|
|
|
|
// Show the forgot password inputs
|
|
|
|
const PHASE_FORGOT = 1;
|
|
|
|
// Email is in the process of being sent
|
|
|
|
const PHASE_SENDING_EMAIL = 2;
|
|
|
|
// Email has been sent
|
|
|
|
const PHASE_EMAIL_SENT = 3;
|
|
|
|
// User has clicked the link in email and completed reset
|
|
|
|
const PHASE_DONE = 4;
|
|
|
|
|
2019-12-20 03:45:24 +03:00
|
|
|
export default createReactClass({
|
2016-01-12 20:20:16 +03:00
|
|
|
displayName: 'ForgotPassword',
|
|
|
|
|
|
|
|
propTypes: {
|
2019-05-03 08:05:59 +03:00
|
|
|
serverConfig: PropTypes.instanceOf(ValidatedServerConfig).isRequired,
|
|
|
|
onServerConfigChange: PropTypes.func.isRequired,
|
2017-12-26 04:03:18 +03:00
|
|
|
onLoginClick: PropTypes.func,
|
|
|
|
onComplete: PropTypes.func.isRequired,
|
2016-01-12 20:20:16 +03:00
|
|
|
},
|
|
|
|
|
|
|
|
getInitialState: function() {
|
|
|
|
return {
|
2019-02-06 19:46:49 +03:00
|
|
|
phase: PHASE_FORGOT,
|
2019-02-06 21:26:44 +03:00
|
|
|
email: "",
|
|
|
|
password: "",
|
|
|
|
password2: "",
|
2018-12-05 09:34:57 +03:00
|
|
|
errorText: null,
|
2019-06-05 08:41:59 +03:00
|
|
|
|
|
|
|
// We perform liveliness checks later, but for now suppress the errors.
|
|
|
|
// We also track the server dead errors independently of the regular errors so
|
|
|
|
// that we can render it differently, and override any other error the user may
|
|
|
|
// be seeing.
|
|
|
|
serverIsAlive: true,
|
2019-06-11 04:28:32 +03:00
|
|
|
serverErrorIsFatal: false,
|
2019-06-05 08:41:59 +03:00
|
|
|
serverDeadError: "",
|
2019-08-16 20:11:24 +03:00
|
|
|
serverRequiresIdServer: null,
|
2016-01-12 20:20:16 +03:00
|
|
|
};
|
|
|
|
},
|
|
|
|
|
2019-06-05 08:41:59 +03:00
|
|
|
componentWillMount: function() {
|
2019-08-16 20:11:24 +03:00
|
|
|
this.reset = null;
|
2019-06-05 08:41:59 +03:00
|
|
|
this._checkServerLiveliness(this.props.serverConfig);
|
|
|
|
},
|
|
|
|
|
2019-06-06 21:18:41 +03:00
|
|
|
componentWillReceiveProps: function(newProps) {
|
2019-06-05 08:41:59 +03:00
|
|
|
if (newProps.serverConfig.hsUrl === this.props.serverConfig.hsUrl &&
|
|
|
|
newProps.serverConfig.isUrl === this.props.serverConfig.isUrl) return;
|
|
|
|
|
|
|
|
// Do a liveliness check on the new URLs
|
|
|
|
this._checkServerLiveliness(newProps.serverConfig);
|
|
|
|
},
|
|
|
|
|
|
|
|
_checkServerLiveliness: async function(serverConfig) {
|
|
|
|
try {
|
|
|
|
await AutoDiscoveryUtils.validateServerConfigWithStaticUrls(
|
|
|
|
serverConfig.hsUrl,
|
|
|
|
serverConfig.isUrl,
|
|
|
|
);
|
2019-08-16 20:11:24 +03:00
|
|
|
|
|
|
|
const pwReset = new PasswordReset(serverConfig.hsUrl, serverConfig.isUrl);
|
|
|
|
const serverRequiresIdServer = await pwReset.doesServerRequireIdServerParam();
|
|
|
|
|
|
|
|
this.setState({
|
|
|
|
serverIsAlive: true,
|
|
|
|
serverRequiresIdServer,
|
|
|
|
});
|
2019-06-05 08:41:59 +03:00
|
|
|
} catch (e) {
|
2019-06-11 04:28:32 +03:00
|
|
|
this.setState(AutoDiscoveryUtils.authComponentStateForError(e, "forgot_password"));
|
2019-06-05 08:41:59 +03:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2019-05-03 08:05:59 +03:00
|
|
|
submitPasswordReset: function(email, password) {
|
2016-01-12 20:20:16 +03:00
|
|
|
this.setState({
|
2019-02-06 19:30:53 +03:00
|
|
|
phase: PHASE_SENDING_EMAIL,
|
2016-01-12 20:20:16 +03:00
|
|
|
});
|
2019-05-03 08:05:59 +03:00
|
|
|
this.reset = new PasswordReset(this.props.serverConfig.hsUrl, this.props.serverConfig.isUrl);
|
2019-11-18 13:03:05 +03:00
|
|
|
this.reset.resetPassword(email, password).then(() => {
|
2016-01-12 20:20:16 +03:00
|
|
|
this.setState({
|
2019-02-06 19:30:53 +03:00
|
|
|
phase: PHASE_EMAIL_SENT,
|
2016-01-12 20:20:16 +03:00
|
|
|
});
|
|
|
|
}, (err) => {
|
2017-05-23 17:16:31 +03:00
|
|
|
this.showErrorDialog(_t('Failed to send email') + ": " + err.message);
|
2016-01-12 20:20:16 +03:00
|
|
|
this.setState({
|
2019-02-06 21:32:28 +03:00
|
|
|
phase: PHASE_FORGOT,
|
2016-01-12 20:20:16 +03:00
|
|
|
});
|
2017-01-20 17:22:27 +03:00
|
|
|
});
|
2016-01-12 20:20:16 +03:00
|
|
|
},
|
|
|
|
|
2019-09-24 16:47:08 +03:00
|
|
|
onVerify: async function(ev) {
|
2016-01-12 20:20:16 +03:00
|
|
|
ev.preventDefault();
|
|
|
|
if (!this.reset) {
|
|
|
|
console.error("onVerify called before submitPasswordReset!");
|
|
|
|
return;
|
|
|
|
}
|
2019-09-24 16:47:08 +03:00
|
|
|
try {
|
|
|
|
await this.reset.checkEmailLinkClicked();
|
2019-02-06 19:30:53 +03:00
|
|
|
this.setState({ phase: PHASE_DONE });
|
2019-09-24 16:47:08 +03:00
|
|
|
} catch (err) {
|
2016-01-12 20:20:16 +03:00
|
|
|
this.showErrorDialog(err.message);
|
2019-09-24 16:47:08 +03:00
|
|
|
}
|
2016-01-12 20:20:16 +03:00
|
|
|
},
|
|
|
|
|
2019-06-07 16:27:15 +03:00
|
|
|
onSubmitForm: async function(ev) {
|
2016-01-12 20:20:16 +03:00
|
|
|
ev.preventDefault();
|
|
|
|
|
2019-06-11 12:29:00 +03:00
|
|
|
// refresh the server errors, just in case the server came back online
|
2019-06-07 16:36:46 +03:00
|
|
|
await this._checkServerLiveliness(this.props.serverConfig);
|
2019-06-05 08:41:59 +03:00
|
|
|
|
2016-01-12 20:20:16 +03:00
|
|
|
if (!this.state.email) {
|
2017-05-23 17:16:31 +03:00
|
|
|
this.showErrorDialog(_t('The email address linked to your account must be entered.'));
|
2017-10-11 19:56:17 +03:00
|
|
|
} else if (!this.state.password || !this.state.password2) {
|
2017-05-27 20:20:35 +03:00
|
|
|
this.showErrorDialog(_t('A new password must be entered.'));
|
2017-10-11 19:56:17 +03:00
|
|
|
} else if (this.state.password !== this.state.password2) {
|
2017-05-23 17:16:31 +03:00
|
|
|
this.showErrorDialog(_t('New passwords must match each other.'));
|
2017-10-11 19:56:17 +03:00
|
|
|
} else {
|
|
|
|
const QuestionDialog = sdk.getComponent("dialogs.QuestionDialog");
|
2017-07-27 19:19:18 +03:00
|
|
|
Modal.createTrackedDialog('Forgot Password Warning', '', QuestionDialog, {
|
2017-05-25 20:20:48 +03:00
|
|
|
title: _t('Warning!'),
|
2017-01-25 00:36:55 +03:00
|
|
|
description:
|
|
|
|
<div>
|
2017-05-23 17:16:31 +03:00
|
|
|
{ _t(
|
2019-03-14 00:24:05 +03:00
|
|
|
"Changing your password will reset any end-to-end encryption keys " +
|
2020-01-29 18:48:25 +03:00
|
|
|
"on all of your sessions, making encrypted chat history unreadable. Set up " +
|
|
|
|
"Key Backup or export your room keys from another session before resetting your " +
|
2019-03-14 00:24:05 +03:00
|
|
|
"password.",
|
2017-05-27 20:20:35 +03:00
|
|
|
) }
|
2017-01-25 00:36:55 +03:00
|
|
|
</div>,
|
2017-05-23 17:16:31 +03:00
|
|
|
button: _t('Continue'),
|
2017-01-25 00:36:55 +03:00
|
|
|
onFinished: (confirmed) => {
|
|
|
|
if (confirmed) {
|
2019-05-03 08:05:59 +03:00
|
|
|
this.submitPasswordReset(this.state.email, this.state.password);
|
2017-01-25 00:36:55 +03:00
|
|
|
}
|
|
|
|
},
|
|
|
|
});
|
2016-01-12 20:20:16 +03:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
onInputChanged: function(stateKey, ev) {
|
|
|
|
this.setState({
|
2017-10-11 19:56:17 +03:00
|
|
|
[stateKey]: ev.target.value,
|
2016-01-12 20:20:16 +03:00
|
|
|
});
|
|
|
|
},
|
|
|
|
|
2019-05-14 01:30:34 +03:00
|
|
|
async onServerDetailsNextPhaseClick() {
|
2019-02-06 21:30:07 +03:00
|
|
|
this.setState({
|
|
|
|
phase: PHASE_FORGOT,
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
|
|
|
onEditServerDetailsClick(ev) {
|
|
|
|
ev.preventDefault();
|
|
|
|
ev.stopPropagation();
|
|
|
|
this.setState({
|
|
|
|
phase: PHASE_SERVER_DETAILS,
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
Fix browser navigation not working between /home, /login, /register, etc
All of the anchors were pointed at `#` which, when clicked, would trigger a hash change in the browser. This change races the change made by the screen handling where the screen handling ends up losing. Because the hash is then tracked as empty rather than `#/login` (for example), the state machine considers future changes as no-ops and doesn't do anything with them.
By using `preventDefault` and `stopPropagation` on the anchor click events, we prevent the browser from automatically going to an empty hash, which then means the screen handling isn't racing the browser, and the hash change state machine doesn't no-op.
After applying that fix, going between pages worked great unless you were going from /login to /home. This is because the MatrixChat state machine was now out of sync (a `view` of `LOGIN` but a `page` of `HomePage` - an invalid state). All we have to do here is ensure the right view is used when navigating to the homepage.
Fixes https://github.com/vector-im/riot-web/issues/4061
Note: the concerns in 4061 about logging out upon entering the view appear to have been solved. Navigating to the login page doesn't obliterate your session, at least in my testing.
2018-12-21 03:26:13 +03:00
|
|
|
onLoginClick: function(ev) {
|
|
|
|
ev.preventDefault();
|
|
|
|
ev.stopPropagation();
|
|
|
|
this.props.onLoginClick();
|
|
|
|
},
|
|
|
|
|
2016-01-12 20:20:16 +03:00
|
|
|
showErrorDialog: function(body, title) {
|
2017-10-11 19:56:17 +03:00
|
|
|
const ErrorDialog = sdk.getComponent("dialogs.ErrorDialog");
|
2017-08-10 17:21:01 +03:00
|
|
|
Modal.createTrackedDialog('Forgot Password Error', '', ErrorDialog, {
|
2016-01-12 20:20:16 +03:00
|
|
|
title: title,
|
2017-05-23 17:16:31 +03:00
|
|
|
description: body,
|
2016-01-12 20:20:16 +03:00
|
|
|
});
|
|
|
|
},
|
|
|
|
|
2019-02-06 19:46:49 +03:00
|
|
|
renderServerDetails() {
|
|
|
|
const ServerConfig = sdk.getComponent("auth.ServerConfig");
|
|
|
|
|
2019-02-06 21:30:07 +03:00
|
|
|
if (SdkConfig.get()['disable_custom_urls']) {
|
|
|
|
return null;
|
2019-02-06 19:46:49 +03:00
|
|
|
}
|
|
|
|
|
2019-05-14 01:30:34 +03:00
|
|
|
return <ServerConfig
|
|
|
|
serverConfig={this.props.serverConfig}
|
|
|
|
onServerConfigChange={this.props.onServerConfigChange}
|
|
|
|
delayTimeMs={0}
|
2019-08-23 20:43:55 +03:00
|
|
|
showIdentityServerIfRequiredByHomeserver={true}
|
2019-05-14 01:30:34 +03:00
|
|
|
onAfterSubmit={this.onServerDetailsNextPhaseClick}
|
|
|
|
submitText={_t("Next")}
|
|
|
|
submitClass="mx_Login_submit"
|
|
|
|
/>;
|
2019-02-06 21:30:07 +03:00
|
|
|
},
|
|
|
|
|
|
|
|
renderForgot() {
|
2019-03-05 18:39:51 +03:00
|
|
|
const Field = sdk.getComponent('elements.Field');
|
|
|
|
|
2019-02-06 19:46:49 +03:00
|
|
|
let errorText = null;
|
2019-06-05 08:41:59 +03:00
|
|
|
const err = this.state.errorText;
|
2019-02-06 19:46:49 +03:00
|
|
|
if (err) {
|
|
|
|
errorText = <div className="mx_Login_error">{ err }</div>;
|
|
|
|
}
|
|
|
|
|
2019-06-05 08:41:59 +03:00
|
|
|
let serverDeadSection;
|
|
|
|
if (!this.state.serverIsAlive) {
|
2019-06-11 04:28:32 +03:00
|
|
|
const classes = classNames({
|
|
|
|
"mx_Login_error": true,
|
|
|
|
"mx_Login_serverError": true,
|
|
|
|
"mx_Login_serverErrorNonFatal": !this.state.serverErrorIsFatal,
|
|
|
|
});
|
2019-06-05 08:41:59 +03:00
|
|
|
serverDeadSection = (
|
2019-06-11 04:28:32 +03:00
|
|
|
<div className={classes}>
|
2019-06-05 08:41:59 +03:00
|
|
|
{this.state.serverDeadError}
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2019-05-03 08:05:59 +03:00
|
|
|
let yourMatrixAccountText = _t('Your Matrix account on %(serverName)s', {
|
|
|
|
serverName: this.props.serverConfig.hsName,
|
|
|
|
});
|
|
|
|
if (this.props.serverConfig.hsNameIsDifferent) {
|
2019-05-14 02:16:40 +03:00
|
|
|
const TextWithTooltip = sdk.getComponent("elements.TextWithTooltip");
|
|
|
|
|
2019-05-03 08:05:59 +03:00
|
|
|
yourMatrixAccountText = _t('Your Matrix account on <underlinedServerName />', {}, {
|
2019-05-14 02:16:40 +03:00
|
|
|
'underlinedServerName': () => {
|
|
|
|
return <TextWithTooltip
|
|
|
|
class="mx_Login_underlinedServerName"
|
2019-05-15 22:55:50 +03:00
|
|
|
tooltip={this.props.serverConfig.hsUrl}
|
|
|
|
>
|
2019-05-14 02:16:40 +03:00
|
|
|
{this.props.serverConfig.hsName}
|
|
|
|
</TextWithTooltip>;
|
|
|
|
},
|
2019-02-06 19:46:49 +03:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2019-02-06 21:30:07 +03:00
|
|
|
// If custom URLs are allowed, wire up the server details edit link.
|
|
|
|
let editLink = null;
|
|
|
|
if (!SdkConfig.get()['disable_custom_urls']) {
|
|
|
|
editLink = <a className="mx_AuthBody_editServerDetails"
|
|
|
|
href="#" onClick={this.onEditServerDetailsClick}
|
|
|
|
>
|
|
|
|
{_t('Change')}
|
|
|
|
</a>;
|
|
|
|
}
|
|
|
|
|
2019-08-16 20:11:24 +03:00
|
|
|
if (!this.props.serverConfig.isUrl && this.state.serverRequiresIdServer) {
|
2019-08-07 15:30:52 +03:00
|
|
|
return <div>
|
|
|
|
<h3>
|
|
|
|
{yourMatrixAccountText}
|
|
|
|
{editLink}
|
|
|
|
</h3>
|
|
|
|
{_t(
|
|
|
|
"No identity server is configured: " +
|
|
|
|
"add one in server settings to reset your password.",
|
|
|
|
)}
|
|
|
|
<a className="mx_AuthBody_changeFlow" onClick={this.onLoginClick} href="#">
|
|
|
|
{_t('Sign in instead')}
|
|
|
|
</a>
|
|
|
|
</div>;
|
|
|
|
}
|
|
|
|
|
2019-02-06 19:46:49 +03:00
|
|
|
return <div>
|
2019-06-05 08:41:59 +03:00
|
|
|
{errorText}
|
|
|
|
{serverDeadSection}
|
2019-02-06 19:46:49 +03:00
|
|
|
<h3>
|
|
|
|
{yourMatrixAccountText}
|
2019-02-06 21:30:07 +03:00
|
|
|
{editLink}
|
2019-02-06 19:46:49 +03:00
|
|
|
</h3>
|
|
|
|
<form onSubmit={this.onSubmitForm}>
|
|
|
|
<div className="mx_AuthBody_fieldRow">
|
2019-03-05 18:39:51 +03:00
|
|
|
<Field
|
|
|
|
id="mx_ForgotPassword_email"
|
2019-02-06 19:46:49 +03:00
|
|
|
name="reset_email" // define a name so browser's password autofill gets less confused
|
2019-03-05 18:39:51 +03:00
|
|
|
type="text"
|
|
|
|
label={_t('Email')}
|
2019-02-06 19:46:49 +03:00
|
|
|
value={this.state.email}
|
|
|
|
onChange={this.onInputChanged.bind(this, "email")}
|
2019-03-05 18:39:51 +03:00
|
|
|
autoFocus
|
|
|
|
/>
|
2019-02-06 19:46:49 +03:00
|
|
|
</div>
|
|
|
|
<div className="mx_AuthBody_fieldRow">
|
2019-03-05 18:39:51 +03:00
|
|
|
<Field
|
|
|
|
id="mx_ForgotPassword_password"
|
2019-02-06 19:46:49 +03:00
|
|
|
name="reset_password"
|
2019-03-05 18:39:51 +03:00
|
|
|
type="password"
|
|
|
|
label={_t('Password')}
|
2019-02-06 19:46:49 +03:00
|
|
|
value={this.state.password}
|
|
|
|
onChange={this.onInputChanged.bind(this, "password")}
|
2019-03-05 18:39:51 +03:00
|
|
|
/>
|
|
|
|
<Field
|
|
|
|
id="mx_ForgotPassword_passwordConfirm"
|
2019-02-06 19:46:49 +03:00
|
|
|
name="reset_password_confirm"
|
2019-03-05 18:39:51 +03:00
|
|
|
type="password"
|
|
|
|
label={_t('Confirm')}
|
2019-02-06 19:46:49 +03:00
|
|
|
value={this.state.password2}
|
|
|
|
onChange={this.onInputChanged.bind(this, "password2")}
|
2019-03-05 18:39:51 +03:00
|
|
|
/>
|
2019-02-06 19:46:49 +03:00
|
|
|
</div>
|
|
|
|
<span>{_t(
|
|
|
|
'A verification email will be sent to your inbox to confirm ' +
|
|
|
|
'setting your new password.',
|
|
|
|
)}</span>
|
2019-06-05 08:41:59 +03:00
|
|
|
<input
|
|
|
|
className="mx_Login_submit"
|
|
|
|
type="submit"
|
|
|
|
value={_t('Send Reset Email')}
|
|
|
|
/>
|
2019-02-06 19:46:49 +03:00
|
|
|
</form>
|
|
|
|
<a className="mx_AuthBody_changeFlow" onClick={this.onLoginClick} href="#">
|
|
|
|
{_t('Sign in instead')}
|
|
|
|
</a>
|
|
|
|
</div>;
|
|
|
|
},
|
|
|
|
|
|
|
|
renderSendingEmail() {
|
|
|
|
const Spinner = sdk.getComponent("elements.Spinner");
|
|
|
|
return <Spinner />;
|
|
|
|
},
|
|
|
|
|
|
|
|
renderEmailSent() {
|
|
|
|
return <div>
|
|
|
|
{_t("An email has been sent to %(emailAddress)s. Once you've followed the " +
|
|
|
|
"link it contains, click below.", { emailAddress: this.state.email })}
|
|
|
|
<br />
|
|
|
|
<input className="mx_Login_submit" type="button" onClick={this.onVerify}
|
|
|
|
value={_t('I have verified my email address')} />
|
|
|
|
</div>;
|
|
|
|
},
|
|
|
|
|
|
|
|
renderDone() {
|
|
|
|
return <div>
|
2019-02-07 12:57:31 +03:00
|
|
|
<p>{_t("Your password has been reset.")}</p>
|
|
|
|
<p>{_t(
|
2020-01-29 18:48:25 +03:00
|
|
|
"You have been logged out of all sessions and will no longer receive " +
|
2019-02-07 12:57:31 +03:00
|
|
|
"push notifications. To re-enable notifications, sign in again on each " +
|
2020-01-29 18:48:25 +03:00
|
|
|
"session.",
|
2019-02-07 12:57:31 +03:00
|
|
|
)}</p>
|
2019-02-06 19:46:49 +03:00
|
|
|
<input className="mx_Login_submit" type="button" onClick={this.props.onComplete}
|
|
|
|
value={_t('Return to login screen')} />
|
|
|
|
</div>;
|
|
|
|
},
|
|
|
|
|
2016-01-12 20:20:16 +03:00
|
|
|
render: function() {
|
2019-01-22 03:33:17 +03:00
|
|
|
const AuthHeader = sdk.getComponent("auth.AuthHeader");
|
2019-01-23 04:28:23 +03:00
|
|
|
const AuthBody = sdk.getComponent("auth.AuthBody");
|
2016-01-12 20:20:16 +03:00
|
|
|
|
2017-10-11 19:56:17 +03:00
|
|
|
let resetPasswordJsx;
|
2019-02-06 19:46:49 +03:00
|
|
|
switch (this.state.phase) {
|
|
|
|
case PHASE_SERVER_DETAILS:
|
|
|
|
resetPasswordJsx = this.renderServerDetails();
|
|
|
|
break;
|
|
|
|
case PHASE_FORGOT:
|
|
|
|
resetPasswordJsx = this.renderForgot();
|
|
|
|
break;
|
|
|
|
case PHASE_SENDING_EMAIL:
|
|
|
|
resetPasswordJsx = this.renderSendingEmail();
|
|
|
|
break;
|
|
|
|
case PHASE_EMAIL_SENT:
|
|
|
|
resetPasswordJsx = this.renderEmailSent();
|
|
|
|
break;
|
|
|
|
case PHASE_DONE:
|
|
|
|
resetPasswordJsx = this.renderDone();
|
|
|
|
break;
|
2016-01-12 20:20:16 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
return (
|
2019-01-22 03:33:17 +03:00
|
|
|
<AuthPage>
|
2019-01-22 03:49:28 +03:00
|
|
|
<AuthHeader />
|
2019-01-23 04:28:23 +03:00
|
|
|
<AuthBody>
|
2019-01-24 00:03:43 +03:00
|
|
|
<h2> { _t('Set a new password') } </h2>
|
2019-01-23 04:28:23 +03:00
|
|
|
{resetPasswordJsx}
|
|
|
|
</AuthBody>
|
2019-01-22 03:33:17 +03:00
|
|
|
</AuthPage>
|
2016-01-12 20:20:16 +03:00
|
|
|
);
|
2017-10-11 19:56:17 +03:00
|
|
|
},
|
2016-01-12 20:20:16 +03:00
|
|
|
});
|