Change user password integration

pull/3/head
Alvaro Puente Mella 2024-06-14 11:14:32 +02:00
parent dc2b98312c
commit b460d3fbb0
2 changed files with 7 additions and 4 deletions

View File

@ -21,6 +21,7 @@ export class SidebarComponent {
if (token) { if (token) {
try { try {
this.decodedToken = jwtDecode(token); this.decodedToken = jwtDecode(token);
console.log('Decoded token:', this.decodedToken);
this.isSuperAdmin = this.decodedToken.roles.includes('ROLE_SUPER_ADMIN'); this.isSuperAdmin = this.decodedToken.roles.includes('ROLE_SUPER_ADMIN');
this.username = this.decodedToken.username; this.username = this.decodedToken.username;
} catch (error) { } catch (error) {

View File

@ -28,7 +28,9 @@ export class ChangePasswordModalComponent {
}, { validators: this.passwordMatchValidator }); }, { validators: this.passwordMatchValidator });
} }
ngOnInit(): void {} ngOnInit(): void {
console.log('Data:', this.data);
}
onNoClick(): void { onNoClick(): void {
this.dialogRef.close(); this.dialogRef.close();
@ -41,12 +43,12 @@ export class ChangePasswordModalComponent {
const userPayload = { const userPayload = {
username: this.userForm.value.username, username: this.userForm.value.username,
allowedOrganizationalUnits: this.data.user.allowedOrganizationalUnits, allowedOrganizationalUnits: [],
password: this.userForm.value.password, password: this.userForm.value.password,
enabled: true, enabled: true,
userGroups: this.data.user.userGroups userGroups: []
}; };
console.log("THIS IS THE USER PAYLOAD: ", userPayload);
this.userService.updateUser(this.data.uuid, userPayload).subscribe( this.userService.updateUser(this.data.uuid, userPayload).subscribe(
response => { response => {
console.log('User updated successfully:', response); console.log('User updated successfully:', response);