Доработаны формы восстановления пароля

This commit is contained in:
ErickSkrauch 2016-05-17 15:30:04 +03:00
parent 4c7ffa77f9
commit 9580ec72e3
8 changed files with 55 additions and 18 deletions

View File

@ -2,7 +2,7 @@
"changePasswordTitle": "Change password", "changePasswordTitle": "Change password",
"changePasswordMessage": "To enhance the security of your account, please change your password.", "changePasswordMessage": "To enhance the security of your account, please change your password.",
"skipThisStep": "Skip password changing", "skipThisStep": "Skip password changing",
"change": "Change", "change": "Change password",
"currentPassword": "Enter current password", "currentPassword": "Enter current password",
"newPassword": "Enter new password", "newPassword": "Enter new password",
"newRePassword": "Repeat new password" "newRePassword": "Repeat new password"

View File

@ -14,9 +14,22 @@ export default class ForgotPasswordBody extends BaseAuthBody {
static panelId = 'forgotPassword'; static panelId = 'forgotPassword';
static hasGoBack = true; static hasGoBack = true;
state = {
isLoginEdit: !(this.context.user.email || this.context.user.username)
};
autoFocusField = this.state.isLoginEdit ? 'email' : null;
onClickEdit = () => {
this.setState({
isLoginEdit: true
});
};
render() { render() {
const { user } = this.context; const { user } = this.context;
const login = user.email || user.username; const login = user.email || user.username || '';
const isLoginEditShown = this.state.isLoginEdit;
// TODO: нужно парсить инфу о том, какой кд у отправки кода и во сколько точно можно будет повторить // TODO: нужно парсить инфу о том, какой кд у отправки кода и во сколько точно можно будет повторить
@ -28,16 +41,7 @@ export default class ForgotPasswordBody extends BaseAuthBody {
<span className={icons.lock} /> <span className={icons.lock} />
</div> </div>
{login ? ( {isLoginEditShown ? (
<div>
<div className={styles.login}>
{login}
</div>
<p className={styles.descriptionText}>
<Message {...messages.pleasePressButton} />
</p>
</div>
) : (
<div> <div>
<p className={styles.descriptionText}> <p className={styles.descriptionText}>
<Message {...messages.specifyEmail} /> <Message {...messages.specifyEmail} />
@ -50,6 +54,16 @@ export default class ForgotPasswordBody extends BaseAuthBody {
defaultValue={login} defaultValue={login}
/> />
</div> </div>
) : (
<div>
<div className={styles.login}>
{login}
<span className={styles.editLogin} onClick={this.onClickEdit} />
</div>
<p className={styles.descriptionText}>
<Message {...messages.pleasePressButton} />
</p>
</div>
)} )}
</div> </div>
); );

View File

@ -18,3 +18,22 @@
.login { .login {
composes: email from 'components/auth/password/password.scss'; composes: email from 'components/auth/password/password.scss';
} }
.editLogin {
composes: pencil from 'components/ui/icons.scss';
position: relative;
bottom: 1px;
padding-left: 3px;
color: #666666;
font-size: 10px;
transition: color .3s;
cursor: pointer;
&:hover {
color: #ccc;
}
}

View File

@ -1,6 +1,7 @@
{ {
"title": "Restore password", "title": "Restore password",
"contactSupport": "Contact support", "contactSupport": "Contact support",
"messageWasSent": "The recovery code was sent to your account email.",
"messageWasSentTo": "The recovery code was sent to your email {email}.", "messageWasSentTo": "The recovery code was sent to your email {email}.",
"enterCodeBelow": "Please enter the code received into the field below:", "enterCodeBelow": "Please enter the code received into the field below:",
"enterNewPasswordBelow": "Enter and repeat new password below:", "enterNewPasswordBelow": "Enter and repeat new password below:",

View File

@ -25,7 +25,6 @@ export default class RecoverPasswordBody extends BaseAuthBody {
autoFocusField = this.props.params && this.props.params.key ? 'newPassword' : 'key'; autoFocusField = this.props.params && this.props.params.key ? 'newPassword' : 'key';
// Если юзер вводил своё мыло во время попытки авторизации, то почему бы его сюда автоматически не подставить?
render() { render() {
const {user} = this.context; const {user} = this.context;
const {key} = this.props.params; const {key} = this.props.params;
@ -39,14 +38,16 @@ export default class RecoverPasswordBody extends BaseAuthBody {
<Message {...messages.messageWasSentTo} values={{ <Message {...messages.messageWasSentTo} values={{
email: <b>{user.maskedEmail}</b> email: <b>{user.maskedEmail}</b>
}} /> }} />
) : null} ) : (
<Message {...messages.messageWasSent} />
)}
{' '} {' '}
<Message {...messages.enterCodeBelow} /> <Message {...messages.enterCodeBelow} />
</p> </p>
<Input {...this.bindField('key')} <Input {...this.bindField('key')}
color="lightViolet" color="lightViolet"
style={{textAlign: 'center'}} style={{textAlign: 'center'}} // ну это уже низко
required required
value={key} value={key}
readOnly={!!key} readOnly={!!key}

View File

@ -3,6 +3,6 @@
.descriptionText { .descriptionText {
font-size: 15px; font-size: 15px;
line-height: 1.4; line-height: 1.4;
padding-bottom: 8px; margin-bottom: 8px;
color: #aaa; color: #aaa;
} }

View File

@ -14,7 +14,7 @@
"components.auth.activation.didNotReceivedEmail": "Did not received E-mail?", "components.auth.activation.didNotReceivedEmail": "Did not received E-mail?",
"components.auth.activation.enterTheCode": "Enter the code from E-mail here", "components.auth.activation.enterTheCode": "Enter the code from E-mail here",
"components.auth.appInfo.goToAuth": "Go to auth", "components.auth.appInfo.goToAuth": "Go to auth",
"components.auth.changePassword.change": "Change", "components.auth.changePassword.change": "Change password",
"components.auth.changePassword.changePasswordMessage": "To enhance the security of your account, please change your password.", "components.auth.changePassword.changePasswordMessage": "To enhance the security of your account, please change your password.",
"components.auth.changePassword.changePasswordTitle": "Change password", "components.auth.changePassword.changePasswordTitle": "Change password",
"components.auth.changePassword.currentPassword": "Enter current password", "components.auth.changePassword.currentPassword": "Enter current password",
@ -54,6 +54,7 @@
"components.auth.recoverPassword.enterCodeBelow": "Please enter the code received into the field below:", "components.auth.recoverPassword.enterCodeBelow": "Please enter the code received into the field below:",
"components.auth.recoverPassword.enterNewPasswordBelow": "Enter and repeat new password below:", "components.auth.recoverPassword.enterNewPasswordBelow": "Enter and repeat new password below:",
"components.auth.recoverPassword.enterTheCode": "Enter confirmation code", "components.auth.recoverPassword.enterTheCode": "Enter confirmation code",
"components.auth.recoverPassword.messageWasSent": "The recovery code was sent to your account email.",
"components.auth.recoverPassword.messageWasSentTo": "The recovery code was sent to your email {email}.", "components.auth.recoverPassword.messageWasSentTo": "The recovery code was sent to your email {email}.",
"components.auth.recoverPassword.title": "Restore password", "components.auth.recoverPassword.title": "Restore password",
"components.auth.register.acceptRules": "I agree with {link}", "components.auth.register.acceptRules": "I agree with {link}",

View File

@ -14,7 +14,7 @@
"components.auth.activation.didNotReceivedEmail": "Did not received E-mail?", "components.auth.activation.didNotReceivedEmail": "Did not received E-mail?",
"components.auth.activation.enterTheCode": "Enter the code from E-mail here", "components.auth.activation.enterTheCode": "Enter the code from E-mail here",
"components.auth.appInfo.goToAuth": "Go to auth", "components.auth.appInfo.goToAuth": "Go to auth",
"components.auth.changePassword.change": "Change", "components.auth.changePassword.change": "Сменить пароль",
"components.auth.changePassword.changePasswordMessage": "To enhance the security of your account, please change your password.", "components.auth.changePassword.changePasswordMessage": "To enhance the security of your account, please change your password.",
"components.auth.changePassword.changePasswordTitle": "Change password", "components.auth.changePassword.changePasswordTitle": "Change password",
"components.auth.changePassword.currentPassword": "Enter current password", "components.auth.changePassword.currentPassword": "Enter current password",
@ -54,6 +54,7 @@
"components.auth.recoverPassword.enterCodeBelow": "Please enter the code received into the field below:", "components.auth.recoverPassword.enterCodeBelow": "Please enter the code received into the field below:",
"components.auth.recoverPassword.enterNewPasswordBelow": "Enter and repeat new password below:", "components.auth.recoverPassword.enterNewPasswordBelow": "Enter and repeat new password below:",
"components.auth.recoverPassword.enterTheCode": "Enter confirmation code", "components.auth.recoverPassword.enterTheCode": "Enter confirmation code",
"components.auth.recoverPassword.messageWasSent": "The recovery code was sent to your account email.",
"components.auth.recoverPassword.messageWasSentTo": "The recovery code was sent to your email {email}.", "components.auth.recoverPassword.messageWasSentTo": "The recovery code was sent to your email {email}.",
"components.auth.recoverPassword.title": "Restore password", "components.auth.recoverPassword.title": "Restore password",
"components.auth.register.acceptRules": "I agree with {link}", "components.auth.register.acceptRules": "I agree with {link}",