forked from XiaoMo/ChatGPT-Next-Web
fixup: disable access control when CODE is empty
This commit is contained in:
parent
3136d6d3fd
commit
d0d1673ccc
@ -239,19 +239,23 @@ export function Settings(props: { closeSettings: () => void }) {
|
|||||||
</div>
|
</div>
|
||||||
</List>
|
</List>
|
||||||
<List>
|
<List>
|
||||||
<SettingItem
|
{enabledAccessControl ? (
|
||||||
title={Locale.Settings.AccessCode.Title}
|
<SettingItem
|
||||||
subTitle={Locale.Settings.AccessCode.SubTitle}
|
title={Locale.Settings.AccessCode.Title}
|
||||||
>
|
subTitle={Locale.Settings.AccessCode.SubTitle}
|
||||||
<input
|
>
|
||||||
value={accessStore.accessCode}
|
<input
|
||||||
type="text"
|
value={accessStore.accessCode}
|
||||||
placeholder={Locale.Settings.AccessCode.Placeholder}
|
type="text"
|
||||||
onChange={(e) => {
|
placeholder={Locale.Settings.AccessCode.Placeholder}
|
||||||
accessStore.updateCode(e.currentTarget.value);
|
onChange={(e) => {
|
||||||
}}
|
accessStore.updateCode(e.currentTarget.value);
|
||||||
></input>
|
}}
|
||||||
</SettingItem>
|
></input>
|
||||||
|
</SettingItem>
|
||||||
|
) : (
|
||||||
|
<></>
|
||||||
|
)}
|
||||||
|
|
||||||
<SettingItem
|
<SettingItem
|
||||||
title={Locale.Settings.HistoryCount.Title}
|
title={Locale.Settings.HistoryCount.Title}
|
||||||
|
@ -14,7 +14,7 @@ export function middleware(req: NextRequest, res: NextResponse) {
|
|||||||
console.log("[Auth] got access code:", accessCode);
|
console.log("[Auth] got access code:", accessCode);
|
||||||
console.log("[Auth] hashed access code:", hashedCode);
|
console.log("[Auth] hashed access code:", hashedCode);
|
||||||
|
|
||||||
if (!ACCESS_CODES.has(hashedCode)) {
|
if (ACCESS_CODES.size > 0 && !ACCESS_CODES.has(hashedCode)) {
|
||||||
return NextResponse.json(
|
return NextResponse.json(
|
||||||
{
|
{
|
||||||
needAccessCode: true,
|
needAccessCode: true,
|
||||||
|
Loading…
Reference in New Issue
Block a user