Fix MFA
This commit is contained in:
parent
597546e989
commit
20ef262cfc
2 changed files with 6 additions and 6 deletions
|
@ -127,8 +127,9 @@ export function otpVerify(code, mfa_token) {
|
|||
code: code,
|
||||
challenge_type: 'totp',
|
||||
redirect_uri: 'urn:ietf:wg:oauth:2.0:oob',
|
||||
}).then(response => {
|
||||
dispatch(authLoggedIn(response.data));
|
||||
}).then(({ data: token }) => {
|
||||
dispatch(authLoggedIn(token));
|
||||
return token;
|
||||
});
|
||||
};
|
||||
}
|
||||
|
|
|
@ -2,8 +2,7 @@ import React from 'react';
|
|||
import { connect } from 'react-redux';
|
||||
import { injectIntl, FormattedMessage, defineMessages } from 'react-intl';
|
||||
import ImmutablePureComponent from 'react-immutable-pure-component';
|
||||
import { otpVerify } from 'soapbox/actions/auth';
|
||||
import { fetchMe } from 'soapbox/actions/me';
|
||||
import { otpVerify, verifyCredentials } from 'soapbox/actions/auth';
|
||||
import { SimpleInput } from 'soapbox/features/forms';
|
||||
import PropTypes from 'prop-types';
|
||||
|
||||
|
@ -36,9 +35,9 @@ class OtpAuthForm extends ImmutablePureComponent {
|
|||
handleSubmit = (event) => {
|
||||
const { dispatch, mfa_token } = this.props;
|
||||
const { code } = this.getFormData(event.target);
|
||||
dispatch(otpVerify(code, mfa_token)).then(() => {
|
||||
dispatch(otpVerify(code, mfa_token)).then(({ access_token }) => {
|
||||
this.setState({ code_error: false });
|
||||
return dispatch(fetchMe());
|
||||
return dispatch(verifyCredentials(access_token));
|
||||
}).catch(error => {
|
||||
this.setState({ isLoading: false });
|
||||
if (error.response.data.error === 'Invalid code') {
|
||||
|
|
Loading…
Reference in a new issue