Skip to content

Commit a4028c5

Browse files
YidadaaPeterZhang-2023
authored andcommitted
feat: close ChatGPTNextWeb#2638 hide auth page and use better unauth tips
1 parent 11a46b6 commit a4028c5

File tree

3 files changed

+21
-4
lines changed

3 files changed

+21
-4
lines changed

app/components/auth.tsx

+9
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,22 @@ import { useAccessStore } from "../store";
77
import Locale from "../locales";
88

99
import BotIcon from "../icons/bot.svg";
10+
import { useEffect } from "react";
11+
import { getClientConfig } from "../config/client";
1012

1113
export function AuthPage() {
1214
const navigate = useNavigate();
1315
const access = useAccessStore();
1416

1517
const goHome = () => navigate(Path.Home);
1618

19+
useEffect(() => {
20+
if (getClientConfig()?.isApp) {
21+
navigate(Path.Settings);
22+
}
23+
// eslint-disable-next-line react-hooks/exhaustive-deps
24+
}, []);
25+
1726
return (
1827
<div className={styles["auth-page"]}>
1928
<div className={`no-dark ${styles["auth-logo"]}`}>

app/locales/cn.ts

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
1+
import { getClientConfig } from "../config/client";
12
import { SubmitKey } from "../store/config";
23

4+
const isApp = !!getClientConfig()?.isApp;
5+
36
const cn = {
47
WIP: "该功能仍在开发中……",
58
Error: {
6-
Unauthorized:
7-
"访问密码不正确或为空,请前往[登录](/#/auth)页输入正确的访问密码,或者在[设置](/#/settings)页填入你自己的 OpenAI API Key。",
9+
Unauthorized: isApp
10+
? "检测到无效 API Key,请前往[设置](/#/settings)页检查 API Key 是否配置正确。"
11+
: "访问密码不正确或为空,请前往[登录](/#/auth)页输入正确的访问密码,或者在[设置](/#/settings)页填入你自己的 OpenAI API Key。",
812
},
913
Auth: {
1014
Title: "需要密码",

app/locales/en.ts

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
1+
import { getClientConfig } from "../config/client";
12
import { SubmitKey } from "../store/config";
23
import { LocaleType } from "./index";
34

45
// if you are adding a new translation, please use PartialLocaleType instead of LocaleType
6+
7+
const isApp = !!getClientConfig()?.isApp;
58
const en: LocaleType = {
69
WIP: "Coming Soon...",
710
Error: {
8-
Unauthorized:
9-
"Unauthorized access, please enter access code in [auth](/#/auth) page.",
11+
Unauthorized: isApp
12+
? "Invalid API Key, please check it in [Settings](/#/settings) page."
13+
: "Unauthorized access, please enter access code in [auth](/#/auth) page, or enter your OpenAI API Key.",
1014
},
1115
Auth: {
1216
Title: "Need Access Code",

0 commit comments

Comments
 (0)