remove excess logging
This commit is contained in:
parent
9f24b54e47
commit
9c6c7df92b
1 changed files with 30 additions and 26 deletions
|
@ -16,8 +16,15 @@ module.exports = ({ db, ensurePfp }) => {
|
|||
req.flash('success', 'Saved profile picture!')
|
||||
res.redirect(`${_CC.config.base}profile`)
|
||||
})
|
||||
router.post('/', verifyAuth(), (req, res) => {
|
||||
if (req.body.oldPassword && req.body.newPassword) {
|
||||
router.post('/password', verifyAuth(), (req, res) => {
|
||||
if (!req.body.oldPassword) {
|
||||
req.flash('error', 'Old Password is required')
|
||||
return res.redirect('/profile/password')
|
||||
}
|
||||
if (!req.body.newPassword) {
|
||||
req.flash('error', 'New Password is required')
|
||||
return res.redirect('/profile/password')
|
||||
}
|
||||
bcrypt.compare(req.body.oldPassword, req.user.password, (err, correct) => {
|
||||
if (err) throw err
|
||||
if (correct) {
|
||||
|
@ -29,7 +36,7 @@ module.exports = ({ db, ensurePfp }) => {
|
|||
db.put(doc)
|
||||
.then(() => {
|
||||
req.flash('success', 'Changes saved successfully!')
|
||||
res.redirect('/profile')
|
||||
res.redirect('/profile/password')
|
||||
})
|
||||
.catch(err => { throw err })
|
||||
})
|
||||
|
@ -37,12 +44,9 @@ module.exports = ({ db, ensurePfp }) => {
|
|||
})
|
||||
} else {
|
||||
req.flash('error', 'Incorrect old password')
|
||||
res.redirect('/profile')
|
||||
res.redirect('/profile/password')
|
||||
}
|
||||
})
|
||||
} else {
|
||||
res.redirect('/profile')
|
||||
}
|
||||
})
|
||||
|
||||
return router
|
||||
|
|
Loading…
Reference in a new issue