|
|
@@ -97,7 +97,7 @@ module.exports = function(crowi, app) {
|
|
|
'name': nameToBeRegistered
|
|
|
}
|
|
|
|
|
|
- const externalAccount = await getOrCreateUser(req, next, userInfo, provider);
|
|
|
+ const externalAccount = await getOrCreateUser(req, res, next, userInfo, provider);
|
|
|
const user = await externalAccount.getPopulatedUser();
|
|
|
|
|
|
// login
|
|
|
@@ -214,7 +214,7 @@ module.exports = function(crowi, app) {
|
|
|
'username': response.displayName,
|
|
|
'name': `${response.name.givenName} ${response.name.familyName}`
|
|
|
}
|
|
|
- const externalAccount = await getOrCreateUser(req, next, userInfo, provider);
|
|
|
+ const externalAccount = await getOrCreateUser(req, res, next, userInfo, provider);
|
|
|
const user = await externalAccount.getPopulatedUser();
|
|
|
|
|
|
// login
|
|
|
@@ -260,7 +260,7 @@ module.exports = function(crowi, app) {
|
|
|
});
|
|
|
};
|
|
|
|
|
|
- const getOrCreateUser = async(req, next, userInfo, provider) => {
|
|
|
+ const getOrCreateUser = async(req, res, next, userInfo, provider) => {
|
|
|
try {
|
|
|
// find or register(create) user
|
|
|
const externalAccount = await ExternalAccount.findOrRegister(
|
|
|
@@ -282,7 +282,7 @@ module.exports = function(crowi, app) {
|
|
|
}
|
|
|
else {
|
|
|
req.flash('provider-DuplicatedUsernameException', provider);
|
|
|
- return next();
|
|
|
+ return loginFailure(req, res, next);
|
|
|
}
|
|
|
}
|
|
|
throw err; // throw again
|