From 5e97b57d8baaa9dd24eb4773f54397728c193f97 Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Sat, 27 Mar 2021 15:40:05 -0500 Subject: [PATCH] Redirect after multi-auth OTP login, fixes #597 --- app/soapbox/features/auth_login/components/otp_auth_form.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/soapbox/features/auth_login/components/otp_auth_form.js b/app/soapbox/features/auth_login/components/otp_auth_form.js index 438e24bff..d6b21664a 100644 --- a/app/soapbox/features/auth_login/components/otp_auth_form.js +++ b/app/soapbox/features/auth_login/components/otp_auth_form.js @@ -2,7 +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, verifyCredentials } from 'soapbox/actions/auth'; +import { otpVerify, verifyCredentials, switchAccount } from 'soapbox/actions/auth'; import { SimpleInput } from 'soapbox/features/forms'; import PropTypes from 'prop-types'; @@ -38,6 +38,8 @@ class OtpAuthForm extends ImmutablePureComponent { dispatch(otpVerify(code, mfa_token)).then(({ access_token }) => { this.setState({ code_error: false }); return dispatch(verifyCredentials(access_token)); + }).then(account => { + return dispatch(switchAccount(account.id)); }).catch(error => { this.setState({ isLoading: false }); if (error.response.data.error === 'Invalid code') {