Small user changes #865

This commit is contained in:
Jamie.Rees 2017-05-24 16:31:36 +01:00
commit 8a98761fec
3 changed files with 12 additions and 18 deletions

View file

@ -34,6 +34,8 @@ export class AppComponent implements OnInit {
this.settingsService.getCustomization().subscribe(x => this.customizationSettings = x);
this.router.events.subscribe(() => {
this.user = this.authService.claims();
this.showNav = this.authService.loggedIn();
});

View file

@ -40,7 +40,7 @@ export class AuthService extends ServiceHelpers {
var u = { name: name, roles: [] as string[] };
if (roles instanceof Array) {
u.roles.concat(roles);
u.roles = roles;
} else {
u.roles.push(roles);
}

View file

@ -29,11 +29,6 @@ export class LoginComponent {
this.authService.login({ password: this.password, username: this.username })
.subscribe(x => {
localStorage.setItem("id_token", x.access_token);
localStorage.setItem('currentUser', this.username);
this.identityService.getUser().subscribe(r => {
localStorage.setItem("roles", JSON.stringify(r.claims));
localStorage.setItem("user", JSON.stringify(r));
if (this.authService.loggedIn()) {
this.router.navigate(['search']);
@ -41,10 +36,7 @@ export class LoginComponent {
this.notify.error("Could not log in", "Incorrect username or password");
}
});
}, err => this.notify.error("Could not log in", "Incorrect username or password"));
}
}