Попытка сделать frontend для отображения капчи на странице запроса восстановления пароля

This commit is contained in:
ErickSkrauch 2017-04-18 19:47:46 +03:00
parent 258c0a7a5f
commit c1e9cdc6b9
3 changed files with 9 additions and 5 deletions

View File

@ -81,10 +81,11 @@ export function acceptRules() {
} }
export function forgotPassword({ export function forgotPassword({
login = '' login = '',
captcha = ''
}) { }) {
return wrapInLoader((dispatch, getState) => return wrapInLoader((dispatch, getState) =>
authentication.forgotPassword({login}) authentication.forgotPassword({login, captcha})
.then(({data = {}}) => dispatch(updateUser({ .then(({data = {}}) => dispatch(updateUser({
maskedEmail: data.emailMask || getState().user.email maskedEmail: data.emailMask || getState().user.email
}))) })))

View File

@ -2,7 +2,7 @@ import React from 'react';
import { FormattedMessage as Message } from 'react-intl'; import { FormattedMessage as Message } from 'react-intl';
import { Input } from 'components/ui/form'; import { Input, Captcha } from 'components/ui/form';
import icons from 'components/ui/icons.scss'; import icons from 'components/ui/icons.scss';
import BaseAuthBody from 'components/auth/BaseAuthBody'; import BaseAuthBody from 'components/auth/BaseAuthBody';
@ -57,6 +57,8 @@ export default class ForgotPasswordBody extends BaseAuthBody {
</p> </p>
</div> </div>
)} )}
<Captcha {...this.bindField('captcha')} delay={600} />
</div> </div>
); );
} }

View File

@ -28,11 +28,12 @@ const authentication = {
}, },
forgotPassword({ forgotPassword({
login = '' login = '',
captcha = ''
}) { }) {
return request.post( return request.post(
'/api/authentication/forgot-password', '/api/authentication/forgot-password',
{login}, {login, captcha},
{token: null} {token: null}
); );
}, },