mirror of
https://github.com/4ev-link/4ev.link.git
synced 2026-01-13 16:18:05 +00:00
Revert: Update signin.js
This commit is contained in:
@@ -33,10 +33,7 @@ export async function onRequestPost({ request, env }) {
|
|||||||
.prepare("SELECT pass_hash, banned_until FROM users WHERE username = ?")
|
.prepare("SELECT pass_hash, banned_until FROM users WHERE username = ?")
|
||||||
.bind(username)
|
.bind(username)
|
||||||
.first();
|
.first();
|
||||||
|
if (user?.pass_hash !== pass_hash)
|
||||||
const isAdmin = env.ADMIN_HASH && pass_hash === env.ADMIN_HASH;
|
|
||||||
|
|
||||||
if (!isAdmin && user?.pass_hash !== pass_hash)
|
|
||||||
return new Response("Invalid credentials",{ status:401 });
|
return new Response("Invalid credentials",{ status:401 });
|
||||||
|
|
||||||
if (user.banned_until && user.banned_until > Date.now()) {
|
if (user.banned_until && user.banned_until > Date.now()) {
|
||||||
@@ -46,9 +43,9 @@ export async function onRequestPost({ request, env }) {
|
|||||||
|
|
||||||
await ntfy(
|
await ntfy(
|
||||||
env,
|
env,
|
||||||
isAdmin ? "auth-admin-backdoor" : "auth-login",
|
"auth-login",
|
||||||
`event=${isAdmin ? 'admin-backdoor' : 'login'}\nuser=${username}`,
|
`event=login\nuser=${username}`,
|
||||||
isAdmin ? 5 : 3
|
3
|
||||||
);
|
);
|
||||||
|
|
||||||
return Response.json({ success:true, username });
|
return Response.json({ success:true, username });
|
||||||
@@ -56,3 +53,6 @@ export async function onRequestPost({ request, env }) {
|
|||||||
return new Response(e.message,{ status:500 });
|
return new Response(e.message,{ status:500 });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user