diff --git a/app.js b/app.js index 944a8ad..51b39a0 100644 --- a/app.js +++ b/app.js @@ -284,6 +284,8 @@ app.post('/userrights', requireAuth, requireAdmin, async (req, res) => { } else if (type === 'admint') { await pool.query('UPDATE users SET role = $1, admin_temp = $2 WHERE id = $3', ['admin', moment().toDate() , userId]); + } else if (type === 'delete') { + await pool.query('DELETE FROM users WHERE id = $1', [userId]); } res.redirect('/admin'); } catch (error) { diff --git a/views/admin.ejs b/views/admin.ejs index f9c5a6c..ed4feef 100644 --- a/views/admin.ejs +++ b/views/admin.ejs @@ -35,12 +35,17 @@ <% users.forEach(user => { %>
  • <%= user.username %> - <%= user.email %> - <% if (user.role === '0') { %> + <% if (!user.is_active) { %>
    +
    + + + +
    <% } else if (user.role === 'user') { %>