Skip to content

Commit b4c91e3

Browse files
luannmoreiragustavosbarreto
authored andcommitted
fix(ui): ensure name is loaded before MFA recovery and reset
Set name from localStorage before calling recoverMfa and requestResetMfa to avoid issues where name was not initialized, causing failures.
1 parent cd6a193 commit b4c91e3

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

ui/src/store/modules/auth.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ const useAuthStore = defineStore("auth", () => {
9494
};
9595

9696
const recoverMfa = async (code: string) => {
97+
name.value = localStorage.getItem("name") || "";
9798
const resp = await authApi.recoverMfa({ identifier: name.value, recovery_code: code });
9899
if (resp.status === 200) {
99100
persistAuth(resp.data);
@@ -129,7 +130,8 @@ const useAuthStore = defineStore("auth", () => {
129130
};
130131

131132
const requestMfaReset = async () => {
132-
await authApi.requestResetMfa(email.value);
133+
name.value = localStorage.getItem("name") || "";
134+
await authApi.requestResetMfa(name.value);
133135
};
134136

135137
const resetMfa = async (data: IMfaReset) => {

0 commit comments

Comments
 (0)