Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
kaushithamsilva committed Jan 29, 2024
2 parents 3fe5f60 + 3506eb9 commit e60fd40
Show file tree
Hide file tree
Showing 5 changed files with 174 additions and 176 deletions.
17 changes: 9 additions & 8 deletions code/backend/src/controllers/login.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,19 @@ class LoginController {
}

const email = loginReq.userName;
const manager = await ManagerModel.findOne({ email });
const manager = await ManagerModel.findOne({
teamId: loginReq.teamId,
email: email,
});
console.log(300);
console.log(manager);

console.log(manager?.isVerified);

if (manager?.isVerified == "pending" || manager?.isVerified == "rejected") {
throw new Error(HttpMsg.MANAGER_NOT_VERIFIED);
}




try {
// create refresh token
const refreshToken = createRefreshTokenManager(loginReq, role);
Expand Down Expand Up @@ -84,9 +89,6 @@ class LoginController {
loginReq.password
);




if (!isMatch) {
throw new Error(HttpMsg.PASSWORD_INCORRECT);
}
Expand All @@ -97,7 +99,6 @@ class LoginController {
throw new Error(HttpMsg.PLAYER_NOT_VERIFIED);
}


try {
// create refresh token
const refreshToken = createRefreshToken(loginReq, role);
Expand Down
Loading

0 comments on commit e60fd40

Please sign in to comment.