Register Nachricht

This commit is contained in:
Klaas 2024-05-29 20:58:49 +02:00
parent 5327ac2f8b
commit 3275c31192
1 changed files with 2 additions and 1 deletions

3
app.js
View File

@ -213,7 +213,8 @@ app.post('/register', async (req, res) => {
try { try {
const hashedPassword = await bcrypt.hash(password, 10); const hashedPassword = await bcrypt.hash(password, 10);
await pool.query('INSERT INTO users (username, password) VALUES ($1, $2)', [username, hashedPassword]); await pool.query('INSERT INTO users (username, password) VALUES ($1, $2)', [username, hashedPassword]);
res.redirect('/login'); const message = 'Registrierung erfolgreich. Ein Admin wird dich in kürze freischalten';
res.render('error', {session: req.session, message});
} catch (error) { } catch (error) {
console.error('Error registering user:', error); console.error('Error registering user:', error);
const message = 'Error registering user:' + error; const message = 'Error registering user:' + error;