[FIX] Change avatar not being affected by 2fa (#19475)

pull/16884/head
Martin Schoeler 5 years ago committed by GitHub
parent 51466a9b14
commit 7e4b428ff8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 18
      client/account/AccountProfilePage.js

@ -49,7 +49,6 @@ const AccountProfilePage = () => {
const closeModal = useCallback(() => setModal(null), [setModal]);
const localPassword = Boolean(user?.services?.password?.bcrypt?.trim());
const requirePasswordConfirmation = (values.email !== getUserEmailAddress(user) || !!values.password) && localPassword;
const erasureType = useSetting('Message_ErasureType');
const allowRealNameChange = useSetting('Accounts_AllowRealNameChange');
@ -109,8 +108,6 @@ const AccountProfilePage = () => {
const onSave = useCallback(async () => {
const save = async (typedPassword) => {
try {
const avatarResult = await updateAvatar();
if (avatarResult) { handleAvatar(''); }
await saveFn({
...allowRealNameChange && { realname },
...allowEmailChange && getUserEmailAddress(user) !== email && { email },
@ -124,6 +121,8 @@ const AccountProfilePage = () => {
}, customFields);
handlePassword('');
handleConfirmationPassword('');
const avatarResult = await updateAvatar();
if (avatarResult) { handleAvatar(''); }
commit();
dispatchToastMessage({ type: 'success', message: t('Profile_saved_successfully') });
} catch (error) {
@ -131,16 +130,6 @@ const AccountProfilePage = () => {
}
};
if (requirePasswordConfirmation) {
return setModal(() => <ActionConfirmModal
onSave={save}
onCancel={closeModal}
title={t('Please_enter_your_password')}
text={t('For_your_security_you_must_enter_your_current_password_to_continue')}
isPassword
/>);
}
save();
}, [
saveFn,
@ -158,13 +147,10 @@ const AccountProfilePage = () => {
user,
updateAvatar,
handleAvatar,
closeModal,
requirePasswordConfirmation,
dispatchToastMessage,
t,
customFields,
statusType,
setModal,
commit,
nickname,
handlePassword,

Loading…
Cancel
Save