mirror of
https://github.com/KeyZox71/knl_meowscendence.git
synced 2025-08-16 13:32:53 +02:00
「🏗️」 wip: added create, users and delete routes
This commit is contained in:
@ -62,7 +62,7 @@ export default async function(fastify, options) {
|
||||
/** @type {{ user: string, password: string }} */
|
||||
const { user, password } = request.body;
|
||||
|
||||
if (!checkUser(user)) {
|
||||
if (!checkUser(user) || user === 'admin') {
|
||||
return reply.code(400).send({ error: "User does not exist" });
|
||||
}
|
||||
|
||||
@ -98,10 +98,10 @@ export default async function(fastify, options) {
|
||||
|
||||
fastify.post('/register', async (request, reply) => {
|
||||
try {
|
||||
/** @type {{ username: string, password: string }} */
|
||||
/** @type {{ user: string, password: string }} */
|
||||
const { user, password } = request.body;
|
||||
|
||||
if (!isValidString(user) || !isValidString(password)) {
|
||||
if (!isValidString(user) || !isValidString(password) || user === 'admin') {
|
||||
return reply.code(400).send({ error: 'Invalid username or password' });
|
||||
} else if (checkUser(user) === true) {
|
||||
return reply.code(400).send({ error: "User already exist" });
|
||||
|
Reference in New Issue
Block a user