added login and sign Funtion properly

This commit is contained in:
2024-02-22 16:43:08 +01:00
parent 4b193ac5a1
commit 8c18d80737
11 changed files with 230 additions and 102 deletions

View File

@ -15,8 +15,9 @@ import {
//insert user to databased
export const signUp = async (req, res, next) => {
try {
let sql = `SELECT id FROM users WHERE LOWER(username) = LOWER(?)`;
let sql = `SELECT id FROM users WHERE LOWER(username) = LOWER(?)`;
const result = await ownConn.execute(sql, [req.body.username])
if (result.length > 0) { //username already exists
return res.status(409).send({
message: 'This username is already in use!'