#14: add captcha for register page

This commit is contained in:
SleepWalker 2016-08-05 08:43:46 +03:00
parent 32c333d159
commit a8d72787b2
3 changed files with 9 additions and 4 deletions

View File

@ -71,13 +71,15 @@ export function register({
username = '',
password = '',
rePassword = '',
captcha = '',
rulesAgreement = false
}) {
return wrapInLoader((dispatch, getState) =>
signup.register({
email, username,
password, rePassword,
rulesAgreement, lang: getState().user.lang
rulesAgreement, lang: getState().user.lang,
captcha
})
.then(() => {
dispatch(updateUser({

View File

@ -3,7 +3,7 @@ import React from 'react';
import { FormattedMessage as Message } from 'react-intl';
import { Link } from 'react-router';
import { Input, Checkbox } from 'components/ui/form';
import { Input, Checkbox, Captcha } from 'components/ui/form';
import BaseAuthBody from 'components/auth/BaseAuthBody';
import passwordMessages from 'components/auth/password/Password.intl.json';
@ -54,6 +54,8 @@ export default class RegisterBody extends BaseAuthBody {
placeholder={messages.repeatPassword}
/>
<Captcha {...this.bindField('captcha')} />
<Checkbox {...this.bindField('rulesAgreement')}
color="blue"
required

View File

@ -7,11 +7,12 @@ export default {
password = '',
rePassword = '',
rulesAgreement = false,
lang = ''
lang = '',
captcha = ''
}) {
return request.post(
'/api/signup',
{email, username, password, rePassword, rulesAgreement, lang}
{email, username, password, rePassword, rulesAgreement, lang, captcha}
);
},