fix signin
Build & Deploy / Build & Push Docker Image (push) Successful in 48s
Test / API Unit Tests (push) Successful in 9m50s
Test / Marketplace Unit Tests (push) Successful in 9m37s
Test / Admin Unit Tests (push) Successful in 9m33s
Test / Dashboard Unit Tests (push) Successful in 9m37s
Test / API Integration Tests (push) Successful in 9m49s
Build & Deploy / Deploy to VPS (push) Successful in 2s
Build & Deploy / Build & Push Docker Image (push) Successful in 48s
Test / API Unit Tests (push) Successful in 9m50s
Test / Marketplace Unit Tests (push) Successful in 9m37s
Test / Admin Unit Tests (push) Successful in 9m33s
Test / Dashboard Unit Tests (push) Successful in 9m37s
Test / API Integration Tests (push) Successful in 9m49s
Build & Deploy / Deploy to VPS (push) Successful in 2s
This commit is contained in:
@@ -42,6 +42,7 @@ export default function SignInPageClient({ embedded = false }: { embedded?: bool
|
|||||||
forgotPassword: 'Forgot your password?',
|
forgotPassword: 'Forgot your password?',
|
||||||
invalidCredentials: 'Invalid email or password.',
|
invalidCredentials: 'Invalid email or password.',
|
||||||
passwordNotSet: 'No password set yet. Check your invitation email or use "Forgot your password?"',
|
passwordNotSet: 'No password set yet. Check your invitation email or use "Forgot your password?"',
|
||||||
|
tooManyRequests: 'Too many attempts. Please try again later.',
|
||||||
unexpectedError: 'Something went wrong. Please try again.',
|
unexpectedError: 'Something went wrong. Please try again.',
|
||||||
},
|
},
|
||||||
fr: {
|
fr: {
|
||||||
@@ -60,6 +61,7 @@ export default function SignInPageClient({ embedded = false }: { embedded?: bool
|
|||||||
forgotPassword: 'Mot de passe oublié ?',
|
forgotPassword: 'Mot de passe oublié ?',
|
||||||
invalidCredentials: 'Adresse e-mail ou mot de passe invalide.',
|
invalidCredentials: 'Adresse e-mail ou mot de passe invalide.',
|
||||||
passwordNotSet: `Aucun mot de passe défini. Vérifiez votre e-mail d'invitation ou utilisez « Mot de passe oublié ? »`,
|
passwordNotSet: `Aucun mot de passe défini. Vérifiez votre e-mail d'invitation ou utilisez « Mot de passe oublié ? »`,
|
||||||
|
tooManyRequests: 'Trop de tentatives. Veuillez réessayer plus tard.',
|
||||||
unexpectedError: 'Une erreur est survenue. Veuillez réessayer.',
|
unexpectedError: 'Une erreur est survenue. Veuillez réessayer.',
|
||||||
},
|
},
|
||||||
ar: {
|
ar: {
|
||||||
@@ -78,6 +80,7 @@ export default function SignInPageClient({ embedded = false }: { embedded?: bool
|
|||||||
forgotPassword: 'نسيت كلمة المرور؟',
|
forgotPassword: 'نسيت كلمة المرور؟',
|
||||||
invalidCredentials: 'البريد الإلكتروني أو كلمة المرور غير صحيحة.',
|
invalidCredentials: 'البريد الإلكتروني أو كلمة المرور غير صحيحة.',
|
||||||
passwordNotSet: 'لم يتم تعيين كلمة مرور بعد. تحقق من بريد الدعوة أو استخدم "نسيت كلمة المرور؟"',
|
passwordNotSet: 'لم يتم تعيين كلمة مرور بعد. تحقق من بريد الدعوة أو استخدم "نسيت كلمة المرور؟"',
|
||||||
|
tooManyRequests: 'محاولات كثيرة جدًا. يرجى المحاولة لاحقًا.',
|
||||||
unexpectedError: 'حدث خطأ ما. يرجى المحاولة مرة أخرى.',
|
unexpectedError: 'حدث خطأ ما. يرجى المحاولة مرة أخرى.',
|
||||||
},
|
},
|
||||||
}[language]
|
}[language]
|
||||||
@@ -206,6 +209,7 @@ function LocalSignInForm({
|
|||||||
forgotPassword: string
|
forgotPassword: string
|
||||||
invalidCredentials: string
|
invalidCredentials: string
|
||||||
passwordNotSet: string
|
passwordNotSet: string
|
||||||
|
tooManyRequests: string
|
||||||
unexpectedError: string
|
unexpectedError: string
|
||||||
}
|
}
|
||||||
}) {
|
}) {
|
||||||
@@ -219,15 +223,9 @@ function LocalSignInForm({
|
|||||||
const [loading, setLoading] = useState(false)
|
const [loading, setLoading] = useState(false)
|
||||||
const [error, setError] = useState<string | null>(null)
|
const [error, setError] = useState<string | null>(null)
|
||||||
const requestedPortal = searchParams.get('portal')
|
const requestedPortal = searchParams.get('portal')
|
||||||
const adminNext = searchParams.get('next') || '/dashboard'
|
|
||||||
const employeeRedirect = searchParams.get('redirect') || '/dashboard'
|
const employeeRedirect = searchParams.get('redirect') || '/dashboard'
|
||||||
const preferAdminAuth = requestedPortal === 'admin'
|
const preferAdminAuth = requestedPortal === 'admin'
|
||||||
|
|
||||||
function redirectAdmin(token: string) {
|
|
||||||
const hash = new URLSearchParams({ token, next: adminNext }).toString()
|
|
||||||
window.location.href = `${adminUrl}/auth-redirect#${hash}`
|
|
||||||
}
|
|
||||||
|
|
||||||
async function handleCredentials(e: React.FormEvent) {
|
async function handleCredentials(e: React.FormEvent) {
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
setLoading(true)
|
setLoading(true)
|
||||||
@@ -253,6 +251,11 @@ function LocalSignInForm({
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (adminRes.status === 429) {
|
||||||
|
setError(dict.tooManyRequests)
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -288,6 +291,11 @@ function LocalSignInForm({
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (empRes.status === 429) {
|
||||||
|
setError(dict.tooManyRequests)
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -298,7 +306,6 @@ function LocalSignInForm({
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (await tryEmployeeLogin()) return
|
if (await tryEmployeeLogin()) return
|
||||||
if (await tryAdminLogin()) return
|
|
||||||
|
|
||||||
setError(dict.invalidCredentials)
|
setError(dict.invalidCredentials)
|
||||||
} catch {
|
} catch {
|
||||||
|
|||||||
Reference in New Issue
Block a user