diff --git a/app/soapbox/actions/auth.js b/app/soapbox/actions/auth.js index 82c4e0969..5274a98cf 100644 --- a/app/soapbox/actions/auth.js +++ b/app/soapbox/actions/auth.js @@ -143,6 +143,7 @@ export function otpVerify(code, mfa_token) { code: code, challenge_type: 'totp', redirect_uri: 'urn:ietf:wg:oauth:2.0:oob', + scope: getScopes(getState()), }).then(({ data: token }) => dispatch(authLoggedIn(token))); }; } diff --git a/app/soapbox/actions/mfa.js b/app/soapbox/actions/mfa.js index 171446053..d41c60f52 100644 --- a/app/soapbox/actions/mfa.js +++ b/app/soapbox/actions/mfa.js @@ -60,10 +60,12 @@ export function confirmMfa(method, code, password) { return (dispatch, getState) => { const params = { code, password }; dispatch({ type: MFA_CONFIRM_REQUEST, method, code }); - return api(getState).post(`/api/pleroma/accounts/mfa/confirm/${method}`, params).then(() => { + return api(getState).post(`/api/pleroma/accounts/mfa/confirm/${method}`, params).then(({ data }) => { dispatch({ type: MFA_CONFIRM_SUCCESS, method, code }); + return data; }).catch(error => { - dispatch({ type: MFA_CONFIRM_FAIL, method, code, error }); + dispatch({ type: MFA_CONFIRM_FAIL, method, code, error, skipAlert: true }); + throw error; }); }; } @@ -71,10 +73,12 @@ export function confirmMfa(method, code, password) { export function disableMfa(method, password) { return (dispatch, getState) => { dispatch({ type: MFA_DISABLE_REQUEST, method }); - return api(getState).delete(`/api/pleroma/accounts/mfa/${method}`, { data: { password } }).then(response => { + return api(getState).delete(`/api/pleroma/accounts/mfa/${method}`, { data: { password } }).then(({ data }) => { dispatch({ type: MFA_DISABLE_SUCCESS, method }); + return data; }).catch(error => { - dispatch({ type: MFA_DISABLE_FAIL, method }); + dispatch({ type: MFA_DISABLE_FAIL, method, skipAlert: true }); + throw error; }); }; } diff --git a/app/soapbox/components/button.js b/app/soapbox/components/button.js index 43ca98588..25e116154 100644 --- a/app/soapbox/components/button.js +++ b/app/soapbox/components/button.js @@ -8,6 +8,7 @@ import Icon from './icon'; export default class Button extends React.PureComponent { static propTypes = { + type: PropTypes.string, text: PropTypes.node, onClick: PropTypes.func, to: PropTypes.string, @@ -54,6 +55,7 @@ export default class Button extends React.PureComponent { const btn = (