👔 (user) create user check password
create boilerplate code for user check password
This commit is contained in:
12
src/modules/user/controller/checkUserPassword.controller.ts
Normal file
12
src/modules/user/controller/checkUserPassword.controller.ts
Normal file
@ -0,0 +1,12 @@
|
||||
import { Context } from "elysia";
|
||||
import { checkUserPasswordService } from "../services/checkUserPassword.service";
|
||||
import { jwtDecode } from "../../../helpers/http/jwt/decode";
|
||||
import { getCookie } from "../../../helpers/http/userHeader/cookies/getCookies";
|
||||
|
||||
export const checkUserPasswordController = async (
|
||||
ctx: Context & { body: { password: string } }
|
||||
) => {
|
||||
const cookie = getCookie(ctx);
|
||||
const jwtPayload = jwtDecode(cookie.auth_token!);
|
||||
return checkUserPasswordService(jwtPayload, ctx.body.password);
|
||||
};
|
||||
Reference in New Issue
Block a user