mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 01:54:15 +00:00
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:
@@ -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);
|
||||||
|
@@ -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)),
|
||||||
|
@@ -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();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@@ -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(
|
||||||
|
Reference in New Issue
Block a user