mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-02-06 14:51:20 +00:00
Fixed Bug with multiple messages
Signed-off-by: Yannick Bungers <git@innay.de> Signed-off-by: David Mehren <dmehren1@gmail.com>
This commit is contained in:
parent
dc3a3f2994
commit
c24023437f
1 changed files with 10 additions and 6 deletions
|
@ -55,12 +55,16 @@ export const EmailMiddleware: AuthMiddleware = {
|
||||||
password: req.body.password
|
password: req.body.password
|
||||||
}
|
}
|
||||||
}).then(function ([user, created]: [User, boolean]) {
|
}).then(function ([user, created]: [User, boolean]) {
|
||||||
|
if (user) {
|
||||||
if (created) {
|
if (created) {
|
||||||
logger.debug('user registered: ' + user.id)
|
logger.debug('user registered: ' + user.id)
|
||||||
req.flash('info', "You've successfully registered, please signin.")
|
req.flash('info', "You've successfully registered, please signin.")
|
||||||
|
return
|
||||||
} else {
|
} else {
|
||||||
logger.debug('user found: ' + user.id)
|
logger.debug('user found: ' + user.id)
|
||||||
req.flash('error', 'This email has been used, please try another one.')
|
req.flash('error', 'This email has been used, please try another one.')
|
||||||
|
return
|
||||||
|
}
|
||||||
}
|
}
|
||||||
req.flash('error', 'Failed to register your account, please try again.')
|
req.flash('error', 'Failed to register your account, please try again.')
|
||||||
return res.redirect(config.serverURL + '/')
|
return res.redirect(config.serverURL + '/')
|
||||||
|
|
Loading…
Reference in a new issue