Skip to content

Commit d7627c0

Browse files
bug-fix-github_auth (#2504)
1 parent 92eec1c commit d7627c0

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

controllers/auth.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,8 @@ const githubAuthCallback = (req, res, next) => {
188188
}
189189

190190
const userDataFromDB = await users.fetchUser({ email: userData.email });
191-
if (userDataFromDB.userExists && userDataFromDB.user?.role !== ROLES.DEVELOPER) {
191+
const userRole = userDataFromDB.user?.role;
192+
if (userDataFromDB.userExists && userRole && userRole !== ROLES.DEVELOPER) {
192193
return res.status(403).json({
193194
message: "Github Login is restricted for non-developers,please use Google Login",
194195
});

controllers/users.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -500,6 +500,9 @@ const updateSelf = async (req, res, next) => {
500500
}
501501
await userQuery.setIncompleteUserDetails(userId);
502502
}
503+
if (role) {
504+
return res.boom.forbidden("You are not authorized to perform this operation");
505+
}
503506
}
504507

505508
if (req.body.disabledRoles) {

0 commit comments

Comments
 (0)