Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix/batch-fixes-dec-5 #2107

Merged
merged 2 commits into from
Dec 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/app/core/register2/register2.form-adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,8 @@ export function Register2FormAdapterMixin<T extends Constructor<any>>(base: T) {
return {
...StepA.value.personal,
...StepB.value.password,
...StepC.value.sendOrcidNews,
...StepD.value.activitiesVisibilityDefault,
...StepC.value.activitiesVisibilityDefault,
...StepD.value.sendOrcidNews,
...StepD.value.termsOfUse,
...StepD.value.captcha,
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,10 @@ <h2 i18n="@@register.yourPasswords" class="orc-font-body no-top-margin">
appearance="outline"
[hideRequiredMarker]="true"
[ngClass]="{
'valid-password-input': confirmPasswordValid && passwordValid
'valid-password-input': passwordsValid
}"
>
<mat-icon *ngIf="confirmPasswordValid && passwordValid" matSuffix
>done</mat-icon
>
<mat-icon *ngIf="passwordsValid" matSuffix>done</mat-icon>
<input
aria-label="password-label"
formControlName="password"
Expand Down Expand Up @@ -77,12 +75,10 @@ <h2 i18n="@@register.yourPasswords" class="orc-font-body no-top-margin">
appearance="outline"
[hideRequiredMarker]="true"
[ngClass]="{
'valid-password-input': confirmPasswordValid && passwordValid
'valid-password-input': passwordsValid
}"
>
<mat-icon *ngIf="confirmPasswordValid && passwordValid" matSuffix
>done</mat-icon
>
<mat-icon *ngIf="passwordsValid" matSuffix>done</mat-icon>
<input
id="password-confirm-input-label"
formControlName="passwordConfirm"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ export class FormPasswordComponent extends BaseForm implements OnInit {
currentValidate8orMoreCharactersStatus: boolean
ccurentValidateAtLeastALetterOrSymbolStatus: boolean
currentValidateAtLeastANumber: boolean
passwordsValidAreValidAlreadyChecked: any
constructor(
private _register: Register2Service,
private _liveAnnouncer: LiveAnnouncer
Expand Down Expand Up @@ -138,6 +139,21 @@ export class FormPasswordComponent extends BaseForm implements OnInit {
return this.form.controls['password'].valid
}

get passwordsValid() {
const validStatus = this.confirmPasswordValid && this.passwordValid

if (!this.passwordsValidAreValidAlreadyChecked && validStatus) {
this.announce($localize`:@@register.passwordAreValid:Your password match`)
} else if (this.passwordsValidAreValidAlreadyChecked && !validStatus) {
this.announce(
$localize`:@@register.passwordAreNotValid:Your password do not match`
)
}
this.passwordsValidAreValidAlreadyChecked = validStatus

return validStatus
}

get validate8orMoreCharacters() {
const status =
this.form.hasError('required', 'password') ||
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ import { ErrorStateMatcher } from '@angular/material/core'
import { PlatformInfoService } from 'src/app/cdk/platform-info'
import { Router } from '@angular/router'
import { ApplicationRoutes } from 'src/app/constants'
import { LiveAnnouncer } from '@angular/cdk/a11y'
import { environment } from 'src/environments/environment'
export class MyErrorStateMatcher implements ErrorStateMatcher {
isErrorState(
control: FormControl | null,
Expand Down Expand Up @@ -89,11 +91,13 @@ export class FormPersonalComponent extends BaseForm implements OnInit {
professionalEmail: boolean
personalEmail: boolean
undefinedEmail: boolean
emailsAreValidAlreadyChecked: boolean
constructor(
private _register: Register2Service,
private _reactivationService: ReactivationService,
private _platform: PlatformInfoService,
private _router: Router
private _router: Router,
private _liveAnnouncer: LiveAnnouncer
) {
super()
}
Expand Down Expand Up @@ -266,7 +270,33 @@ export class FormPersonalComponent extends BaseForm implements OnInit {
}

get emailsAreValid() {
return this.emailConfirmationValid && this.emailValid
const validStatus = this.emailConfirmationValid && this.emailValid
if (!this.emailsAreValidAlreadyChecked && validStatus) {
this.announce(
$localize`:@@register.emailsAreValid:Your` +
' ' +
this.emails.controls['email'].value +
' ' +
$localize`:@@register.emailMatch:match`
)
} else if (this.emailsAreValidAlreadyChecked && !validStatus) {
this.announce(
$localize`:@@register.emailsAreValid:Your` +
' ' +
this.emails.controls['email'].value +
' ' +
$localize`:@@register.emailNotMatch:not match`
)
}
this.emailsAreValidAlreadyChecked = validStatus
return validStatus
}

private announce(announcement: string) {
if (environment.debugger) {
console.debug('📢' + announcement)
}
this._liveAnnouncer.announce(announcement, 'assertive')
}

navigateToSignin(email) {
Expand Down
5 changes: 5 additions & 0 deletions src/locale/properties/register/register.en.properties
Original file line number Diff line number Diff line change
Expand Up @@ -182,3 +182,8 @@ register.step2.3=Step 3 of 4 - Visibility
shared.previousStep=Previous Step
register.addAnAdditionalEmail=Add an additional email
register.personalEmail=personal email
register.passwordAreValid=Your password match
register.passwordAreNotValid=Your password do not match
register.emailsAreValid=Your
register.emailMatch=match
register.emailNotMatch=not match