diff --git a/packages/core/admin/admin/src/pages/Auth/AuthPage.tsx b/packages/core/admin/admin/src/pages/Auth/AuthPage.tsx index 0079c53575..69d3630d2d 100644 --- a/packages/core/admin/admin/src/pages/Auth/AuthPage.tsx +++ b/packages/core/admin/admin/src/pages/Auth/AuthPage.tsx @@ -44,10 +44,18 @@ const AuthPage = () => { const Component = forms[authType as keyof FormDictionary]; // Redirect the user to the login page if - // the endpoint does not exist or + // the endpoint does not exists + if (!Component) { + return ; + } + + // User is already logged in + if (authType !== 'register-admin' && authType !== 'register' && token) { + return ; + } + // there is already an admin user oo - // the user is already logged in - if (!Component || (hasAdmin && authType === 'register-admin' && token)) { + if (hasAdmin && authType === 'register-admin' && token) { return ; }