diff --git a/apps/web/pages/settings/my-account/profile.tsx b/apps/web/pages/settings/my-account/profile.tsx
index 294d615c46..beaf694b1c 100644
--- a/apps/web/pages/settings/my-account/profile.tsx
+++ b/apps/web/pages/settings/my-account/profile.tsx
@@ -82,21 +82,20 @@ const ProfileView = () => {
const { data: user, isLoading } = trpc.viewer.me.useQuery();
const updateProfileMutation = trpc.viewer.updateProfile.useMutation({
onSuccess: async (res) => {
+ await update(res);
showToast(t("settings_updated_successfully"), "success");
- if (res.signOutUser && tempFormValues) {
- if (res.passwordReset) {
- showToast(t("password_reset_email", { email: tempFormValues.email }), "success");
- // sign out the user to avoid unauthorized access error
- await signOut({ callbackUrl: "/auth/logout?passReset=true" });
- } else {
- // sign out the user to avoid unauthorized access error
- await signOut({ callbackUrl: "/auth/logout?emailChange=true" });
- }
+
+ // signout user only in case of password reset
+ if (res.signOutUser && tempFormValues && res.passwordReset) {
+ showToast(t("password_reset_email", { email: tempFormValues.email }), "success");
+ await signOut({ callbackUrl: "/auth/logout?passReset=true" });
+ } else {
+ utils.viewer.me.invalidate();
+ utils.viewer.avatar.invalidate();
+ utils.viewer.shouldVerifyEmail.invalidate();
}
- utils.viewer.me.invalidate();
- utils.viewer.avatar.invalidate();
+
setConfirmAuthEmailChangeWarningDialogOpen(false);
- update(res);
setTempFormValues(null);
},
onError: () => {
@@ -325,7 +324,10 @@ const ProfileView = () => {
{confirmPasswordErrorMessage && }
-