From 08e6543dc3d21814bab6d34a312b40019e9bf785 Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Tue, 28 Apr 2020 10:17:02 -0500 Subject: [PATCH] Pass captcha_answer_data in registration form --- .../components/registration_form.js | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/app/gabsocial/features/landing_page/components/registration_form.js b/app/gabsocial/features/landing_page/components/registration_form.js index 2eb9b2044..6080b06d2 100644 --- a/app/gabsocial/features/landing_page/components/registration_form.js +++ b/app/gabsocial/features/landing_page/components/registration_form.js @@ -31,11 +31,7 @@ class RegistrationForm extends ImmutablePureComponent { } componentWillMount() { - this.props.dispatch(fetchCaptcha()).then(response => { - const captcha = ImmutableMap(response.data); - this.setState({ captcha: captcha, captchaLoading: false }); - this.setParams({ captcha_token: captcha.get('token') }); - }).catch(error => console.error(error)); + this.fetchCaptcha(); } setParams = map => { @@ -54,6 +50,17 @@ class RegistrationForm extends ImmutablePureComponent { 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 = () => { const { captcha } = this.state; if (captcha.get('type') !== 'native') return null;