mirror of
https://github.com/taobataoma/meanTorrent.git
synced 2026-01-29 10:39:19 +01:00
Make emails unique
Emails are made unique. When user attempts to sign in through a provider in which his email is one that is already registered, user is redirected to the signin page with an error passed as a query string parameter.
This commit is contained in:
@@ -83,12 +83,15 @@ exports.signout = function (req, res) {
|
||||
exports.oauthCallback = function (strategy) {
|
||||
return function (req, res, next) {
|
||||
passport.authenticate(strategy, function (err, user, redirectURL) {
|
||||
if (err || !user) {
|
||||
return res.redirect('/#!/signin');
|
||||
if (err) {
|
||||
return res.redirect('/authentication/signin?err=' + encodeURIComponent(errorHandler.getErrorMessage(err)));
|
||||
}
|
||||
if (!user) {
|
||||
return res.redirect('/authentication/signin');
|
||||
}
|
||||
req.login(user, function (err) {
|
||||
if (err) {
|
||||
return res.redirect('/#!/signin');
|
||||
return res.redirect('/authentication/signin');
|
||||
}
|
||||
|
||||
return res.redirect(redirectURL || '/');
|
||||
|
||||
Reference in New Issue
Block a user