This commit is contained in:
@@ -66,6 +66,17 @@ export const signup = {
|
||||
});
|
||||
}
|
||||
|
||||
// check if user is blocked
|
||||
if (uuid) {
|
||||
const blockedUser = await db.getBlockedUserByUuid({ uuid: uuid });
|
||||
if (blockedUser) {
|
||||
throw new ActionError({
|
||||
code: 'FORBIDDEN',
|
||||
message: 'Du bist für die Registrierung gesperrt'
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
if (!teamDraft) {
|
||||
// check if a team with the same name already exists
|
||||
if (input.teamName) {
|
||||
|
||||
@@ -84,5 +84,41 @@ export const user = {
|
||||
users: users
|
||||
};
|
||||
}
|
||||
}),
|
||||
addBlocked: defineAction({
|
||||
input: z.object({
|
||||
uuid: z.string(),
|
||||
comment: z.string().nullable()
|
||||
}),
|
||||
handler: async (input, context) => {
|
||||
Session.actionSessionFromCookies(context.cookies, Permissions.Users);
|
||||
|
||||
const { id } = await db.addBlockedUser(input);
|
||||
|
||||
return {
|
||||
id: id
|
||||
};
|
||||
}
|
||||
}),
|
||||
editBlocked: defineAction({
|
||||
input: z.object({
|
||||
id: z.number(),
|
||||
uuid: z.string(),
|
||||
comment: z.string().nullable()
|
||||
}),
|
||||
handler: async (input, context) => {
|
||||
Session.actionSessionFromCookies(context.cookies, Permissions.Users);
|
||||
|
||||
await db.editBlockedUser(input);
|
||||
}
|
||||
}),
|
||||
blocked: defineAction({
|
||||
handler: async (_, context) => {
|
||||
Session.actionSessionFromCookies(context.cookies, Permissions.Users);
|
||||
|
||||
return {
|
||||
blocked: await db.getBlockedUsers({})
|
||||
};
|
||||
}
|
||||
})
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user