Merge branch 'feat/auth-methods' into deploy/dev

This commit is contained in:
NFish 2024-10-18 17:57:46 +08:00
commit 2a99fae934
3 changed files with 4 additions and 3 deletions

View File

@ -44,7 +44,7 @@ export default function CheckCode() {
params.set('email', encodeURIComponent(email))
router.push(`/reset-password/check-code?${params.toString()}`)
}
else if (res.message === 'account_not_found') {
else if (res.code === 'account_not_found') {
Toast.notify({
type: 'error',
message: t('login.error.registrationNotAllowed'),

View File

@ -75,7 +75,7 @@ export default function MailAndPasswordAuth({ isInvite, allowRegistration }: Mai
router.replace('/apps')
}
}
else if (res.message === 'account_not_found') {
else if (res.code === 'account_not_found') {
if (allowRegistration) {
const params = new URLSearchParams()
params.append('email', encodeURIComponent(email))

View File

@ -45,6 +45,7 @@ type LoginSuccess = {
type LoginFail = {
result: 'fail'
data: string
code: string
message: string
}
type LoginResponse = LoginSuccess | LoginFail
@ -333,7 +334,7 @@ export const emailLoginWithCode = (data: { email: string;code: string;token: str
post<LoginResponse>('/email-code-login/validity', { body: data })
export const sendResetPasswordCode = (email: string, language = 'en-US') =>
post<CommonResponse & { data: string;message?: string }>('/forgot-password', { body: { email, language } })
post<CommonResponse & { data: string;message?: string ;code?: string }>('/forgot-password', { body: { email, language } })
export const verifyResetPasswordCode = (body: { email: string;code: string;token: string }) =>
post<CommonResponse & { is_valid: boolean }>('/forgot-password/validity', { body })