Skip to content
This repository has been archived by the owner on Sep 15, 2024. It is now read-only.

Commit

Permalink
Client App [Tauri] [Authentication page]
Browse files Browse the repository at this point in the history
Ref : UI Page [Auth Page] ChatGPTNextWeb#2933
[+] feat(auth.tsx): add authentication page UI and functionality for app clients
[+] fix(cn.ts): update unauthorized access error message for app clients
[+] fix(en.ts): update unauthorized access error message for app clients
  • Loading branch information
H0llyW00dzZ committed Oct 1, 2023
1 parent dbdbf1c commit 174b42f
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 3 deletions.
36 changes: 35 additions & 1 deletion app/components/auth.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,41 @@ export function AuthPage() {

useEffect(() => {
if (getClientConfig()?.isApp) {
navigate(Path.Settings);
<div className={styles["auth-page"]}>
<div className={`no-dark ${styles["auth-logo"]}`}>
<BotIcon />
</div>

<div className={styles["auth-title"]}>{Locale.Auth.Title}</div>
<div className={styles["auth-tips"]}>{Locale.Auth.Tips}</div>
<>
<div className={styles["auth-tips"]}>{Locale.Auth.SubTips}</div>
<input
className={styles["auth-input"]}
type="password"
placeholder={Locale.Settings.Token.Placeholder}
value={access.token}
onChange={(e) => {
access.updateToken(e.currentTarget.value);
}}
/>
</>

<div className={styles["auth-actions"]}>
<IconButton
text={Locale.Auth.Confirm}
type="primary"
onClick={goPrivacy}
/>
<IconButton
text={Locale.Auth.Later}
onClick={() => {
resetAccessCode();
goHome();
}}
/>
</div>
</div>
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);
Expand Down
2 changes: 1 addition & 1 deletion app/locales/cn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const cn = {
WIP: "该功能仍在开发中……",
Error: {
Unauthorized: isApp
? "检测到无效 API Key,请前往[设置](/#/settings)页检查 API Key 是否配置正确。"
? "未经授权的访问,请在 [auth](/#/auth) 页面输入您的 OpenAI API Key。"
: "访问密码不正确或为空,请前往[登录](/#/auth)页输入正确的访问密码,或者在[设置](/#/settings)页填入你自己的 OpenAI API Key。",
Content_Policy: {
Title:
Expand Down
2 changes: 1 addition & 1 deletion app/locales/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const en: LocaleType = {
WIP: "Coming Soon...",
Error: {
Unauthorized: isApp
? "Invalid API Key, please check it in [Settings](/#/settings) page."
? "Unauthorized access, please enter your OpenAI API Key in [auth](/#/auth) page."
: "Unauthorized access, please enter access code in [auth](/#/auth) page, or enter your OpenAI API Key.",
Content_Policy: {
Title:
Expand Down

0 comments on commit 174b42f

Please sign in to comment.