Ask for email address after setting password for the first time
This is so that the user can reset their password.pull/4301/head
parent
c8416b0321
commit
4f55f810af
|
@ -17,7 +17,42 @@ limitations under the License.
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import sdk from 'matrix-react-sdk';
|
import sdk from 'matrix-react-sdk';
|
||||||
import { _t } from 'matrix-react-sdk/lib/languageHandler';
|
import { _t } from 'matrix-react-sdk/lib/languageHandler';
|
||||||
|
import Modal from 'matrix-react-sdk/lib/Modal';
|
||||||
|
|
||||||
|
const WarmFuzzy = function(props) {
|
||||||
|
const BaseDialog = sdk.getComponent('views.dialogs.BaseDialog');
|
||||||
|
let title = _t('You have successfully set a password!');
|
||||||
|
if (props.didSetEmail) {
|
||||||
|
title = _t('You have successfully set a password and an email address!');
|
||||||
|
}
|
||||||
|
const advice = _t('You can now return to your account after signing out, and sign in on other devices.');
|
||||||
|
let extraAdvice = null;
|
||||||
|
if (!props.didSetEmail) {
|
||||||
|
extraAdvice = _t('Remember, you can always set an email address in user settings if you change your mind.');
|
||||||
|
}
|
||||||
|
|
||||||
|
return <BaseDialog className="mx_SetPasswordDialog"
|
||||||
|
onFinished={props.onFinished}
|
||||||
|
title={ title }
|
||||||
|
>
|
||||||
|
<div className="mx_Dialog_content">
|
||||||
|
<p>
|
||||||
|
{ advice }
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
{ extraAdvice }
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<div className="mx_Dialog_buttons">
|
||||||
|
<button
|
||||||
|
className="mx_Dialog_primary"
|
||||||
|
autoFocus={true}
|
||||||
|
onClick={props.onFinished}>
|
||||||
|
{ _t('Continue') }
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</BaseDialog>;
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Prompt the user to set a password
|
* Prompt the user to set a password
|
||||||
|
@ -33,13 +68,19 @@ export default React.createClass({
|
||||||
getInitialState: function() {
|
getInitialState: function() {
|
||||||
return {
|
return {
|
||||||
error: null,
|
error: null,
|
||||||
success: false,
|
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
_onPasswordChanged: function() {
|
componentWillMount: function() {
|
||||||
this.setState({
|
console.info('SetPasswordDialog component will mount');
|
||||||
success: true,
|
},
|
||||||
|
|
||||||
|
_onPasswordChanged: function(res) {
|
||||||
|
Modal.createDialog(WarmFuzzy, {
|
||||||
|
didSetEmail: res.didSetEmail,
|
||||||
|
onFinished: () => {
|
||||||
|
this._onContinueClicked();
|
||||||
|
},
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -66,29 +107,6 @@ export default React.createClass({
|
||||||
const BaseDialog = sdk.getComponent('views.dialogs.BaseDialog');
|
const BaseDialog = sdk.getComponent('views.dialogs.BaseDialog');
|
||||||
const ChangePassword = sdk.getComponent('views.settings.ChangePassword');
|
const ChangePassword = sdk.getComponent('views.settings.ChangePassword');
|
||||||
|
|
||||||
if (this.state.success) {
|
|
||||||
return (
|
|
||||||
<BaseDialog className="mx_SetPasswordDialog"
|
|
||||||
onFinished={this.props.onFinished}
|
|
||||||
title={ _t('You have successfully set a password!') }
|
|
||||||
>
|
|
||||||
<div className="mx_Dialog_content">
|
|
||||||
<p>
|
|
||||||
{ _t('You can now return to your account after signing out, and sign in on other devices.') }
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
<div className="mx_Dialog_buttons">
|
|
||||||
<button
|
|
||||||
className="mx_Dialog_primary"
|
|
||||||
autoFocus={true}
|
|
||||||
onClick={this._onContinueClicked}>
|
|
||||||
{ _t('Continue') }
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</BaseDialog>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<BaseDialog className="mx_SetPasswordDialog"
|
<BaseDialog className="mx_SetPasswordDialog"
|
||||||
onFinished={this.props.onFinished}
|
onFinished={this.props.onFinished}
|
||||||
|
@ -106,6 +124,7 @@ export default React.createClass({
|
||||||
buttonClassName="mx_Dialog_primary mx_SetPasswordDialog_change_password_button"
|
buttonClassName="mx_Dialog_primary mx_SetPasswordDialog_change_password_button"
|
||||||
confirm={false}
|
confirm={false}
|
||||||
autoFocusNewPasswordInput={true}
|
autoFocusNewPasswordInput={true}
|
||||||
|
shouldAskForEmail={true}
|
||||||
onError={this._onPasswordChangeError}
|
onError={this._onPasswordChangeError}
|
||||||
onFinished={this._onPasswordChanged} />
|
onFinished={this._onPasswordChanged} />
|
||||||
<div className="error">
|
<div className="error">
|
||||||
|
|
|
@ -71,6 +71,7 @@
|
||||||
@import "./vector-web/views/context_menus/_MessageContextMenu.scss";
|
@import "./vector-web/views/context_menus/_MessageContextMenu.scss";
|
||||||
@import "./vector-web/views/context_menus/_RoomTileContextMenu.scss";
|
@import "./vector-web/views/context_menus/_RoomTileContextMenu.scss";
|
||||||
@import "./vector-web/views/dialogs/_ChangelogDialog.scss";
|
@import "./vector-web/views/dialogs/_ChangelogDialog.scss";
|
||||||
|
@import "./vector-web/views/dialogs/_SetEmailDialog.scss";
|
||||||
@import "./vector-web/views/dialogs/_SetPasswordDialog.scss";
|
@import "./vector-web/views/dialogs/_SetPasswordDialog.scss";
|
||||||
@import "./vector-web/views/directory/_NetworkDropdown.scss";
|
@import "./vector-web/views/directory/_NetworkDropdown.scss";
|
||||||
@import "./vector-web/views/elements/_ImageView.scss";
|
@import "./vector-web/views/elements/_ImageView.scss";
|
||||||
|
|
|
@ -0,0 +1,36 @@
|
||||||
|
/*
|
||||||
|
Copyright 2017 Vector Creations Ltd
|
||||||
|
|
||||||
|
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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
.mx_SetEmailDialog_email_input {
|
||||||
|
border-radius: 3px;
|
||||||
|
border: 1px solid $input-border-color;
|
||||||
|
padding: 9px;
|
||||||
|
color: $input-fg-color;
|
||||||
|
background-color: $primary-bg-color;
|
||||||
|
font-size: 15px;
|
||||||
|
width: 100%;
|
||||||
|
max-width: 280px;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mx_SetEmailDialog_email_input:focus {
|
||||||
|
outline: none;
|
||||||
|
box-shadow: none;
|
||||||
|
border: 1px solid $accent-color;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mx_SetEmailDialog_email_input_placeholder {
|
||||||
|
}
|
Loading…
Reference in New Issue