kaori 3 lat temu
rodzic
commit
6e705d4b97

+ 3 - 2
packages/app/src/components/LoginForm.tsx

@@ -97,9 +97,10 @@ export const LoginForm = (props: LoginFormProps): JSX.Element => {
         router.push(redirectTo);
       }
 
-      if (userStatus === USER_STATUS.REGISTERED) {
-        window.location.href = 'login/error/registered';
+      if (userStatus !== USER_STATUS.ACTIVE) {
+        window.location.href = '/';
       }
+
       router.push('/');
     }
     catch (err) {

+ 19 - 1
packages/app/src/pages/login/error/[message].page.tsx

@@ -38,7 +38,7 @@ const LoginPage: NextPage<CommonProps> = (props: CommonProps) => {
   const renderResistrationSuccessFul = () => {
     return (
       <>
-        <div className="alert alert-success">
+        <div className="alert alert-warning">
           <h2>{ t('login.registration_successful') }</h2>
         </div>
         <p>Wait for approved by administrators.</p>
@@ -46,6 +46,17 @@ const LoginPage: NextPage<CommonProps> = (props: CommonProps) => {
     );
   };
 
+  const renderSuspendedUserError = () => {
+    return (
+      <>
+        <div className="alert alert-warning">
+          <h2>{ t('login.sign_in_error') }</h2>
+        </div>
+        <p>This account is suspended.</p>
+      </>
+    );
+  };
+
   const renderPasswordResetOrderError = () => {
     return (
       <>
@@ -71,6 +82,9 @@ const LoginPage: NextPage<CommonProps> = (props: CommonProps) => {
     case 'registered':
       loginErrorElm = () => renderResistrationSuccessFul();
       break;
+    case 'suspended':
+      loginErrorElm = () => renderSuspendedUserError();
+      break;
     case 'password-reset-order':
       loginErrorElm = () => renderPasswordResetOrderError();
       break;
@@ -87,6 +101,10 @@ const LoginPage: NextPage<CommonProps> = (props: CommonProps) => {
           <div className="col-12">
             {loginErrorElm()}
           </div>
+          {/* If the transition source is "/login", use <a /> tag since the transition will not occur if next/link is used. */}
+          <a href='/login'>
+            <i className="icon-login mr-1" />{t('Sign in is here')}
+          </a>
         </div>
       </div>