kopia lustrzana https://gitlab.com/soapbox-pub/soapbox
Fix MFA
rodzic
597546e989
commit
20ef262cfc
|
@ -127,8 +127,9 @@ export function otpVerify(code, mfa_token) {
|
||||||
code: code,
|
code: code,
|
||||||
challenge_type: 'totp',
|
challenge_type: 'totp',
|
||||||
redirect_uri: 'urn:ietf:wg:oauth:2.0:oob',
|
redirect_uri: 'urn:ietf:wg:oauth:2.0:oob',
|
||||||
}).then(response => {
|
}).then(({ data: token }) => {
|
||||||
dispatch(authLoggedIn(response.data));
|
dispatch(authLoggedIn(token));
|
||||||
|
return token;
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,8 +2,7 @@ import React from 'react';
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import { injectIntl, FormattedMessage, defineMessages } from 'react-intl';
|
import { injectIntl, FormattedMessage, defineMessages } from 'react-intl';
|
||||||
import ImmutablePureComponent from 'react-immutable-pure-component';
|
import ImmutablePureComponent from 'react-immutable-pure-component';
|
||||||
import { otpVerify } from 'soapbox/actions/auth';
|
import { otpVerify, verifyCredentials } from 'soapbox/actions/auth';
|
||||||
import { fetchMe } from 'soapbox/actions/me';
|
|
||||||
import { SimpleInput } from 'soapbox/features/forms';
|
import { SimpleInput } from 'soapbox/features/forms';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
|
|
||||||
|
@ -36,9 +35,9 @@ class OtpAuthForm extends ImmutablePureComponent {
|
||||||
handleSubmit = (event) => {
|
handleSubmit = (event) => {
|
||||||
const { dispatch, mfa_token } = this.props;
|
const { dispatch, mfa_token } = this.props;
|
||||||
const { code } = this.getFormData(event.target);
|
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 });
|
this.setState({ code_error: false });
|
||||||
return dispatch(fetchMe());
|
return dispatch(verifyCredentials(access_token));
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
this.setState({ isLoading: false });
|
this.setState({ isLoading: false });
|
||||||
if (error.response.data.error === 'Invalid code') {
|
if (error.response.data.error === 'Invalid code') {
|
||||||
|
|
Ładowanie…
Reference in New Issue