Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 | 2x 2x 2x 2x 2x 4x 4x 4x 4x 2x 1x 1x 1x 1x 6x | import { ChangeDetectionStrategy, Component, EventEmitter, OnInit, Output } from '@angular/core'; import { FormGroup } from '@angular/forms'; import { FormlyFieldConfig } from '@ngx-formly/core'; import { markAsDirtyRecursive } from 'ish-shared/forms/utils/form-utils'; import { SpecialValidators } from 'ish-shared/forms/validators/special-validators'; /** * The Update Password Form Component displays a Forgot Password Update Password form and triggers the submit. * * @example * <ish-update-password-form * (submitPassword)="submitPassword($event)" * ></ish-update-password-form> */ @Component({ selector: 'ish-update-password-form', templateUrl: './update-password-form.component.html', changeDetection: ChangeDetectionStrategy.OnPush, }) export class UpdatePasswordFormComponent implements OnInit { /** * Submit the form data to trigger the request for a password change. */ @Output() submitPassword = new EventEmitter<{ password: string }>(); updatePasswordForm = new FormGroup({}); fields: FormlyFieldConfig[]; private submitted = false; ngOnInit() { this.fields = [ { validators: { validation: [SpecialValidators.equalTo('passwordConfirmation', 'password')], }, fieldGroup: [ { key: 'password', type: 'ish-password-field', props: { postWrappers: [{ wrapper: 'description', index: -1 }], required: true, hideRequiredMarker: true, label: 'account.register.password.label', customDescription: { key: 'account.register.password.extrainfo.message', args: { 0: '7' }, }, }, validation: { messages: { minLength: 'account.update_password.new_password.error.length', }, }, }, { key: 'passwordConfirmation', type: 'ish-text-input-field', props: { type: 'password', required: true, hideRequiredMarker: true, label: 'account.register.password_confirmation.label', }, validation: { messages: { required: 'account.register.password_confirmation.error.default', equalTo: 'form.password.error.equalTo', }, }, }, ], }, ]; } submitPasswordForm() { if (this.updatePasswordForm.invalid) { this.submitted = true; markAsDirtyRecursive(this.updatePasswordForm); return; } this.submitPassword.emit({ password: this.updatePasswordForm.get('password').value, }); } get buttonDisabled() { return this.updatePasswordForm.invalid && this.submitted; } } |