Pass captcha_answer_data in registration form

merge-requests/1/head
Alex Gleason 2020-04-28 10:17:02 -05:00
rodzic 082b429fee
commit 08e6543dc3
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 7211D1F99744FBB7
1 zmienionych plików z 12 dodań i 5 usunięć

Wyświetl plik

@ -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;