mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-15 07:34:42 -04:00
refactor: use common error message
Signed-off-by: Erik Michelson <github@erik.michelson.eu>
This commit is contained in:
parent
beea1c71ce
commit
fee8066457
1 changed files with 5 additions and 9 deletions
|
@ -49,17 +49,13 @@ if (config.allowEmailRegister) {
|
||||||
password: req.body.password
|
password: req.body.password
|
||||||
}
|
}
|
||||||
}).spread(function (user, created) {
|
}).spread(function (user, created) {
|
||||||
if (user) {
|
if (user && created) {
|
||||||
if (created) {
|
logger.debug('user registered: ' + user.id)
|
||||||
logger.debug('user registered: ' + user.id)
|
req.flash('info', "You've successfully registered, please sign in.")
|
||||||
req.flash('info', "You've successfully registered, please signin.")
|
|
||||||
} else {
|
|
||||||
logger.debug('user found: ' + user.id)
|
|
||||||
req.flash('error', 'This email has been used, please try another one.')
|
|
||||||
}
|
|
||||||
return res.redirect(config.serverURL + '/')
|
return res.redirect(config.serverURL + '/')
|
||||||
}
|
}
|
||||||
req.flash('error', 'Failed to register your account, please try again.')
|
logger.debug('registration failed. user: ', user)
|
||||||
|
req.flash('error', 'Failed to register your account.')
|
||||||
return res.redirect(config.serverURL + '/')
|
return res.redirect(config.serverURL + '/')
|
||||||
}).catch(function (err) {
|
}).catch(function (err) {
|
||||||
logger.error('auth callback failed: ' + err)
|
logger.error('auth callback failed: ' + err)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue