From 57f3134cd88c20057d3c8e547d8744d05435239f Mon Sep 17 00:00:00 2001 From: SleepWalker Date: Sun, 22 May 2016 21:58:43 +0300 Subject: [PATCH] #97: frontend for repeat activation functionality --- src/components/auth/PanelTransition.jsx | 2 +- src/components/auth/actions.js | 12 ++- .../ResendActivation.intl.json | 5 + .../resendActivation/ResendActivation.jsx | 16 ++++ .../resendActivation/ResendActivationBody.jsx | 40 ++++++++ .../resendActivation/resendActivation.scss | 8 ++ src/i18n/en.json | 3 + src/i18n/ru.json | 3 + src/routes.js | 2 + src/services/authFlow/ActivationState.js | 5 + src/services/authFlow/AuthFlow.js | 5 + .../authFlow/ResendActivationState.js | 24 +++++ .../services/authFlow/ActivationState.test.js | 9 ++ .../authFlow/RecoverPasswordState.test.js | 11 +++ .../authFlow/ResendActivationState.test.js | 95 +++++++++++++++++++ 15 files changed, 238 insertions(+), 2 deletions(-) create mode 100644 src/components/auth/resendActivation/ResendActivation.intl.json create mode 100644 src/components/auth/resendActivation/ResendActivation.jsx create mode 100644 src/components/auth/resendActivation/ResendActivationBody.jsx create mode 100644 src/components/auth/resendActivation/resendActivation.scss create mode 100644 src/services/authFlow/ResendActivationState.js create mode 100644 tests/services/authFlow/ResendActivationState.test.js diff --git a/src/components/auth/PanelTransition.jsx b/src/components/auth/PanelTransition.jsx index 661fbba..190595c 100644 --- a/src/components/auth/PanelTransition.jsx +++ b/src/components/auth/PanelTransition.jsx @@ -31,7 +31,7 @@ const changeContextSpringConfig = {stiffness: 500, damping: 20, precision: 0.5}; */ const contexts = [ ['login', 'password', 'forgotPassword', 'recoverPassword'], - ['register', 'activation'], + ['register', 'activation', 'resendActivation'], ['changePassword'], ['permissions'] ]; diff --git a/src/components/auth/actions.js b/src/components/auth/actions.js index 4e59a52..39c758b 100644 --- a/src/components/auth/actions.js +++ b/src/components/auth/actions.js @@ -126,7 +126,17 @@ export function activate({key = ''}) { return dispatch(authenticate(resp.jwt)); }) - .catch(validationErrorsHandler(dispatch, '/reactivate')) + .catch(validationErrorsHandler(dispatch, '/resend-activation')) + ); +} + +export function resendActivation({email = ''}) { + return wrapInLoader((dispatch) => + request.post( + '/api/signup/repeat-message', + {email} + ) + .catch(validationErrorsHandler(dispatch)) ); } diff --git a/src/components/auth/resendActivation/ResendActivation.intl.json b/src/components/auth/resendActivation/ResendActivation.intl.json new file mode 100644 index 0000000..140dce7 --- /dev/null +++ b/src/components/auth/resendActivation/ResendActivation.intl.json @@ -0,0 +1,5 @@ +{ + "title": "Did not received an E-mail", + "specifyYourEmail": "Please, enter an E-mail you've registered with and we will send you new activation code.", + "sendNewEmail": "Send new E-mail" +} diff --git a/src/components/auth/resendActivation/ResendActivation.jsx b/src/components/auth/resendActivation/ResendActivation.jsx new file mode 100644 index 0000000..b14a1dc --- /dev/null +++ b/src/components/auth/resendActivation/ResendActivation.jsx @@ -0,0 +1,16 @@ +import React from 'react'; + +import { Button } from 'components/ui/form'; +import AuthTitle from 'components/auth/AuthTitle'; + +import messages from './ResendActivation.intl.json'; +import Body from './ResendActivationBody'; + +export default function ResendActivation() { + return { + Title: () => , + Body, + Footer: () =>