Skip to content

Commit

Permalink
fix: email and password confirmation fields should only validate the …
Browse files Browse the repository at this point in the history
…equality with its related input field
  • Loading branch information
Eisie96 committed Mar 20, 2023
1 parent 9dafd3f commit 58aa313
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,9 @@ export class PunchoutUserFormComponent implements OnInit {
},
{
key: 'passwordConfirmation',
type: 'ish-password-field',
type: 'ish-text-input-field',
props: {
type: 'password',
required: this.punchoutUser ? false : true,
label: this.punchoutUser
? 'account.punchout.password.new.confirmation.label'
Expand All @@ -104,6 +105,7 @@ export class PunchoutUserFormComponent implements OnInit {
validation: {
messages: {
required: 'account.punchout.password.confirmation.error.required',
equalTo: 'form.password.error.equalTo',
},
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ export class AccountProfileEmailComponent implements OnInit {

{
key: 'emailConfirmation',
type: 'ish-email-field',

type: 'ish-text-input-field',
props: {
type: 'email',
hideRequiredMarker: true,
required: true,
label: 'account.update_email.email_confirmation.label',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,21 +67,22 @@ export class AccountProfilePasswordComponent implements OnInit, OnChanges {
key: 'account.register.password.extrainfo.message',
args: { 0: '7' },
},

attributes: { autocomplete: 'new-password' },
},
},
{
key: 'passwordConfirmation',
type: 'ish-password-field',
type: 'ish-text-input-field',
props: {
type: 'password',
required: true,
hideRequiredMarker: true,
label: 'account.update_password.newpassword_confirmation.label',
},
validation: {
messages: {
required: 'account.register.password_confirmation.error.default',
equalTo: 'form.password.error.equalTo',
},
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ describe('Update Password Form Component', () => {
it('should render forgot password form step 2 for password reminder', () => {
fixture.detectChanges();

expect(element.innerHTML.match(/ish-password-field/g)).toHaveLength(2);
expect(element.innerHTML.match(/ish-password-field/g)).toHaveLength(1);
expect(element.innerHTML).toContain('password');
expect(element.innerHTML).toContain('passwordConfirmation');

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,17 @@ export class UpdatePasswordFormComponent implements OnInit {
},
{
key: 'passwordConfirmation',
type: 'ish-password-field',
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',
},
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -241,18 +241,19 @@ export class RegistrationFormConfigurationService {
},
{
key: 'loginConfirmation',
type: 'ish-email-field',
type: 'ish-text-input-field',
props: {
type: 'email',
label: 'account.register.email_confirmation.label',
required: true,
},
validation: {
messages: {
required: 'form.email.error.required',
equalTo: 'account.registration.email.not_match.error',
},
},
},

{
key: 'password',
type: 'ish-password-field',
Expand All @@ -269,16 +270,17 @@ export class RegistrationFormConfigurationService {
},
{
key: 'passwordConfirmation',
type: 'ish-password-field',
type: 'ish-text-input-field',
props: {
type: 'password',
required: true,
label: 'account.register.password_confirmation.label',

attributes: { autocomplete: 'new-password' },
},
validation: {
messages: {
required: 'account.register.password_confirmation.error.default',
equalTo: 'form.password.error.equalTo',
},
},
},
Expand Down
1 change: 0 additions & 1 deletion src/app/shared/formly/types/types.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,6 @@ const fieldComponents = [
messages: {
password: 'form.password.error.invalid',
required: 'form.password.error.required',
equalTo: 'form.password.error.equalTo',
},
},
},
Expand Down

0 comments on commit 58aa313

Please sign in to comment.