reset user password api #27

Merged
naeem.ullah merged 3 commits from mazdak/UX-1861 into dev-pending-01-01-2026 4 weeks ago

@ -7,7 +7,8 @@ export class User {
export interface SetupUser {
userId: string;
userFullname: string;
defaultPassword: string;
password: string;
porOrgacode: string | null;
email: string;
role: string;
}

@ -122,7 +122,8 @@ constructor(private fb: FormBuilder, private httpURIService: HttpURIService, pri
oldPassword: form.get('oldPassword')?.value || null,
// confirmPassword: form.get('confirmPassword')?.value || null,
newPassword: form.get('newPassword')?.value,
userId: this.storageService.getItem('USER_ID')
userId: this.storageService.getItem('USER_ID'),
porOrgaCode: this.storageService.getItem('POR_ORGACODE')
};
}
onSubmit(){

@ -5,6 +5,7 @@ import { CommonModule } from '@angular/common';
import { PasswordHideShowComponent } from '../../shared/components/password-hide-show/password-hide-show.component';
import { URIKey } from '../../utils/uri-enums';
import { HttpURIService } from '../../app.http.uri.service';
import { StorageService } from '../../shared/services/storage.service';
@Component({
selector: 'app-reset-password',
@ -20,11 +21,13 @@ export class ResetPasswordComponent implements OnInit{
@ViewChild('psh1') passwordHideShow1?: PasswordHideShowComponent;
@ViewChild('psh2') passwordHideShow2?: PasswordHideShowComponent;
constructor(private fb: FormBuilder, private httpURIService: HttpURIService){}
constructor(private fb: FormBuilder, private httpURIService: HttpURIService, private storageService: StorageService){}
ngOnInit(): void {
const userIdValue = this.storageService.getItem('USER_ID')
this.resetPasswordForm = this.fb.group({
userId: ['', Validators.required],
userId: [userIdValue || '', Validators.required],
newPassword: ['', [Validators.required, Validators.minLength(6)]],
confirmPassword: ['', [Validators.required, Validators.minLength(6)]]
},
@ -76,7 +79,8 @@ export class ResetPasswordComponent implements OnInit{
const payload = {
userId: this.resetPasswordForm.value.userId,
newPassword: this.resetPasswordForm.value.newPassword
newPassword: this.resetPasswordForm.value.newPassword,
porOrgaCode: this.storageService.getItem('POR_ORGACODE')
};
this.httpURIService.requestPOST(URIKey.RESET_PASSWORD_URI, payload)
.subscribe();

@ -8,6 +8,7 @@ import { SetupUser } from '../../models/user';
import { UserSetupService } from '../../services/user-setup.service';
import { UserFilterPipe } from '../../shared/pipes/userFilterPipe';
import { FormBuilder, Validators, FormGroup } from '@angular/forms';
import { StorageService } from '../../shared/services/storage.service';
@Component({
@ -34,7 +35,7 @@ export class SetupUserComponent implements OnInit {
mode: 'edit' | 'view' = 'view';
constructor(private userService: UserSetupService, private fb: FormBuilder){}
constructor(private userService: UserSetupService, private fb: FormBuilder, private storageService: StorageService){}
get users$(){
return this.userService.users$;
@ -70,8 +71,10 @@ export class SetupUserComponent implements OnInit {
userFullname: this.userForm.value.userFullname,
email: `${this.userForm.value.userId}@dummy.com`,
role: 'ADMIN',
defaultPassword: this.userForm.value.defaultPassword
porOrgacode: this.storageService.getItem('POR_ORGACODE'),
password: this.userForm.value.defaultPassword
}
this.userService.addUser(newUser).subscribe({
next: () => {
this.userService.loadUsers();

@ -49,7 +49,7 @@
},
{
"Id" : "ENTITY_RESET_PASSWORD_URI",
"URI": "/user/resetPassword",
"URI": "/authentication/reset-password",
"UUID": "RESET_PASSWORD_URI"
},
{

Loading…
Cancel
Save