mirror of
https://github.com/elyby/accounts-frontend.git
synced 2025-05-31 14:11:58 +05:30
#156: add already have code for register panel
This commit is contained in:
@ -7,7 +7,7 @@ export default function RejectionLink(props, context) {
|
|||||||
<a href="#" onClick={(event) => {
|
<a href="#" onClick={(event) => {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
|
||||||
context.reject();
|
context.reject(props.payload);
|
||||||
}}>
|
}}>
|
||||||
<Message {...props.label} />
|
<Message {...props.label} />
|
||||||
</a>
|
</a>
|
||||||
@ -16,6 +16,8 @@ export default function RejectionLink(props, context) {
|
|||||||
|
|
||||||
RejectionLink.displayName = 'RejectionLink';
|
RejectionLink.displayName = 'RejectionLink';
|
||||||
RejectionLink.propTypes = {
|
RejectionLink.propTypes = {
|
||||||
|
// eslint-disable-next-line react/forbid-prop-types
|
||||||
|
payload: PropTypes.object, // Custom payload for active state
|
||||||
label: PropTypes.shape({
|
label: PropTypes.shape({
|
||||||
id: PropTypes.string
|
id: PropTypes.string
|
||||||
}).isRequired
|
}).isRequired
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
{
|
{
|
||||||
"accountActivationTitle": "Account activation",
|
"accountActivationTitle": "Account activation",
|
||||||
"activationMailWasSent": "Please check {email} for the message with the last registration step",
|
"activationMailWasSent": "Please check {email} for the message with further instructions",
|
||||||
|
"activationMailWasSentNoEmail": "Please check your E-mail for the message with further instructions",
|
||||||
"confirmEmail": "Confirm E‑mail",
|
"confirmEmail": "Confirm E‑mail",
|
||||||
"didNotReceivedEmail": "Did not received E‑mail?",
|
"didNotReceivedEmail": "Did not received E‑mail?",
|
||||||
"enterTheCode": "Enter the code from E‑mail here"
|
"enterTheCode": "Enter the code from E‑mail here"
|
||||||
|
@ -22,6 +22,7 @@ export default class ActivationBody extends BaseAuthBody {
|
|||||||
|
|
||||||
render() {
|
render() {
|
||||||
const {key} = this.props.params;
|
const {key} = this.props.params;
|
||||||
|
const email = this.context.user.email;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
@ -31,9 +32,16 @@ export default class ActivationBody extends BaseAuthBody {
|
|||||||
<div className={styles.descriptionImage} />
|
<div className={styles.descriptionImage} />
|
||||||
|
|
||||||
<div className={styles.descriptionText}>
|
<div className={styles.descriptionText}>
|
||||||
|
{email
|
||||||
|
? (
|
||||||
<Message {...messages.activationMailWasSent} values={{
|
<Message {...messages.activationMailWasSent} values={{
|
||||||
email: (<b>{this.context.user.email}</b>)
|
email: (<b>{email}</b>)
|
||||||
}} />
|
}} />
|
||||||
|
)
|
||||||
|
: (
|
||||||
|
<Message {...messages.activationMailWasSentNoEmail} />
|
||||||
|
)
|
||||||
|
}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className={styles.formRow}>
|
<div className={styles.formRow}>
|
||||||
|
@ -4,6 +4,7 @@ import { Button } from 'components/ui/form';
|
|||||||
import RejectionLink from 'components/auth/RejectionLink';
|
import RejectionLink from 'components/auth/RejectionLink';
|
||||||
import AuthTitle from 'components/auth/AuthTitle';
|
import AuthTitle from 'components/auth/AuthTitle';
|
||||||
import activationMessages from 'components/auth/activation/Activation.intl.json';
|
import activationMessages from 'components/auth/activation/Activation.intl.json';
|
||||||
|
import forgotPasswordMessages from 'components/auth/forgotPassword/ForgotPassword.intl.json';
|
||||||
|
|
||||||
import messages from './Register.intl.json';
|
import messages from './Register.intl.json';
|
||||||
import Body from './RegisterBody';
|
import Body from './RegisterBody';
|
||||||
@ -13,6 +14,12 @@ export default function Register() {
|
|||||||
Title: () => <AuthTitle title={messages.registerTitle} />,
|
Title: () => <AuthTitle title={messages.registerTitle} />,
|
||||||
Body,
|
Body,
|
||||||
Footer: () => <Button color="blue" label={messages.signUpButton} type="submit" />,
|
Footer: () => <Button color="blue" label={messages.signUpButton} type="submit" />,
|
||||||
Links: () => <RejectionLink label={activationMessages.didNotReceivedEmail} />
|
Links: () => (
|
||||||
|
<span>
|
||||||
|
<RejectionLink label={activationMessages.didNotReceivedEmail} payload={{requestEmail: true}} />
|
||||||
|
{' | '}
|
||||||
|
<RejectionLink label={forgotPasswordMessages.alreadyHaveCode} />
|
||||||
|
</span>
|
||||||
|
)
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,8 @@ import React from 'react';
|
|||||||
|
|
||||||
import { Button } from 'components/ui/form';
|
import { Button } from 'components/ui/form';
|
||||||
import AuthTitle from 'components/auth/AuthTitle';
|
import AuthTitle from 'components/auth/AuthTitle';
|
||||||
|
import RejectionLink from 'components/auth/RejectionLink';
|
||||||
|
import forgotPasswordMessages from 'components/auth/forgotPassword/ForgotPassword.intl.json';
|
||||||
|
|
||||||
import messages from './ResendActivation.intl.json';
|
import messages from './ResendActivation.intl.json';
|
||||||
import Body from './ResendActivationBody';
|
import Body from './ResendActivationBody';
|
||||||
@ -11,6 +13,6 @@ export default function ResendActivation() {
|
|||||||
Title: () => <AuthTitle title={messages.title} />,
|
Title: () => <AuthTitle title={messages.title} />,
|
||||||
Body,
|
Body,
|
||||||
Footer: () => <Button color="blue" label={messages.sendNewEmail} type="submit" />,
|
Footer: () => <Button color="blue" label={messages.sendNewEmail} type="submit" />,
|
||||||
Links: () => null
|
Links: () => <RejectionLink label={forgotPasswordMessages.alreadyHaveCode} />
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
{
|
{
|
||||||
"components.auth.activation.accountActivationTitle": "Актывацыя акаунта",
|
"components.auth.activation.accountActivationTitle": "Актывацыя акаунта",
|
||||||
"components.auth.activation.activationMailWasSent": "На {email} высланы ліст з інструкцыямі па завяршэнні рэгістрацыі",
|
"components.auth.activation.activationMailWasSent": "На {email} высланы ліст з інструкцыямі па завяршэнні рэгістрацыі",
|
||||||
|
"components.auth.activation.activationMailWasSentNoEmail": "Please check your E-mail for the message with the last registration step",
|
||||||
"components.auth.activation.confirmEmail": "Пацверджанне E‑mail",
|
"components.auth.activation.confirmEmail": "Пацверджанне E‑mail",
|
||||||
"components.auth.activation.didNotReceivedEmail": "Не атрымалі E‑mail?",
|
"components.auth.activation.didNotReceivedEmail": "Не атрымалі E‑mail?",
|
||||||
"components.auth.activation.enterTheCode": "Увядзіце код з E‑mail тут",
|
"components.auth.activation.enterTheCode": "Увядзіце код з E‑mail тут",
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
{
|
{
|
||||||
"components.auth.activation.accountActivationTitle": "Account activation",
|
"components.auth.activation.accountActivationTitle": "Account activation",
|
||||||
"components.auth.activation.activationMailWasSent": "Please check {email} for the message with the last registration step",
|
"components.auth.activation.activationMailWasSent": "Please check {email} for the message with further instructions",
|
||||||
|
"components.auth.activation.activationMailWasSentNoEmail": "Please check your E-mail for the message with further instructions",
|
||||||
"components.auth.activation.confirmEmail": "Confirm E‑mail",
|
"components.auth.activation.confirmEmail": "Confirm E‑mail",
|
||||||
"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",
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
{
|
{
|
||||||
"components.auth.activation.accountActivationTitle": "Активация аккаунта",
|
"components.auth.activation.accountActivationTitle": "Активация аккаунта",
|
||||||
"components.auth.activation.activationMailWasSent": "На {email} отправлено письмо с инструкциями по завершению регистрации",
|
"components.auth.activation.activationMailWasSent": "На {email} отправлено письмо с инструкциями по завершению регистрации",
|
||||||
|
"components.auth.activation.activationMailWasSentNoEmail": "На ваш E-mail отправлено письмо с инструкциями по завершению регистрации",
|
||||||
"components.auth.activation.confirmEmail": "Подтверждение E‑mail",
|
"components.auth.activation.confirmEmail": "Подтверждение E‑mail",
|
||||||
"components.auth.activation.didNotReceivedEmail": "Не получили E‑mail?",
|
"components.auth.activation.didNotReceivedEmail": "Не получили E‑mail?",
|
||||||
"components.auth.activation.enterTheCode": "Укажите код из E‑mail здесь",
|
"components.auth.activation.enterTheCode": "Укажите код из E‑mail здесь",
|
||||||
@ -21,7 +22,7 @@
|
|||||||
"components.auth.finish.copy": "Скопировать",
|
"components.auth.finish.copy": "Скопировать",
|
||||||
"components.auth.finish.passCodeToApp": "Чтобы завершить процесс авторизации, пожалуйста, передай {appName} этот код",
|
"components.auth.finish.passCodeToApp": "Чтобы завершить процесс авторизации, пожалуйста, передай {appName} этот код",
|
||||||
"components.auth.finish.waitAppReaction": "Пожалуйста, дождитесь реакции вашего приложения",
|
"components.auth.finish.waitAppReaction": "Пожалуйста, дождитесь реакции вашего приложения",
|
||||||
"components.auth.forgotPassword.alreadyHaveCode": "Уже получил код",
|
"components.auth.forgotPassword.alreadyHaveCode": "Уже есть код",
|
||||||
"components.auth.forgotPassword.pleasePressButton": "Нажмите на кнопку ниже, чтобы получить E‑mail с кодом для восстановления пароля.",
|
"components.auth.forgotPassword.pleasePressButton": "Нажмите на кнопку ниже, чтобы получить E‑mail с кодом для восстановления пароля.",
|
||||||
"components.auth.forgotPassword.sendMail": "Отправить письмо",
|
"components.auth.forgotPassword.sendMail": "Отправить письмо",
|
||||||
"components.auth.forgotPassword.specifyEmail": "Укажите регистрационный E‑mail адрес или последний использованный ник от вашего аккаунта, и мы отправим E‑mail с дальнейшими инструкциями по восстановлению пароля.",
|
"components.auth.forgotPassword.specifyEmail": "Укажите регистрационный E‑mail адрес или последний использованный ник от вашего аккаунта, и мы отправим E‑mail с дальнейшими инструкциями по восстановлению пароля.",
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
{
|
{
|
||||||
"components.auth.activation.accountActivationTitle": "Активація акаунту",
|
"components.auth.activation.accountActivationTitle": "Активація акаунту",
|
||||||
"components.auth.activation.activationMailWasSent": "На {email} відправлено повідомлення з інструкціями по завершенню реєстрації",
|
"components.auth.activation.activationMailWasSent": "На {email} відправлено повідомлення з інструкціями по завершенню реєстрації",
|
||||||
|
"components.auth.activation.activationMailWasSentNoEmail": "На ваш E-mail відправлено повідомлення з інструкціями по завершенню реєстрації",
|
||||||
"components.auth.activation.confirmEmail": "Підтвердження E‑mail",
|
"components.auth.activation.confirmEmail": "Підтвердження E‑mail",
|
||||||
"components.auth.activation.didNotReceivedEmail": "Не отримали E‑mail?",
|
"components.auth.activation.didNotReceivedEmail": "Не отримали E‑mail?",
|
||||||
"components.auth.activation.enterTheCode": "Вкажіть код з E‑mail",
|
"components.auth.activation.enterTheCode": "Вкажіть код з E‑mail",
|
||||||
@ -21,7 +22,7 @@
|
|||||||
"components.auth.finish.copy": "Скопіювати",
|
"components.auth.finish.copy": "Скопіювати",
|
||||||
"components.auth.finish.passCodeToApp": "Щоб завершити процес авторизації, будь ласка, передайте {appName} цей код",
|
"components.auth.finish.passCodeToApp": "Щоб завершити процес авторизації, будь ласка, передайте {appName} цей код",
|
||||||
"components.auth.finish.waitAppReaction": "Будь ласка, дочекайтеся реакції вашої програми",
|
"components.auth.finish.waitAppReaction": "Будь ласка, дочекайтеся реакції вашої програми",
|
||||||
"components.auth.forgotPassword.alreadyHaveCode": "Вже отримав код",
|
"components.auth.forgotPassword.alreadyHaveCode": "Вже є код",
|
||||||
"components.auth.forgotPassword.pleasePressButton": "Натисніть на кнопку нижче, щоб отримати E-mail з кодом для відновлення пароля.",
|
"components.auth.forgotPassword.pleasePressButton": "Натисніть на кнопку нижче, щоб отримати E-mail з кодом для відновлення пароля.",
|
||||||
"components.auth.forgotPassword.sendMail": "Відправити повідомлення",
|
"components.auth.forgotPassword.sendMail": "Відправити повідомлення",
|
||||||
"components.auth.forgotPassword.specifyEmail": "Вкажіть реєстраційну E-mail адресу або останній використаний нік від вашого облікового запису, і ми відправимо E-mail з подальшими інструкціями щодо відновлення пароля.",
|
"components.auth.forgotPassword.specifyEmail": "Вкажіть реєстраційну E-mail адресу або останній використаний нік від вашого облікового запису, і ми відправимо E-mail з подальшими інструкціями щодо відновлення пароля.",
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import AbstractState from './AbstractState';
|
import AbstractState from './AbstractState';
|
||||||
import CompleteState from './CompleteState';
|
import CompleteState from './CompleteState';
|
||||||
|
import ActivationState from './ActivationState';
|
||||||
import ResendActivationState from './ResendActivationState';
|
import ResendActivationState from './ResendActivationState';
|
||||||
|
|
||||||
export default class RegisterState extends AbstractState {
|
export default class RegisterState extends AbstractState {
|
||||||
@ -18,7 +19,11 @@ export default class RegisterState extends AbstractState {
|
|||||||
.then(() => context.setState(new CompleteState()));
|
.then(() => context.setState(new CompleteState()));
|
||||||
}
|
}
|
||||||
|
|
||||||
reject(context) {
|
reject(context, payload) {
|
||||||
|
if (payload.requestEmail) {
|
||||||
context.setState(new ResendActivationState());
|
context.setState(new ResendActivationState());
|
||||||
|
} else {
|
||||||
|
context.setState(new ActivationState());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -19,6 +19,10 @@ export default class ResendActivationState extends AbstractState {
|
|||||||
.then(() => context.setState(new ActivationState()));
|
.then(() => context.setState(new ActivationState()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
reject(context) {
|
||||||
|
context.setState(new ActivationState());
|
||||||
|
}
|
||||||
|
|
||||||
goBack(context) {
|
goBack(context) {
|
||||||
if (context.prevState instanceof RegisterState) {
|
if (context.prevState instanceof RegisterState) {
|
||||||
context.setState(new RegisterState());
|
context.setState(new RegisterState());
|
||||||
|
@ -133,7 +133,7 @@ describe('AuthFlow.functional', () => {
|
|||||||
navigate('/register');
|
navigate('/register');
|
||||||
expect(flow.state).to.be.instanceof(RegisterState);
|
expect(flow.state).to.be.instanceof(RegisterState);
|
||||||
|
|
||||||
flow.state.reject(flow);
|
flow.state.reject(flow, {requestEmail: true});
|
||||||
expect(flow.state).to.be.instanceof(ResendActivationState);
|
expect(flow.state).to.be.instanceof(ResendActivationState);
|
||||||
|
|
||||||
flow.state.goBack(flow);
|
flow.state.goBack(flow);
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import RegisterState from 'services/authFlow/RegisterState';
|
import RegisterState from 'services/authFlow/RegisterState';
|
||||||
import CompleteState from 'services/authFlow/CompleteState';
|
import CompleteState from 'services/authFlow/CompleteState';
|
||||||
|
import ActivationState from 'services/authFlow/ActivationState';
|
||||||
import ResendActivationState from 'services/authFlow/ResendActivationState';
|
import ResendActivationState from 'services/authFlow/ResendActivationState';
|
||||||
|
|
||||||
import { bootstrap, expectState, expectNavigate, expectRun } from './helpers';
|
import { bootstrap, expectState, expectNavigate, expectRun } from './helpers';
|
||||||
@ -81,10 +82,16 @@ describe('RegisterState', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe('#reject', () => {
|
describe('#reject', () => {
|
||||||
|
it('should transition to activation', () => {
|
||||||
|
expectState(mock, ActivationState);
|
||||||
|
|
||||||
|
state.reject(context, {});
|
||||||
|
});
|
||||||
|
|
||||||
it('should transition to resend-activation', () => {
|
it('should transition to resend-activation', () => {
|
||||||
expectState(mock, ResendActivationState);
|
expectState(mock, ResendActivationState);
|
||||||
|
|
||||||
state.reject(context);
|
state.reject(context, {requestEmail: true});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -97,6 +97,14 @@ describe('ResendActivationState', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('#reject', () => {
|
||||||
|
it('should transition to activate state on reject', () => {
|
||||||
|
expectState(mock, ActivationState);
|
||||||
|
|
||||||
|
state.reject(context);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
describe('#goBack', () => {
|
describe('#goBack', () => {
|
||||||
it('should transition to activation', () => {
|
it('should transition to activation', () => {
|
||||||
expectState(mock, ActivationState);
|
expectState(mock, ActivationState);
|
||||||
|
Reference in New Issue
Block a user