mirror of
https://github.com/dreamhunter2333/cloudflare_temp_email.git
synced 2026-05-22 08:46:28 +08:00
fix: do not show auth when input wrong auth code (#23)
This commit is contained in:
@@ -19,12 +19,16 @@ api.get('/api/settings', async (c) => {
|
||||
})
|
||||
|
||||
api.get('/open_api/settings', async (c) => {
|
||||
// check header x-custom-auth
|
||||
let needAuth = false;
|
||||
if (c.env.PASSWORDS && c.env.PASSWORDS.length > 0) {
|
||||
const auth = c.req.headers.get("x-custom-auth");
|
||||
needAuth = !c.env.PASSWORDS.includes(auth);
|
||||
}
|
||||
return c.json({
|
||||
"prefix": c.env.PREFIX,
|
||||
"domains": c.env.DOMAINS,
|
||||
"auth": (
|
||||
c.env.PASSWORDS && c.env.PASSWORDS.length > 0
|
||||
) ? true : false,
|
||||
"needAuth": needAuth,
|
||||
});
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user