sforkowany z mirror/soapbox
Pass captcha_answer_data in registration form
rodzic
082b429fee
commit
08e6543dc3
|
@ -31,11 +31,7 @@ class RegistrationForm extends ImmutablePureComponent {
|
||||||
}
|
}
|
||||||
|
|
||||||
componentWillMount() {
|
componentWillMount() {
|
||||||
this.props.dispatch(fetchCaptcha()).then(response => {
|
this.fetchCaptcha();
|
||||||
const captcha = ImmutableMap(response.data);
|
|
||||||
this.setState({ captcha: captcha, captchaLoading: false });
|
|
||||||
this.setParams({ captcha_token: captcha.get('token') });
|
|
||||||
}).catch(error => console.error(error));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
setParams = map => {
|
setParams = map => {
|
||||||
|
@ -54,6 +50,17 @@ class RegistrationForm extends ImmutablePureComponent {
|
||||||
this.props.dispatch(register(this.state.params.toJS()));
|
this.props.dispatch(register(this.state.params.toJS()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fetchCaptcha = () => {
|
||||||
|
this.props.dispatch(fetchCaptcha()).then(response => {
|
||||||
|
const captcha = ImmutableMap(response.data);
|
||||||
|
this.setState({ captcha: captcha, captchaLoading: false });
|
||||||
|
this.setParams({
|
||||||
|
captcha_token: captcha.get('token'),
|
||||||
|
captcha_answer_data: captcha.get('answer_data'),
|
||||||
|
});
|
||||||
|
}).catch(error => console.error(error));
|
||||||
|
}
|
||||||
|
|
||||||
getCaptchaElem = () => {
|
getCaptchaElem = () => {
|
||||||
const { captcha } = this.state;
|
const { captcha } = this.state;
|
||||||
if (captcha.get('type') !== 'native') return null;
|
if (captcha.get('type') !== 'native') return null;
|
||||||
|
|
Ładowanie…
Reference in New Issue