mirror of
https://github.com/strapi/strapi.git
synced 2025-11-11 07:39:16 +00:00
fix(admin): fix authPage logic
This commit is contained in:
parent
5ae8b237bd
commit
b93acf8596
@ -44,10 +44,18 @@ const AuthPage = () => {
|
|||||||
const Component = forms[authType as keyof FormDictionary];
|
const Component = forms[authType as keyof FormDictionary];
|
||||||
|
|
||||||
// Redirect the user to the login page if
|
// Redirect the user to the login page if
|
||||||
// the endpoint does not exist or
|
// the endpoint does not exists
|
||||||
|
if (!Component) {
|
||||||
|
return <Navigate to="/" />;
|
||||||
|
}
|
||||||
|
|
||||||
|
// User is already logged in
|
||||||
|
if (authType !== 'register-admin' && authType !== 'register' && token) {
|
||||||
|
return <Navigate to="/" />;
|
||||||
|
}
|
||||||
|
|
||||||
// there is already an admin user oo
|
// there is already an admin user oo
|
||||||
// the user is already logged in
|
if (hasAdmin && authType === 'register-admin' && token) {
|
||||||
if (!Component || (hasAdmin && authType === 'register-admin' && token)) {
|
|
||||||
return <Navigate to="/" />;
|
return <Navigate to="/" />;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user