change bcrypt dep, fix buildHome
This commit is contained in:
4
mod.ts
4
mod.ts
@@ -1,4 +1,4 @@
|
||||
import { hash, verify } from '@bcrypt';
|
||||
import { hash, compare } from '@bcrypt';
|
||||
import { customAlphabet } from '@nanoid';
|
||||
import { STATUS_CODE, STATUS_TEXT, StatusCode } from '@std/http/status';
|
||||
|
||||
@@ -128,7 +128,7 @@ Deno.serve({ port: config.api.port }, async (req) => {
|
||||
});
|
||||
if (failed) return genericResponse(STATUS_CODE.InternalServerError, "Couldn't read DB.");
|
||||
if (loginMatch.length === 0) return genericResponse(STATUS_CODE.Forbidden, 'Invalid name/PIN combination. Remember name is case sensitive.');
|
||||
if (!(await verify(body.pin, loginMatch[0].hash))) return genericResponse(STATUS_CODE.Forbidden, 'Invalid name/PIN combination.');
|
||||
if (!(await compare(body.pin, loginMatch[0].hash))) return genericResponse(STATUS_CODE.Forbidden, 'Invalid name/PIN combination.');
|
||||
const id = loginMatch[0].id;
|
||||
const email = loginMatch[0].email;
|
||||
const hasEmail = (email ?? '').length > 0;
|
||||
|
||||
Reference in New Issue
Block a user