feat(auth): support 2fa recovery code login in web auth panel
Some checks are pending
CI / test (push) Has started running

This commit is contained in:
2026-03-08 21:00:10 +03:00
parent fb0e4dabba
commit 84613228aa
2 changed files with 38 additions and 11 deletions

View File

@@ -8,7 +8,7 @@ interface AuthState {
me: AuthUser | null;
loading: boolean;
setTokens: (accessToken: string, refreshToken: string) => void;
login: (email: string, password: string, otpCode?: string) => Promise<void>;
login: (email: string, password: string, otpCode?: string, recoveryCode?: string) => Promise<void>;
loadMe: () => Promise<void>;
refresh: () => Promise<void>;
logout: () => void;
@@ -27,10 +27,10 @@ export const useAuthStore = create<AuthState>((set, get) => ({
localStorage.setItem(REFRESH_KEY, refreshToken);
set({ accessToken, refreshToken });
},
login: async (email, password, otpCode) => {
login: async (email, password, otpCode, recoveryCode) => {
set({ loading: true });
try {
const data = await loginRequest(email, password, otpCode);
const data = await loginRequest(email, password, otpCode, recoveryCode);
get().setTokens(data.access_token, data.refresh_token);
await get().loadMe();
} finally {