- Username: {{user.username}}
- Full name: {{user.full_name}}
- Email: {{user.email}}
+ Username: {{ user.username }}
+ Full name: {{ user.full_name }}
+ Email: {{ user.email }}
-
+
+
+
diff --git a/src/app/components/users/logged-user/logged-user.component.ts b/src/app/components/users/logged-user/logged-user.component.ts
index ef8fad70..1678f874 100644
--- a/src/app/components/users/logged-user/logged-user.component.ts
+++ b/src/app/components/users/logged-user/logged-user.component.ts
@@ -5,6 +5,8 @@ import { UserService } from '../../../services/user.service';
import { ToasterService } from '../../../services/toaster.service';
import { User } from '../../../models/users/user';
import { Controller } from '../../../models/controller';
+import { ChangeUserPasswordComponent } from "@components/user-management/user-detail/change-user-password/change-user-password.component";
+import { MatDialog } from "@angular/material/dialog";
@Component({
selector: 'app-logged-user',
@@ -19,7 +21,8 @@ export class LoggedUserComponent implements OnInit {
private route: ActivatedRoute,
private controllerService: ControllerService,
private userService: UserService,
- private toasterService: ToasterService
+ private toasterService: ToasterService,
+ public dialog: MatDialog
) {}
ngOnInit() {
@@ -32,6 +35,11 @@ export class LoggedUserComponent implements OnInit {
});
}
+ changePassword() {
+ this.dialog.open(ChangeUserPasswordComponent,
+ {width: '400px', height: '300px', data: {user: this.user, controller: this.controller, self_update: true}});
+ }
+
copyToken() {
const selBox = document.createElement('textarea');
selBox.style.position = 'fixed';
diff --git a/src/app/services/user.service.ts b/src/app/services/user.service.ts
index 9ffa9110..b4e5f7c5 100644
--- a/src/app/services/user.service.ts
+++ b/src/app/services/user.service.ts
@@ -5,6 +5,7 @@ import { Controller } from '../models/controller';
import { HttpController } from './http-controller.service';
import { User } from '../models/users/user';
import { Group } from "@models/groups/group";
+import {Image} from "@models/images";
@Injectable()
export class UserService {
@@ -32,7 +33,10 @@ export class UserService {
return this.httpController.delete(controller, `/access/users/${user_id}`);
}
- update(controller: Controller, user: any): Observable {
+ update(controller: Controller, user: any, self_update: boolean): Observable {
+ if (self_update) {
+ return this.httpController.put(controller, `/access/users/me`, user);
+ }
return this.httpController.put(controller, `/access/users/${user.user_id}`, user);
}