Merge pull request #2933 from H0llyW00dzZ/authpage

This commit is contained in:
Yifei Zhang 2023-10-07 23:03:56 +08:00 committed by GitHub
commit ef3e8e6fac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 31 additions and 9 deletions

View File

@ -15,7 +15,8 @@ export function AuthPage() {
const access = useAccessStore(); const access = useAccessStore();
const goHome = () => navigate(Path.Home); const goHome = () => navigate(Path.Home);
const resetAccessCode = () => access.updateCode(""); // Reset access code to empty string const goChat = () => navigate(Path.Chat);
const resetAccessCode = () => { access.updateCode(""); access.updateToken(""); }; // Reset access code to empty string
useEffect(() => { useEffect(() => {
if (getClientConfig()?.isApp) { if (getClientConfig()?.isApp) {
@ -42,17 +43,34 @@ export function AuthPage() {
access.updateCode(e.currentTarget.value); access.updateCode(e.currentTarget.value);
}} }}
/> />
{!access.hideUserApiKey ? (
<>
<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);
}}
/>
</>
) : null}
<div className={styles["auth-actions"]}> <div className={styles["auth-actions"]}>
<IconButton <IconButton
text={Locale.Auth.Confirm} text={Locale.Auth.Confirm}
type="primary" type="primary"
onClick={goHome} onClick={goChat}
/>
<IconButton
text={Locale.Auth.Later}
onClick={() => {
resetAccessCode();
goHome();
}}
/> />
<IconButton text={Locale.Auth.Later} onClick={() => {
resetAccessCode();
goHome();
}} />
</div> </div>
</div> </div>
); );

View File

@ -10,6 +10,7 @@ const ar: PartialLocaleType = {
Auth: { Auth: {
Title: "تحتاج إلى رمز الوصول", Title: "تحتاج إلى رمز الوصول",
Tips: "يرجى إدخال رمز الوصول أدناه", Tips: "يرجى إدخال رمز الوصول أدناه",
SubTips: "أو أدخل مفتاح واجهة برمجة تطبيقات OpenAI الخاص بك",
Input: "رمز الوصول", Input: "رمز الوصول",
Confirm: "تأكيد", Confirm: "تأكيد",
Later: "لاحقًا", Later: "لاحقًا",

View File

@ -10,6 +10,7 @@ const bn: PartialLocaleType = {
Auth: { Auth: {
Title: "একটি অ্যাক্সেস কোড প্রয়োজন", Title: "একটি অ্যাক্সেস কোড প্রয়োজন",
Tips: "নীচে অ্যাক্সেস কোড ইনপুট করুন", Tips: "নীচে অ্যাক্সেস কোড ইনপুট করুন",
SubTips: "অথবা আপনার OpenAI API কী প্রবেশ করুন",
Input: "অ্যাক্সেস কোড", Input: "অ্যাক্সেস কোড",
Confirm: "নিশ্চিত করুন", Confirm: "নিশ্চিত করুন",
Later: "পরে", Later: "পরে",

View File

@ -13,6 +13,7 @@ const cn = {
Auth: { Auth: {
Title: "需要密码", Title: "需要密码",
Tips: "管理员开启了密码验证,请在下方填入访问码", Tips: "管理员开启了密码验证,请在下方填入访问码",
SubTips: "或者输入你的 OpenAI API 密钥",
Input: "在此处填写访问码", Input: "在此处填写访问码",
Confirm: "确认", Confirm: "确认",
Later: "稍后再说", Later: "稍后再说",

View File

@ -15,6 +15,7 @@ const en: LocaleType = {
Auth: { Auth: {
Title: "Need Access Code", Title: "Need Access Code",
Tips: "Please enter access code below", Tips: "Please enter access code below",
SubTips: "Or enter your OpenAI API Key",
Input: "access code", Input: "access code",
Confirm: "Confirm", Confirm: "Confirm",
Later: "Later", Later: "Later",

View File

@ -4,12 +4,12 @@ import { PartialLocaleType } from "./index";
const id: PartialLocaleType = { const id: PartialLocaleType = {
WIP: "Coming Soon...", WIP: "Coming Soon...",
Error: { Error: {
Unauthorized: Unauthorized: "Akses tidak diizinkan, silakan masukkan kode akses atau masukkan kunci API OpenAI Anda. di halaman [autentikasi](/#/auth) atau di halaman [Pengaturan](/#/settings).",
"Akses tidak diizinkan. Silakan [otorisasi](/#/auth) dengan memasukkan kode akses.", },
},
Auth: { Auth: {
Title: "Diperlukan Kode Akses", Title: "Diperlukan Kode Akses",
Tips: "Masukkan kode akses di bawah", Tips: "Masukkan kode akses di bawah",
SubTips: "Atau masukkan kunci API OpenAI Anda",
Input: "Kode Akses", Input: "Kode Akses",
Confirm: "Konfirmasi", Confirm: "Konfirmasi",
Later: "Nanti", Later: "Nanti",