Introduces POST /login and PATCH /password routes for admin authentication and password management. Adds corresponding schema validation for login and password change, enforces stricter password requirements, and updates adminService with JWT-based profile retrieval and improved token handling.
16 lines
573 B
JavaScript
16 lines
573 B
JavaScript
const z = require("zod")
|
|
|
|
module.exports = {
|
|
PATCH: {
|
|
headers: z.object({
|
|
"content-type": z.string().regex(/application\/json/i),
|
|
"authorization": z.string().startsWith("Bearer ")
|
|
}),
|
|
body: z.object({
|
|
newPassword: z.string()
|
|
.min(8, { message: "The password must be at least 8 characters long." })
|
|
.regex(/[A-Z]/, { message: "The password must contain a capital letter." })
|
|
.regex(/[0-9]/, { message: "The password must contain a number." }),
|
|
})
|
|
}
|
|
} |