jam411 3 лет назад
Родитель
Сommit
8dc55d79d6
2 измененных файлов с 5 добавлено и 3 удалено
  1. 4 2
      packages/app/src/components/InvitedForm.tsx
  2. 1 1
      packages/app/src/server/routes/index.js

+ 4 - 2
packages/app/src/components/InvitedForm.tsx

@@ -1,6 +1,7 @@
 import React, { useCallback } from 'react';
 import React, { useCallback } from 'react';
 
 
 import { useTranslation } from 'next-i18next';
 import { useTranslation } from 'next-i18next';
+import { useRouter } from 'next/router';
 
 
 import { apiv3Post } from '~/client/util/apiv3-client';
 import { apiv3Post } from '~/client/util/apiv3-client';
 
 
@@ -15,6 +16,7 @@ export type InvitedFormProps = {
 export const InvitedForm = (props: InvitedFormProps): JSX.Element => {
 export const InvitedForm = (props: InvitedFormProps): JSX.Element => {
 
 
   const { t } = useTranslation();
   const { t } = useTranslation();
+  const router = useRouter();
   const { data: user } = useCurrentUser();
   const { data: user } = useCurrentUser();
 
 
   const { invitedFormUsername, invitedFormName } = props;
   const { invitedFormUsername, invitedFormName } = props;
@@ -38,12 +40,12 @@ export const InvitedForm = (props: InvitedFormProps): JSX.Element => {
 
 
     try {
     try {
       await apiv3Post('/invited/activateInvited', { invitedForm });
       await apiv3Post('/invited/activateInvited', { invitedForm });
-      window.location.href = '/';
+      router.push('/');
     }
     }
     catch (err) {
     catch (err) {
       // TODO: show errors
       // TODO: show errors
     }
     }
-  }, []);
+  }, [router]);
 
 
   if (user == null) {
   if (user == null) {
     return <></>;
     return <></>;

+ 1 - 1
packages/app/src/server/routes/index.js

@@ -81,7 +81,7 @@ module.exports = function(crowi, app) {
   app.get('/login/error/:reason'      , applicationInstalled, login.error);
   app.get('/login/error/:reason'      , applicationInstalled, login.error);
   app.get('/login'                    , applicationInstalled, login.preLogin, next.delegateToNext);
   app.get('/login'                    , applicationInstalled, login.preLogin, next.delegateToNext);
   app.get('/invited'                  , applicationInstalled, next.delegateToNext);
   app.get('/invited'                  , applicationInstalled, next.delegateToNext);
-  app.post('/login'                   , applicationInstalled, loginFormValidator.loginRules(), loginFormValidator.loginValidation, csrfProtection,  addActivity, loginPassport.loginWithLocal, loginPassport.loginWithLdap, loginPassport.loginFailure);
+  // app.post('/login'                   , applicationInstalled, loginFormValidator.loginRules(), loginFormValidator.loginValidation, csrfProtection,  addActivity, loginPassport.loginWithLocal, loginPassport.loginWithLdap, loginPassport.loginFailure);
 
 
   app.get('/register'                 , applicationInstalled, login.preLogin, login.register);
   app.get('/register'                 , applicationInstalled, login.preLogin, login.register);