#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 = '', username = '',
password = '', password = '',
rePassword = '', rePassword = '',
captcha = '',
rulesAgreement = false rulesAgreement = false
}) { }) {
return wrapInLoader((dispatch, getState) => return wrapInLoader((dispatch, getState) =>
signup.register({ signup.register({
email, username, email, username,
password, rePassword, password, rePassword,
rulesAgreement, lang: getState().user.lang rulesAgreement, lang: getState().user.lang,
captcha
}) })
.then(() => { .then(() => {
dispatch(updateUser({ dispatch(updateUser({

View File

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

View File

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