Revision 59180
Added by Konstantina Galouni almost 4 years ago
user-management.service.ts | ||
---|---|---|
5 | 5 |
import {catchError, map, timeout} from "rxjs/operators"; |
6 | 6 |
import {NavigationEnd, Router} from "@angular/router"; |
7 | 7 |
import {EnvironmentSpecificService} from "../utils/properties/environment-specific.service"; |
8 |
import {properties} from "../../../environments/environment"; |
|
8 | 9 |
|
9 | 10 |
@Injectable({ |
10 | 11 |
providedIn: 'root' |
... | ... | |
15 | 16 |
private readonly promise: Promise<User>; |
16 | 17 |
|
17 | 18 |
constructor(private http: HttpClient, |
18 |
private router: Router, |
|
19 |
private environmentSpecificService: EnvironmentSpecificService) { |
|
19 |
private router: Router) { |
|
20 | 20 |
this.promise = new Promise<any>((resolve => { |
21 |
this.environmentSpecificService.subscribeEnvironment().subscribe(properties => { |
|
22 | 21 |
const token = COOKIE.getCookie('AccessToken'); |
23 | 22 |
if (!token) { |
24 | 23 |
this.getUserInfoSubject.next(null); |
... | ... | |
33 | 32 |
resolve(); |
34 | 33 |
}); |
35 | 34 |
} |
36 |
}); |
|
37 | 35 |
})); |
38 | 36 |
this.router.events.subscribe(event => { |
39 | 37 |
if (event instanceof NavigationEnd) { |
... | ... | |
63 | 61 |
user.id = (info.sub && info.sub.indexOf('@')) ? info.sub.substring(0, info.sub.indexOf('@')) : info.sub; |
64 | 62 |
user.firstname = (info.given_name) ? info.given_name : ""; |
65 | 63 |
user.lastname = (info.family_name) ? info.family_name : ""; |
66 |
user.email = info.email;
|
|
64 |
user.email = info.email.toLowerCase(); // TODO remove, is a quick fix
|
|
67 | 65 |
user.fullname = (info.name) ? info.name : ""; |
68 | 66 |
if (user.fullname == "") { |
69 | 67 |
if (user.firstname != "") { |
Also available in: Unified diff
[use-UoaAdminToolsLibrary | Library]: Merge trunk into branch.