mirror of
https://framagit.org/les/gancio.git
synced 2025-01-31 16:42:22 +01:00
notify user when accepted, fix #308
This commit is contained in:
parent
54cc50169b
commit
deb2367a44
2 changed files with 3 additions and 6 deletions
|
@ -62,13 +62,9 @@ const userController = {
|
|||
|
||||
if (!user) { return res.status(404).json({ success: false, message: 'User not found!' }) }
|
||||
|
||||
if (req.body.id !== req.user.id && !req.user.is_admin) {
|
||||
return res.status(400).json({ succes: false, message: 'Not allowed' })
|
||||
}
|
||||
|
||||
if (!req.body.password) { delete req.body.password }
|
||||
|
||||
if (!user.is_active && req.body.is_active && user.recover_code) {
|
||||
if ((!user.is_active && req.body.is_active) || user.recover_code) {
|
||||
mail.send(user.email, 'confirm', { user, config }, res.locals.settings.locale)
|
||||
}
|
||||
|
||||
|
@ -89,6 +85,7 @@ const userController = {
|
|||
}
|
||||
|
||||
req.body.is_active = false
|
||||
req.body.is_admin = false
|
||||
|
||||
// check email
|
||||
if (!linkify.test(req.body.email, 'email')) {
|
||||
|
|
|
@ -83,7 +83,7 @@ module.exports = () => {
|
|||
api.post('/user', isAdmin, userController.create)
|
||||
|
||||
// update user
|
||||
api.put('/user', isAuth, userController.update)
|
||||
api.put('/user', isAdmin, userController.update)
|
||||
|
||||
// delete user
|
||||
api.delete('/user/:id', isAdmin, userController.remove)
|
||||
|
|
Loading…
Reference in a new issue