diff --git a/app.js b/app.js index 78a78e1..26eea8f 100644 --- a/app.js +++ b/app.js @@ -228,7 +228,7 @@ app.post('/login', async (req, res) => { }); // Logout -app.post('/logout', (req, res) => { +app.get('/logout', (req, res) => { req.session.destroy(err => { if (err) { return res.status(500).send('Internal Server Error'); @@ -250,17 +250,15 @@ app.post('/activate', requireAuth, requireAdmin, async (req, res) => { }); // Passwort-Zurücksetzung anfordern -app.post('/forgot-password', async (req, res) => { +app.post('/send-password', async (req, res) => { const { email } = req.body; - console.log ( email ); try { const userResult = await pool.query('SELECT * FROM users WHERE email = $1', [email]); if (userResult.rows.length > 0) { const user = userResult.rows[0]; const token = crypto.randomBytes(20).toString('hex'); const resetLink = `http://tkd.boergmann.it/reset-password/${token}`; - console.log(resetLink); - await pool.query('UPDATE users SET reset_password_token = $1, reset_password_expires = $2 WHERE id = $3', [token, Date.now() + 3600, user.id]); + await pool.query('UPDATE users SET reset_password_token = $1, reset_password_expires = $2 WHERE id = $3', [token, selectedDate = moment().add(1,'d').toDate() , user.id]); const mailOptions = { to: user.email, @@ -287,7 +285,7 @@ app.post('/forgot-password', async (req, res) => { }); app.get('/forgot-password', async (req, res) => { - res.render('forgot-password', {session: req.session, token : '123'}) + res.render('forgot-password', {session: req.session}) }) // Passwort zurücksetzen diff --git a/views/forgot-password.ejs b/views/forgot-password.ejs index bd7805d..4bac480 100644 --- a/views/forgot-password.ejs +++ b/views/forgot-password.ejs @@ -1,7 +1,7 @@ <%- include('partials/header') %>

Forgot Password

-
+
diff --git a/views/partials/header.ejs b/views/partials/header.ejs index cab21cb..eef8f69 100644 --- a/views/partials/header.ejs +++ b/views/partials/header.ejs @@ -7,6 +7,7 @@ +
diff --git a/views/trainings.ejs b/views/trainings.ejs index 50c3142..24dc7c0 100644 --- a/views/trainings.ejs +++ b/views/trainings.ejs @@ -2,7 +2,7 @@

<% if (previousTraining) { %> - < + < <% } %> Training <%= training.datum %> <% if (nextTraining) { %>