WNomunomu 2 лет назад
Родитель
Сommit
94b7f1c2bb

+ 4 - 0
apps/app/public/static/locales/en_US/commons.json

@@ -128,6 +128,10 @@
     "page_not_exist": "This page does not exist."
   },
 
+  "forbidden_page": {
+    "do_not_have_admin_permission": "Users without administrative rights cannot access the administration screen."
+  },
+
   "g2g_data_transfer": {
     "tab": "Data transfer",
     "data_transfer": "Data Transfer",

+ 4 - 0
apps/app/public/static/locales/ja_JP/commons.json

@@ -130,6 +130,10 @@
     "page_not_exist": "このページは存在しません。"
   },
 
+  "forbidden_page": {
+    "do_not_have_admin_permission": "管理者権限のないユーザーでは管理画面にはアクセスできません。"
+  },
+
   "g2g_data_transfer": {
     "tab": "データ移行",
     "data_transfer": "データ移行",

+ 4 - 0
apps/app/public/static/locales/zh_CN/commons.json

@@ -131,6 +131,10 @@
     "page_not_exist": "该页面不存在"
   },
 
+  "forbidden_page": {
+    "do_not_have_admin_permission": "没有管理权限的用户无法访问管理屏幕。"
+  },
+
   "g2g_data_transfer": {
     "tab": "数据迁移",
     "data_transfer": "数据迁移",

+ 7 - 2
apps/app/src/pages/Page403.page.tsx

@@ -1,12 +1,17 @@
 import React from 'react';
 
 import DefaultErrorPage from 'next/error';
+import { useTranslation } from 'react-i18next';
+
 
 export default function Page403() {
+  const { t } = useTranslation('commons');
+
+  const errorMessage = t('forbidden_page.do_not_have_admin_permission', { ns: 'commons' });
+
   return (
     <>
-      <DefaultErrorPage statusCode={403} />
-      {/* <h1>403 forbidden</h1> */}
+      <DefaultErrorPage statusCode={403} title={errorMessage} />
     </>
   );
 }

+ 1 - 1
apps/app/src/server/middlewares/admin-required.js

@@ -16,7 +16,7 @@ module.exports = (crowi, fallback = null) => {
       if (fallback != null) {
         return fallback(req, res, next);
       }
-      return res.redirect('/Page403');
+      return res.redirect('/');
     }
 
     logger.warn('This user has not logged in.');