implemented settings and user page (darkmode is still missing)

This commit is contained in:
2024-03-24 21:02:56 +01:00
parent acb7bb7cb6
commit 45a4b58f26
36 changed files with 2283 additions and 1313 deletions

View File

@ -71,6 +71,32 @@ export const signUp = async (req, res, next) => {
}
};
// Update user password to Database
export const updatePasswordById = async (req, res, next) => {
try {
const id = req.body.id;
let sql = `UPDATE users SET password = ? WHERE id = ?`;
bcrypt.hash(req.body.password, 10, async (err, hash) => {
if (err) {
throw err;
return res.status(500).send({
message: err,
});
} else {
const results = await ownConn.query(sql, [hash, id]);
return res.status(200).send({
message: 'Password changed!',
});
}
});
}
catch (err) {
// Manage Errors
console.log("SQL error : ", err);
result(err, null);
}
};
export const login = async (req, res, next) => {
try {
let sql = `SELECT * FROM users WHERE username = ?`;