diff --git a/src/api/auth.ts b/src/api/auth.ts index 1483ef6..3bbf276 100644 --- a/src/api/auth.ts +++ b/src/api/auth.ts @@ -31,3 +31,24 @@ export function verifyOtp(mobile: string, code: string) { export function fetchMe(token: string) { return api('/auth/me', { token }); } + +export function loginWithPassword(mobile: string, password: string) { + return api('/auth/login-password', { + method: 'POST', + body: JSON.stringify({ + mobile: normalizeIranMobile(mobile), + password, + }), + }); +} + +export function setPassword(payload: { + password: string; + confirmPassword: string; + currentPassword?: string; +}) { + return api('/auth/set-password', { + method: 'POST', + body: JSON.stringify(payload), + }); +} diff --git a/src/api/types.ts b/src/api/types.ts index a8a8023..039b66a 100644 --- a/src/api/types.ts +++ b/src/api/types.ts @@ -6,6 +6,7 @@ export type User = { fullName: string | null; role: UserRole; isActive: boolean; + hasPassword?: boolean; createdAt?: string; updatedAt?: string; }; diff --git a/src/components/auth/AuthModeSwitch.vue b/src/components/auth/AuthModeSwitch.vue new file mode 100644 index 0000000..714f8aa --- /dev/null +++ b/src/components/auth/AuthModeSwitch.vue @@ -0,0 +1,27 @@ + + + diff --git a/src/views/LoginView.vue b/src/views/LoginView.vue index 1cb8a17..17c9701 100644 --- a/src/views/LoginView.vue +++ b/src/views/LoginView.vue @@ -7,6 +7,8 @@ {{ error }}

+ +
- دریافت کد تأیید + + + + + {{ mode === 'otp' ? 'دریافت کد تأیید' : 'ورود' }} + + +

+ اولین بار؟ با کد یکبارمصرف وارد شوید و در پروفایل رمز بسازید. +