mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
Merge pull request #45 from chid/crash-fix
add proper error handlers to the UserController class
This commit is contained in:
commit
cfe13af6ff
1 changed files with 4 additions and 0 deletions
|
@ -170,6 +170,7 @@ module.exports =
|
||||||
metrics.inc "user.password-change"
|
metrics.inc "user.password-change"
|
||||||
oldPass = req.body.currentPassword
|
oldPass = req.body.currentPassword
|
||||||
AuthenticationManager.authenticate _id: req.session.user._id, oldPass, (err, user)->
|
AuthenticationManager.authenticate _id: req.session.user._id, oldPass, (err, user)->
|
||||||
|
return callback(err) if err?
|
||||||
if(user)
|
if(user)
|
||||||
logger.log user: req.session.user, "changing password"
|
logger.log user: req.session.user, "changing password"
|
||||||
newPassword1 = req.body.newPassword1
|
newPassword1 = req.body.newPassword1
|
||||||
|
@ -198,17 +199,20 @@ module.exports =
|
||||||
redirectUserToDropboxAuth: (req, res)->
|
redirectUserToDropboxAuth: (req, res)->
|
||||||
user_id = req.session.user._id
|
user_id = req.session.user._id
|
||||||
dropboxHandler.getDropboxRegisterUrl user_id, (err, url)->
|
dropboxHandler.getDropboxRegisterUrl user_id, (err, url)->
|
||||||
|
return callback(err) if err?
|
||||||
logger.log url:url, "redirecting user for dropbox auth"
|
logger.log url:url, "redirecting user for dropbox auth"
|
||||||
res.redirect url
|
res.redirect url
|
||||||
|
|
||||||
completeDropboxRegistration: (req, res)->
|
completeDropboxRegistration: (req, res)->
|
||||||
user_id = req.session.user._id
|
user_id = req.session.user._id
|
||||||
dropboxHandler.completeRegistration user_id, (err, success)->
|
dropboxHandler.completeRegistration user_id, (err, success)->
|
||||||
|
return callback(err) if err?
|
||||||
res.redirect('/user/settings#dropboxSettings')
|
res.redirect('/user/settings#dropboxSettings')
|
||||||
|
|
||||||
unlinkDropbox: (req, res)->
|
unlinkDropbox: (req, res)->
|
||||||
user_id = req.session.user._id
|
user_id = req.session.user._id
|
||||||
dropboxHandler.unlinkAccount user_id, (err, success)->
|
dropboxHandler.unlinkAccount user_id, (err, success)->
|
||||||
|
return callback(err) if err?
|
||||||
res.redirect('/user/settings#dropboxSettings')
|
res.redirect('/user/settings#dropboxSettings')
|
||||||
|
|
||||||
deleteUser: (req, res)->
|
deleteUser: (req, res)->
|
||||||
|
|
Loading…
Reference in a new issue