Use password login without OTP; keep OTP for signup and optional mobile login.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-09-05 01:37:15 +03:30
co-authored by Cursor
parent 78511a7d53
commit 55d9b494e6
7 changed files with 232 additions and 138 deletions
+16 -8
View File
@@ -45,16 +45,23 @@ export const useAuthStore = defineStore('auth', () => {
clearLegacy();
}
async function startLogin(identifier: string, password: string) {
const { data } = await api.post<LoginChallengeResponse>('/auth/login', {
async function login(identifier: string, password: string) {
const { data } = await api.post<LoginResponse>('/auth/login', {
identifier,
password,
});
persist(data);
}
async function requestLoginOtp(mobile: string) {
const { data } = await api.post<LoginChallengeResponse>('/auth/login/otp', {
mobile,
});
return data;
}
async function verifyLogin(challengeId: string, code: string) {
const { data } = await api.post<LoginResponse>('/auth/login/verify', {
async function verifyLoginOtp(challengeId: string, code: string) {
const { data } = await api.post<LoginResponse>('/auth/login/otp/verify', {
challengeId,
code,
});
@@ -71,13 +78,13 @@ export const useAuthStore = defineStore('auth', () => {
async function verifyRegister(
challengeId: string,
emailCode: string,
mobileCode: string,
emailCode?: string,
) {
const { data } = await api.post<LoginResponse>('/auth/register/verify', {
challengeId,
emailCode,
mobileCode,
...(emailCode ? { emailCode } : {}),
});
persist(data);
}
@@ -94,8 +101,9 @@ export const useAuthStore = defineStore('auth', () => {
token,
user,
isAuthenticated,
startLogin,
verifyLogin,
login,
requestLoginOtp,
verifyLoginOtp,
startRegister,
verifyRegister,
logout,