mirror of
https://github.com/ets-cfuhrman-pfe/EvalueTonSavoir.git
synced 2025-08-11 21:23:54 -04:00
Compare commits
No commits in common. "e817746801223e883a59d1882d507ab4a6d42ccb" and "fd160aaba719668fe50fd04907cc6284fe50f7e0" have entirely different histories.
e817746801
...
fd160aaba7
2 changed files with 2 additions and 12 deletions
|
|
@ -73,8 +73,6 @@ class ApiService {
|
|||
return false;
|
||||
}
|
||||
|
||||
console.log("ApiService: isLoggedIn: Token:", token);
|
||||
|
||||
// Update token expiry
|
||||
this.saveToken(token);
|
||||
|
||||
|
|
@ -90,19 +88,11 @@ class ApiService {
|
|||
}
|
||||
|
||||
try {
|
||||
console.log("ApiService: isLoggedInTeacher: Token:", token);
|
||||
const decodedToken = jwtDecode(token) as { roles: string[] };
|
||||
|
||||
/////// REMOVE BELOW
|
||||
// automatically add teacher role if not present
|
||||
if (!decodedToken.roles.includes('teacher')) {
|
||||
decodedToken.roles.push('teacher');
|
||||
}
|
||||
////// REMOVE ABOVE
|
||||
const userRoles = decodedToken.roles;
|
||||
const requiredRole = 'teacher';
|
||||
|
||||
console.log("ApiService: isLoggedInTeacher: UserRoles:", userRoles);
|
||||
if (!userRoles || !userRoles.includes(requiredRole)) {
|
||||
return false;
|
||||
}
|
||||
|
|
@ -978,4 +968,4 @@ public async login(email: string, password: string): Promise<any> {
|
|||
}
|
||||
|
||||
const apiService = new ApiService();
|
||||
export default apiService;
|
||||
export default apiService;
|
||||
|
|
@ -55,7 +55,7 @@ class PassportOpenIDConnect {
|
|||
try {
|
||||
const received_user = {
|
||||
auth_id: profile.id,
|
||||
email: profile.emails[0].value.toLowerCase(),
|
||||
email: profile.emails[0].value,
|
||||
name: profile.displayName,
|
||||
roles: []
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in a new issue