diff --git a/src/components/auth/RejectionLink.jsx b/src/components/auth/RejectionLink.jsx
index 6af51f8..d0630a7 100644
--- a/src/components/auth/RejectionLink.jsx
+++ b/src/components/auth/RejectionLink.jsx
@@ -7,7 +7,7 @@ export default function RejectionLink(props, context) {
{
event.preventDefault();
- context.reject();
+ context.reject(props.payload);
}}>
@@ -16,6 +16,8 @@ export default function RejectionLink(props, context) {
RejectionLink.displayName = 'RejectionLink';
RejectionLink.propTypes = {
+ // eslint-disable-next-line react/forbid-prop-types
+ payload: PropTypes.object, // Custom payload for active state
label: PropTypes.shape({
id: PropTypes.string
}).isRequired
diff --git a/src/components/auth/activation/Activation.intl.json b/src/components/auth/activation/Activation.intl.json
index 9d409a8..67ee899 100644
--- a/src/components/auth/activation/Activation.intl.json
+++ b/src/components/auth/activation/Activation.intl.json
@@ -1,6 +1,7 @@
{
"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",
"didNotReceivedEmail": "Did not received E‑mail?",
"enterTheCode": "Enter the code from E‑mail here"
diff --git a/src/components/auth/activation/ActivationBody.jsx b/src/components/auth/activation/ActivationBody.jsx
index 846e13d..2b257b7 100644
--- a/src/components/auth/activation/ActivationBody.jsx
+++ b/src/components/auth/activation/ActivationBody.jsx
@@ -22,6 +22,7 @@ export default class ActivationBody extends BaseAuthBody {
render() {
const {key} = this.props.params;
+ const email = this.context.user.email;
return (
diff --git a/src/components/auth/register/Register.jsx b/src/components/auth/register/Register.jsx
index ceb2f4e..3b60352 100644
--- a/src/components/auth/register/Register.jsx
+++ b/src/components/auth/register/Register.jsx
@@ -4,6 +4,7 @@ import { Button } from 'components/ui/form';
import RejectionLink from 'components/auth/RejectionLink';
import AuthTitle from 'components/auth/AuthTitle';
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 Body from './RegisterBody';
@@ -13,6 +14,12 @@ export default function Register() {
Title: () =>
,
Body,
Footer: () =>
,
- Links: () =>
+ Links: () => (
+
+
+ {' | '}
+
+
+ )
};
}
diff --git a/src/components/auth/resendActivation/ResendActivation.jsx b/src/components/auth/resendActivation/ResendActivation.jsx
index b14a1dc..28b177a 100644
--- a/src/components/auth/resendActivation/ResendActivation.jsx
+++ b/src/components/auth/resendActivation/ResendActivation.jsx
@@ -2,6 +2,8 @@ import React from 'react';
import { Button } from 'components/ui/form';
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 Body from './ResendActivationBody';
@@ -11,6 +13,6 @@ export default function ResendActivation() {
Title: () =>
,
Body,
Footer: () =>
,
- Links: () => null
+ Links: () =>
};
}
diff --git a/src/i18n/be.json b/src/i18n/be.json
index f755e76..32ca99c 100644
--- a/src/i18n/be.json
+++ b/src/i18n/be.json
@@ -1,6 +1,7 @@
{
"components.auth.activation.accountActivationTitle": "Актывацыя акаунта",
"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.didNotReceivedEmail": "Не атрымалі E‑mail?",
"components.auth.activation.enterTheCode": "Увядзіце код з E‑mail тут",
diff --git a/src/i18n/en.json b/src/i18n/en.json
index 12b9756..b5c2466 100644
--- a/src/i18n/en.json
+++ b/src/i18n/en.json
@@ -1,6 +1,7 @@
{
"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.didNotReceivedEmail": "Did not received E‑mail?",
"components.auth.activation.enterTheCode": "Enter the code from E‑mail here",
diff --git a/src/i18n/ru.json b/src/i18n/ru.json
index e9c5a4e..b642d93 100644
--- a/src/i18n/ru.json
+++ b/src/i18n/ru.json
@@ -1,6 +1,7 @@
{
"components.auth.activation.accountActivationTitle": "Активация аккаунта",
"components.auth.activation.activationMailWasSent": "На {email} отправлено письмо с инструкциями по завершению регистрации",
+ "components.auth.activation.activationMailWasSentNoEmail": "На ваш E-mail отправлено письмо с инструкциями по завершению регистрации",
"components.auth.activation.confirmEmail": "Подтверждение E‑mail",
"components.auth.activation.didNotReceivedEmail": "Не получили E‑mail?",
"components.auth.activation.enterTheCode": "Укажите код из E‑mail здесь",
@@ -21,7 +22,7 @@
"components.auth.finish.copy": "Скопировать",
"components.auth.finish.passCodeToApp": "Чтобы завершить процесс авторизации, пожалуйста, передай {appName} этот код",
"components.auth.finish.waitAppReaction": "Пожалуйста, дождитесь реакции вашего приложения",
- "components.auth.forgotPassword.alreadyHaveCode": "Уже получил код",
+ "components.auth.forgotPassword.alreadyHaveCode": "Уже есть код",
"components.auth.forgotPassword.pleasePressButton": "Нажмите на кнопку ниже, чтобы получить E‑mail с кодом для восстановления пароля.",
"components.auth.forgotPassword.sendMail": "Отправить письмо",
"components.auth.forgotPassword.specifyEmail": "Укажите регистрационный E‑mail адрес или последний использованный ник от вашего аккаунта, и мы отправим E‑mail с дальнейшими инструкциями по восстановлению пароля.",
diff --git a/src/i18n/uk.json b/src/i18n/uk.json
index f476650..9a50243 100644
--- a/src/i18n/uk.json
+++ b/src/i18n/uk.json
@@ -1,6 +1,7 @@
{
"components.auth.activation.accountActivationTitle": "Активація акаунту",
"components.auth.activation.activationMailWasSent": "На {email} відправлено повідомлення з інструкціями по завершенню реєстрації",
+ "components.auth.activation.activationMailWasSentNoEmail": "На ваш E-mail відправлено повідомлення з інструкціями по завершенню реєстрації",
"components.auth.activation.confirmEmail": "Підтвердження E‑mail",
"components.auth.activation.didNotReceivedEmail": "Не отримали E‑mail?",
"components.auth.activation.enterTheCode": "Вкажіть код з E‑mail",
@@ -21,7 +22,7 @@
"components.auth.finish.copy": "Скопіювати",
"components.auth.finish.passCodeToApp": "Щоб завершити процес авторизації, будь ласка, передайте {appName} цей код",
"components.auth.finish.waitAppReaction": "Будь ласка, дочекайтеся реакції вашої програми",
- "components.auth.forgotPassword.alreadyHaveCode": "Вже отримав код",
+ "components.auth.forgotPassword.alreadyHaveCode": "Вже є код",
"components.auth.forgotPassword.pleasePressButton": "Натисніть на кнопку нижче, щоб отримати E-mail з кодом для відновлення пароля.",
"components.auth.forgotPassword.sendMail": "Відправити повідомлення",
"components.auth.forgotPassword.specifyEmail": "Вкажіть реєстраційну E-mail адресу або останній використаний нік від вашого облікового запису, і ми відправимо E-mail з подальшими інструкціями щодо відновлення пароля.",
diff --git a/src/services/authFlow/RegisterState.js b/src/services/authFlow/RegisterState.js
index 91025d8..728752d 100644
--- a/src/services/authFlow/RegisterState.js
+++ b/src/services/authFlow/RegisterState.js
@@ -1,5 +1,6 @@
import AbstractState from './AbstractState';
import CompleteState from './CompleteState';
+import ActivationState from './ActivationState';
import ResendActivationState from './ResendActivationState';
export default class RegisterState extends AbstractState {
@@ -18,7 +19,11 @@ export default class RegisterState extends AbstractState {
.then(() => context.setState(new CompleteState()));
}
- reject(context) {
- context.setState(new ResendActivationState());
+ reject(context, payload) {
+ if (payload.requestEmail) {
+ context.setState(new ResendActivationState());
+ } else {
+ context.setState(new ActivationState());
+ }
}
}
diff --git a/src/services/authFlow/ResendActivationState.js b/src/services/authFlow/ResendActivationState.js
index 7eb01ff..db157fc 100644
--- a/src/services/authFlow/ResendActivationState.js
+++ b/src/services/authFlow/ResendActivationState.js
@@ -19,6 +19,10 @@ export default class ResendActivationState extends AbstractState {
.then(() => context.setState(new ActivationState()));
}
+ reject(context) {
+ context.setState(new ActivationState());
+ }
+
goBack(context) {
if (context.prevState instanceof RegisterState) {
context.setState(new RegisterState());
diff --git a/tests/services/authFlow/AuthFlow.functional.test.js b/tests/services/authFlow/AuthFlow.functional.test.js
index 4f38f17..5e251a3 100644
--- a/tests/services/authFlow/AuthFlow.functional.test.js
+++ b/tests/services/authFlow/AuthFlow.functional.test.js
@@ -133,7 +133,7 @@ describe('AuthFlow.functional', () => {
navigate('/register');
expect(flow.state).to.be.instanceof(RegisterState);
- flow.state.reject(flow);
+ flow.state.reject(flow, {requestEmail: true});
expect(flow.state).to.be.instanceof(ResendActivationState);
flow.state.goBack(flow);
diff --git a/tests/services/authFlow/RegisterState.test.js b/tests/services/authFlow/RegisterState.test.js
index e6fd1fc..3f1ff25 100644
--- a/tests/services/authFlow/RegisterState.test.js
+++ b/tests/services/authFlow/RegisterState.test.js
@@ -1,5 +1,6 @@
import RegisterState from 'services/authFlow/RegisterState';
import CompleteState from 'services/authFlow/CompleteState';
+import ActivationState from 'services/authFlow/ActivationState';
import ResendActivationState from 'services/authFlow/ResendActivationState';
import { bootstrap, expectState, expectNavigate, expectRun } from './helpers';
@@ -81,10 +82,16 @@ describe('RegisterState', () => {
});
describe('#reject', () => {
+ it('should transition to activation', () => {
+ expectState(mock, ActivationState);
+
+ state.reject(context, {});
+ });
+
it('should transition to resend-activation', () => {
expectState(mock, ResendActivationState);
- state.reject(context);
+ state.reject(context, {requestEmail: true});
});
});
});
diff --git a/tests/services/authFlow/ResendActivationState.test.js b/tests/services/authFlow/ResendActivationState.test.js
index bae5c14..53e1430 100644
--- a/tests/services/authFlow/ResendActivationState.test.js
+++ b/tests/services/authFlow/ResendActivationState.test.js
@@ -97,6 +97,14 @@ describe('ResendActivationState', () => {
});
});
+ describe('#reject', () => {
+ it('should transition to activate state on reject', () => {
+ expectState(mock, ActivationState);
+
+ state.reject(context);
+ });
+ });
+
describe('#goBack', () => {
it('should transition to activation', () => {
expectState(mock, ActivationState);