mirror of
https://github.com/fosrl/pangolin.git
synced 2025-08-31 15:09:39 +02:00
Merge branch 'main' of https://github.com/fosrl/pangolin
This commit is contained in:
commit
b2bc397b6e
15 changed files with 906 additions and 15 deletions
|
@ -6,8 +6,8 @@ export const passwordSchema = z
|
|||
.max(64, { message: "Password must be at most 64 characters long" })
|
||||
.regex(/^(?=.*?[A-Z])(?=.*?[a-z])(?=.*?[0-9])(?=.*?[#?!@$%^&*-]).*$/, {
|
||||
message: `Your password must meet the following conditions:
|
||||
- At least one uppercase English letter.
|
||||
- At least one lowercase English letter.
|
||||
- At least one digit.
|
||||
- At least one special character.`,
|
||||
at least one uppercase English letter,
|
||||
at least one lowercase English letter,
|
||||
at least one digit,
|
||||
at least one special character.`
|
||||
});
|
||||
|
|
|
@ -59,12 +59,19 @@ export async function verifyEmail(
|
|||
emailVerified: true,
|
||||
})
|
||||
.where(eq(users.id, user.id));
|
||||
} else {
|
||||
return next(
|
||||
createHttpError(
|
||||
HttpCode.BAD_REQUEST,
|
||||
"Invalid verification code",
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
return response<VerifyEmailResponse>(res, {
|
||||
success: true,
|
||||
error: false,
|
||||
message: valid ? "Code is valid" : "Code is invalid",
|
||||
message: "Email verified",
|
||||
status: HttpCode.OK,
|
||||
data: {
|
||||
valid,
|
||||
|
|
|
@ -21,7 +21,7 @@ import {
|
|||
verifyRoleAccess,
|
||||
verifySuperuser,
|
||||
verifyUserInRole,
|
||||
verifyUserAccess
|
||||
verifyUserAccess,
|
||||
} from "./auth";
|
||||
|
||||
// Root routes
|
||||
|
@ -102,6 +102,11 @@ authenticated.delete(
|
|||
target.deleteTarget,
|
||||
);
|
||||
|
||||
authenticated.get("/users", user.listUsers);
|
||||
// authenticated.get("/org/:orgId/users", user.???); // TODO: Implement this
|
||||
unauthenticated.get("/user", verifySessionMiddleware, user.getUser);
|
||||
// authenticated.get("/user/:userId", user.getUser);
|
||||
authenticated.delete("/user/:userId", user.deleteUser);
|
||||
authenticated.put(
|
||||
"/org/:orgId/role",
|
||||
verifyOrgAccess,
|
||||
|
@ -109,7 +114,12 @@ authenticated.put(
|
|||
role.createRole,
|
||||
);
|
||||
authenticated.get("/org/:orgId/roles", verifyOrgAccess, role.listRoles);
|
||||
authenticated.get("/role/:roleId", verifyRoleAccess, verifyUserInRole, role.getRole);
|
||||
authenticated.get(
|
||||
"/role/:roleId",
|
||||
verifyRoleAccess,
|
||||
verifyUserInRole,
|
||||
role.getRole,
|
||||
);
|
||||
authenticated.post(
|
||||
"/role/:roleId",
|
||||
verifyRoleAccess,
|
||||
|
@ -182,8 +192,18 @@ authenticated.get(
|
|||
|
||||
authenticated.get("/user", user.getUser);
|
||||
authenticated.get("/org/:orgId/users", verifyOrgAccess, user.listUsers);
|
||||
authenticated.delete("/org/:orgId/user/:userId", verifyOrgAccess, verifyUserAccess, user.removeUserOrg);
|
||||
authenticated.put("/org/:orgId/user/:userId", verifyOrgAccess, verifyUserAccess, user.addUserOrg);
|
||||
authenticated.delete(
|
||||
"/org/:orgId/user/:userId",
|
||||
verifyOrgAccess,
|
||||
verifyUserAccess,
|
||||
user.removeUserOrg,
|
||||
);
|
||||
authenticated.put(
|
||||
"/org/:orgId/user/:userId",
|
||||
verifyOrgAccess,
|
||||
verifyUserAccess,
|
||||
user.addUserOrg,
|
||||
);
|
||||
|
||||
authenticated.put(
|
||||
"/user/:userId/site",
|
||||
|
|
|
@ -2,4 +2,4 @@ export * from "./getUser";
|
|||
export * from "./removeUserOrg";
|
||||
export * from "./addUserOrg";
|
||||
export * from "./listUsers";
|
||||
export * from "./setUserRole";
|
||||
export * from "./setUserRole";
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue