diff --git a/lib/core/login/components/login.component.spec.ts b/lib/core/login/components/login.component.spec.ts index a614666b28..291b54fb7f 100644 --- a/lib/core/login/components/login.component.spec.ts +++ b/lib/core/login/components/login.component.spec.ts @@ -571,4 +571,16 @@ describe('LoginComponent', () => { loginWithCredentials('fake-username', 'fake-password', null); })); + + it('should emit only the username and not the password as part of the executeSubmit', async(() => { + component.executeSubmit.subscribe((res) => { + fixture.detectChanges(); + + expect(res.values.controls.username).toBeDefined('username mandatory'); + expect(res.values.controls.username.value).toEqual('fake-username'); + expect(res.values.controls.password).toBeUndefined('The password not not be part of the emitted values'); + }); + + loginWithCredentials('fake-username', 'fake-password'); + })); }); diff --git a/lib/core/login/components/login.component.ts b/lib/core/login/components/login.component.ts index 57f47e03ac..f5f3a41d70 100644 --- a/lib/core/login/components/login.component.ts +++ b/lib/core/login/components/login.component.ts @@ -174,8 +174,7 @@ export class LoginComponent implements OnInit { this.settingsService.csrfDisabled = this.disableCsrf; this.disableError(); - - const args = new LoginSubmitEvent(this.form); + const args = new LoginSubmitEvent({controls : { username : this.form.controls.username} }); this.executeSubmit.emit(args); if (args.defaultPrevented) {