Merge pull request #929 from atmire/w2p-74275_Issue-2988_Reset-pw-eperson-created-in-admin-ui

Issue 2988: Password (re)set for eperson with add PatchOperation
This commit is contained in:
Tim Donohue
2020-11-20 14:31:55 -06:00
committed by GitHub
4 changed files with 4 additions and 4 deletions

View File

@@ -303,7 +303,7 @@ describe('EPersonDataService', () => {
it('should sent a patch request with an uuid, token and new password to the epersons endpoint', () => { it('should sent a patch request with an uuid, token and new password to the epersons endpoint', () => {
service.patchPasswordWithToken('test-uuid', 'test-token','test-password'); service.patchPasswordWithToken('test-uuid', 'test-token','test-password');
const operation = Object.assign({ op: 'replace', path: '/password', value: 'test-password' }); const operation = Object.assign({ op: 'add', path: '/password', value: 'test-password' });
const expected = new PatchRequest(requestService.generateRequestId(), epersonsEndpoint + '/test-uuid?token=test-token', [operation]); const expected = new PatchRequest(requestService.generateRequestId(), epersonsEndpoint + '/test-uuid?token=test-token', [operation]);
expect(requestService.configure).toHaveBeenCalledWith(expected); expect(requestService.configure).toHaveBeenCalledWith(expected);

View File

@@ -280,7 +280,7 @@ export class EPersonDataService extends DataService<EPerson> {
patchPasswordWithToken(uuid: string, token: string, password: string): Observable<RestResponse> { patchPasswordWithToken(uuid: string, token: string, password: string): Observable<RestResponse> {
const requestId = this.requestService.generateRequestId(); const requestId = this.requestService.generateRequestId();
const operation = Object.assign({ op: 'replace', path: '/password', value: password }); const operation = Object.assign({ op: 'add', path: '/password', value: password });
const hrefObs = this.halService.getEndpoint(this.linkPath).pipe( const hrefObs = this.halService.getEndpoint(this.linkPath).pipe(
map((endpoint: string) => this.getIDHref(endpoint, uuid)), map((endpoint: string) => this.getIDHref(endpoint, uuid)),

View File

@@ -177,7 +177,7 @@ describe('ProfilePageComponent', () => {
component.setPasswordValue('testest'); component.setPasswordValue('testest');
component.setInvalid(false); component.setInvalid(false);
operations = [{op: 'replace', path: '/password', value: 'testest'}]; operations = [{op: 'add', path: '/password', value: 'testest'}];
result = component.updateSecurity(); result = component.updateSecurity();
}); });

View File

@@ -120,7 +120,7 @@ export class ProfilePageComponent implements OnInit {
this.notificationsService.error(this.translate.instant(this.PASSWORD_NOTIFICATIONS_PREFIX + 'error.general')); this.notificationsService.error(this.translate.instant(this.PASSWORD_NOTIFICATIONS_PREFIX + 'error.general'));
} }
if (!this.invalidSecurity && passEntered) { if (!this.invalidSecurity && passEntered) {
const operation = Object.assign({op: 'replace', path: '/password', value: this.password}); const operation = Object.assign({op: 'add', path: '/password', value: this.password});
this.epersonService.patch(this.currentUser, [operation]).subscribe((response: RestResponse) => { this.epersonService.patch(this.currentUser, [operation]).subscribe((response: RestResponse) => {
if (response.isSuccessful) { if (response.isSuccessful) {
this.notificationsService.success( this.notificationsService.success(