mirror of https://github.com/wg-easy/wg-easy
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
15 lines
411 B
15 lines
411 B
export default defineEventHandler(async (event) => {
|
|
const { username, password } = await readValidatedBody(
|
|
event,
|
|
validateZod(passwordType)
|
|
);
|
|
const users = await Database.user.findAll();
|
|
if (users.length !== 0) {
|
|
throw createError({
|
|
statusCode: 400,
|
|
statusMessage: 'Invalid state',
|
|
});
|
|
}
|
|
await Database.user.create(username, password);
|
|
return { success: true };
|
|
});
|
|
|