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
876ebad1f3
commit
6e9940c85f
1 changed files with 5 additions and 9 deletions
|
@ -49,17 +49,13 @@ if (config.allowEmailRegister) {
|
|||
password: req.body.password
|
||||
}
|
||||
}).spread(function (user, created) {
|
||||
if (user) {
|
||||
if (created) {
|
||||
if (user && created) {
|
||||
logger.debug('user registered: ' + user.id)
|
||||
req.flash('info', "You've successfully registered, please sign in.")
|
||||
} else {
|
||||
logger.debug('user found: ' + user.id)
|
||||
req.flash('error', 'This email has been used, please try another one.')
|
||||
}
|
||||
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 + '/')
|
||||
}).catch(function (err) {
|
||||
logger.error('auth callback failed: ' + err)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue