Skip to content

Commit

Permalink
Merge pull request #2143 from ORCID/fix/9035-registration-unclaimed-d…
Browse files Browse the repository at this point in the history
…eactivated-and-existing-record-notice-panels

feature: Update duplicate, unclaimed and deactivated error message
  • Loading branch information
leomendoza123 authored Jan 25, 2024
2 parents e5e29bf + 3a5668b commit 3c5dbdb
Show file tree
Hide file tree
Showing 23 changed files with 131 additions and 94 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
<ng-container *ngIf="recognizedError[errorCode] === 0">
<ng-container *ngIf="
recognizedError[errorCode] === 0 ||
recognizedError[errorCode] === 3 ||
recognizedError[errorCode] === 4
">
<ng-container
*ngIf="
(showEmailAlreadyExistUntilNextButtonWasClicked &&
Expand All @@ -7,8 +11,8 @@
"
>
<ng-container i18n="@@register.emailIsAlreadyAssociated"
>This email is already associated with an existing ORCID record. Please
use a different email address.</ng-container
>This email is already associated with an existing ORCID record. Please use a different email address to continue registering a new ORCID iD.
</ng-container
>
</ng-container>
</ng-container>
Expand All @@ -27,24 +31,5 @@
Additional emails cannot be duplicated
</ng-container>

<ng-container *ngIf="recognizedError[errorCode] === 3">
<ng-container i18n="@@ngOrcid.signin.unclaimedExists1"
>The ORCID record exists but has not been claimed. Would you like
to</ng-container
>

<a (click)="navigateToClaim(value)" i18n="@@ngOrcid.signin.unclaimedExists2"
>resend the claim email?</a
>
</ng-container>

<ng-container *ngIf="recognizedError[errorCode] === 4">
<ng-container i18n="@@register.deactivated">
A deactivated ORCID record is associated with this email address.
</ng-container>
<a (click)="reactivateEmail(value)" i18n="@@register.resendReactivate"
>click here to reactivate</a
>
</ng-container>

<ng-container *ngIf="unrecognizedError"> {{ errorCode }} </ng-container>
Original file line number Diff line number Diff line change
@@ -1,26 +1,10 @@
import { Component, Input, OnInit, Inject } from '@angular/core'
import { Component, Input, OnInit } from '@angular/core'
import { Router } from '@angular/router'
import { take } from 'rxjs/operators'
import { PlatformInfoService } from 'src/app/cdk/platform-info'
import { SnackbarService } from 'src/app/cdk/snackbar/snackbar.service'
import { ApplicationRoutes } from 'src/app/constants'
import { ErrorHandlerService } from 'src/app/core/error-handler/error-handler.service'
import { SignInService } from 'src/app/core/sign-in/sign-in.service'
import { ERROR_REPORT } from 'src/app/errors'
import { WINDOW } from 'src/app/cdk/window'
import { RegisterBackendErrors } from 'src/app/types/register.local'
import { TogglzService } from '../../../core/togglz/togglz.service'

// When the error text is not listed on the RegisterBackendErrors enum
// the error message will be displayed as it comes from the backend
// This is because the backend might return code or a text ready for the UI
enum RegisterBackendErrors {
'orcid.frontend.verify.duplicate_email',
'additionalEmailCantBePrimaryEmail',
'duplicatedAdditionalEmail',
'orcid.frontend.verify.unclaimed_email',
'orcid.frontend.verify.deactivated_email',
}

@Component({
selector: 'app-backend-error',
templateUrl: './backend-error.component.html',
Expand Down Expand Up @@ -50,11 +34,7 @@ export class BackendErrorComponent implements OnInit {
constructor(
private _platformInfo: PlatformInfoService,
private _router: Router,
private _snackbar: SnackbarService,
private _signIn: SignInService,
private _errorHandler: ErrorHandlerService,
private _togglz: TogglzService,
@Inject(WINDOW) private window: Window
) {}
ngOnInit() {
this._togglz
Expand All @@ -66,11 +46,6 @@ export class BackendErrorComponent implements OnInit {
}
}

navigateToClaim(email) {
email = encodeURIComponent(email)
this.window.location.href = `/resend-claim?email=${email}`
}

navigateToSignin(email) {
this._platformInfo
.get()
Expand All @@ -83,28 +58,4 @@ export class BackendErrorComponent implements OnInit {
})
})
}

reactivateEmail(email) {
const $deactivate = this._signIn.reactivation(email)
$deactivate.subscribe((data) => {
if (data.error) {
this._errorHandler
.handleError(
new Error(data.error),
ERROR_REPORT.REGISTER_REACTIVATED_EMAIL
)
.subscribe()
} else {
this._snackbar.showSuccessMessage({
title: $localize`:@@register.reactivating:Reactivating your account`,
// tslint:disable-next-line: max-line-length
message: $localize`:@@ngOrcid.signin.verify.reactivationSent:Thank you for reactivating your ORCID record; please complete the process by following the steps in the email we are now sending you. If you don’t receive an email from us, please`,
action: $localize`:@@shared.contactSupport:contact support.`,
actionURL: `https://support.orcid.org/`,
closable: true,
})
this._router.navigate([ApplicationRoutes.signin])
}
})
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -177,19 +177,47 @@ <h3 i18n="@@register.yourEmailAddresses" class="orc-font-body margin-top-12">
The email address
</ng-container>
<strong>{{ emails.get('email').value }}</strong>
<ng-container i18n="@@register.isAssociatedWuthAnExisting"
>is associated with an existing ORCID record.
<ng-container i18n="@@register.isAssociatedWith"
>is already associated with
</ng-container>
<ng-container *ngIf="'orcid.frontend.verify.duplicate_email' === error" i18n="@@register.anExisting"
>an existing
</ng-container>
<ng-container *ngIf="'orcid.frontend.verify.unclaimed_email' === error" i18n="@@register.anUnclaimed"
>an unclaimed
</ng-container>
<ng-container *ngIf="'orcid.frontend.verify.deactivated_email' === error" i18n="@@register.aDeactivated"
>a deactivated
</ng-container>
<ng-container i18n="@@register.orcidRecord">ORCID record</ng-container>
<i i18n="@@register.youCannotUseThisEmail">
You cannot use this email address when creating a new ORCID iD.
</i>
</p>
</div>

<div>
<a
*ngIf="'orcid.frontend.verify.duplicate_email' === error"
(click)="navigateToSignin(emails.get('email').value)"
i18n="@@register.signInToOrcidUsingThisEmail"
>
Sign in to ORCID using this email address</a
>
<a
*ngIf="'orcid.frontend.verify.unclaimed_email' === error"
(click)="navigateToClaim(emails.get('email').value)"
i18n="@@register.resendClaimAddress"
>
Resend a claim email to this email address</a
>
<a
*ngIf="'orcid.frontend.verify.deactivated_email' === error"
(click)="reactivateEmail(emails.get('email').value)"
i18n="@@register.reactivateOrcidAssociated"
>
Reactivate the ORCID record associated with this email address</a
>
</div>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {
Component,
ElementRef,
forwardRef,
Inject,
Input,
OnInit,
ViewChild,
Expand Down Expand Up @@ -39,6 +40,12 @@ import { Router } from '@angular/router'
import { ApplicationRoutes } from 'src/app/constants'
import { LiveAnnouncer } from '@angular/cdk/a11y'
import { environment } from 'src/environments/environment'
import { RegisterBackendErrors } from 'src/app/types/register.local'
import { WINDOW } from 'src/app/cdk/window'
import { SnackbarService } from 'src/app/cdk/snackbar/snackbar.service'
import { SignInService } from 'src/app/core/sign-in/sign-in.service'
import { ErrorHandlerService } from 'src/app/core/error-handler/error-handler.service'
import { ERROR_REPORT } from 'src/app/errors'
export class MyErrorStateMatcher implements ErrorStateMatcher {
isErrorState(
control: FormControl | null,
Expand Down Expand Up @@ -93,12 +100,18 @@ export class FormPersonalComponent extends BaseForm implements OnInit {
personalEmail: boolean
undefinedEmail: boolean
emailsAreValidAlreadyChecked: boolean
registerBackendErrors: RegisterBackendErrors

constructor(
private _register: Register2Service,
private _reactivationService: ReactivationService,
private _platform: PlatformInfoService,
private _router: Router,
private _liveAnnouncer: LiveAnnouncer
private _liveAnnouncer: LiveAnnouncer,
private _snackbar: SnackbarService,
private _signIn: SignInService,
private _errorHandler: ErrorHandlerService,
@Inject(WINDOW) private window: Window
) {
super()
}
Expand Down Expand Up @@ -318,4 +331,33 @@ export class FormPersonalComponent extends BaseForm implements OnInit {
})
})
}

navigateToClaim(email) {
email = encodeURIComponent(email)
this.window.location.href = `/resend-claim?email=${email}`
}

reactivateEmail(email) {
const $deactivate = this._signIn.reactivation(email)
$deactivate.subscribe((data) => {
if (data.error) {
this._errorHandler
.handleError(
new Error(data.error),
ERROR_REPORT.REGISTER_REACTIVATED_EMAIL
)
.subscribe()
} else {
this._snackbar.showSuccessMessage({
title: $localize`:@@register.reactivating:Reactivating your account`,
// tslint:disable-next-line: max-line-length
message: $localize`:@@ngOrcid.signin.verify.reactivationSent:Thank you for reactivating your ORCID record; please complete the process by following the steps in the email we are now sending you. If you don’t receive an email from us, please`,
action: $localize`:@@shared.contactSupport:contact support.`,
actionURL: `https://support.orcid.org/`,
closable: true,
})
this._router.navigate([ApplicationRoutes.signin])
}
})
}
}
10 changes: 10 additions & 0 deletions src/app/types/register.local.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// When the error text is not listed on the RegisterBackendErrors enum
// the error message will be displayed as it comes from the backend
// This is because the backend might return code or a text ready for the UI
export enum RegisterBackendErrors {
'orcid.frontend.verify.duplicate_email',
'additionalEmailCantBePrimaryEmail',
'duplicatedAdditionalEmail',
'orcid.frontend.verify.unclaimed_email',
'orcid.frontend.verify.deactivated_email'
}
1 change: 0 additions & 1 deletion src/locale/properties/register/register.ar.properties
Original file line number Diff line number Diff line change
Expand Up @@ -189,4 +189,3 @@ register.emailAreNotValid=رسائل البريد الإلكتروني الخا
register.Email=بريد الكتروني
register.VisibilityParties=المنظمات والأفراد الموثوق بهم
register.emailPlaceholder=عنوان البريد الإلكتروني الذي تستخدمه كثيرًا
register.emailIsAlreadyAssociated=هذا البريد الإلكتروني مرتبط بالفعل بسجل ORCID موجود. يُرجى استخدام عنوان بريد إلكتروني مختلف.
1 change: 0 additions & 1 deletion src/locale/properties/register/register.cs.properties
Original file line number Diff line number Diff line change
Expand Up @@ -189,4 +189,3 @@ register.emailAreNotValid=Vaše e-maily se neshodují
register.Email=Email
register.VisibilityParties=Důvěryhodné strany
register.emailPlaceholder=E-mailová adresa, kterou používáte nejčastěji
register.emailIsAlreadyAssociated=Tato e-mailová adresa je již spojena se stávajícím záznamem ORCID. Použijte jinou e-mailovou adresu.
1 change: 0 additions & 1 deletion src/locale/properties/register/register.de.properties
Original file line number Diff line number Diff line change
Expand Up @@ -189,4 +189,3 @@ register.emailAreNotValid=Ihre E-Mail-Adressen stimmen nicht überein.
register.Email=E-Mail-Adresse
register.VisibilityParties=Vertrauenswürdige Parteien
register.emailPlaceholder=Ihre am häufigsten verwendete E-Mail-Adresse
register.emailIsAlreadyAssociated=Diese E-Mail-Adresse ist bereits mit einem existierenden ORCID-Eintrag verknüpft. Bitte verwenden Sie eine andere E-Mail-Adresse.
10 changes: 9 additions & 1 deletion src/locale/properties/register/register.en.properties
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,6 @@ register.emailAreNotValid=Your emails do not match
register.Email=Email
register.VisibilityParties=Trusted parties
register.emailPlaceholder=The email address you use most
register.emailIsAlreadyAssociated=This email is already associated with an existing ORCID record. Please use a different email address.
register.roleJobTitle=Role/Job title
register.department=Department
register.weCantIdentifyThisOrganization=We can’t identify this organization. Please try entering the organization name again.
Expand All @@ -206,3 +205,12 @@ register.yearPlaceholder=Year
register.monthPlaceholder=Month
register.clearOrganization=Clear organization
shared.skipThisStepWithoutAddingAnAffiliation=Skip this step without adding an affiliation
register.isAssociatedWith=is already associated with
register.anExisting=an existing
register.anUnclaimed=an unclaimed
register.aDeactivated=a deactivated
register.orcidRecord=ORCID record
register.youCannotUseThisEmail=You cannot use this email address when creating a new ORCID iD.
register.emailIsAlreadyAssociated=This email is already associated with an existing ORCID record. Please use a different email address to continue registering a new ORCID iD.
register.resendClaimAddress=Resend a claim email to this email address
register.reactivateOrcidAssociated=Reactivate the ORCID record associated with this email address
1 change: 0 additions & 1 deletion src/locale/properties/register/register.es.properties
Original file line number Diff line number Diff line change
Expand Up @@ -189,4 +189,3 @@ register.emailAreNotValid=Sus correos electrónicos no coinciden
register.Email=Correo electrónico
register.VisibilityParties=Partes de confianza
register.emailPlaceholder=La dirección de correo electrónico que más usa
register.emailIsAlreadyAssociated=Este correo electrónico ya está asociado a un registro ORCID existente. Use otra dirección de correo electrónico.
1 change: 0 additions & 1 deletion src/locale/properties/register/register.fr.properties
Original file line number Diff line number Diff line change
Expand Up @@ -189,4 +189,3 @@ register.emailAreNotValid=Vos adresses e-mail ne correspondent pas
register.Email=Email
register.VisibilityParties=Parties de confiance
register.emailPlaceholder=L'adresse e-mail que vous utilisez le plus
register.emailIsAlreadyAssociated=Cette adresse e-mail est déjà associée à un dossier ORCID existant. Utilisez une autre adresse e-mail.
1 change: 0 additions & 1 deletion src/locale/properties/register/register.it.properties
Original file line number Diff line number Diff line change
Expand Up @@ -189,4 +189,3 @@ register.emailAreNotValid=Le email non corrispondono
register.Email=Indirizzo email
register.VisibilityParties=Parti fidate
register.emailPlaceholder=L’indirizzo email che usi di più
register.emailIsAlreadyAssociated=Questa email è già associata a un record ORCID esistente. Usa un indirizzo email diverso.
1 change: 0 additions & 1 deletion src/locale/properties/register/register.ja.properties
Original file line number Diff line number Diff line change
Expand Up @@ -189,4 +189,3 @@ register.emailAreNotValid=メールアドレスが一致しません
register.Email=電子メール
register.VisibilityParties=トラステッド・パーティー
register.emailPlaceholder=最もよく使用するメールアドレス
register.emailIsAlreadyAssociated=このメールアドレスは既に既存のORCIDレコードに関連付けられています。別のメールアドレスを使用してください。
1 change: 0 additions & 1 deletion src/locale/properties/register/register.ko.properties
Original file line number Diff line number Diff line change
Expand Up @@ -189,4 +189,3 @@ register.emailAreNotValid=이메일 불일치
register.Email=이메일
register.VisibilityParties=제한공개
register.emailPlaceholder=가장 자주 사용하는 이메일 주소
register.emailIsAlreadyAssociated=이 이메일 주소가 기존 ORCID 레코드에 연결되어 있습니다. 다른 이메일 주소를 사용하십시오.
11 changes: 10 additions & 1 deletion src/locale/properties/register/register.lr.properties
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,6 @@ register.emailAreNotValid=LR
register.confirmYourPassword=LR
register.VisibilityParties=LR
register.emailPlaceholder=LR
register.emailIsAlreadyAssociated=LR
register.step1.3=LR
register.step3.3=LR
register.step4.3=LR
Expand All @@ -211,3 +210,13 @@ register.yearPlaceholder=LR
register.monthPlaceholder=LR
register.clearOrganization=LR
shared.skipThisStepWithoutAddingAnAffiliation=LR
register.emailIsAlreadyAssociated=LR
register.isAssociatedWith=LR
register.anExisting=LR
register.anUnclaimed=LR
register.aDeactivated=LR
register.orcidRecord=LR
register.youCannotUseThisEmail=LR
register.emailIsAlreadyAssociated=LR
register.resendClaimAddress=LR
register.reactivateOrcidAssociated=LR
1 change: 0 additions & 1 deletion src/locale/properties/register/register.pl.properties
Original file line number Diff line number Diff line change
Expand Up @@ -189,4 +189,3 @@ register.emailAreNotValid=Twoje adresy e-mail nie pasują
register.Email=Adres e-mail
register.VisibilityParties=Zaufane strony
register.emailPlaceholder=Adresy e-mail, z których najczęściej korzystasz
register.emailIsAlreadyAssociated=Ten adres e-mail jest już połączony z istniejącym rekordem ORCID. Użyj innego adresu e-mail.
1 change: 0 additions & 1 deletion src/locale/properties/register/register.pt.properties
Original file line number Diff line number Diff line change
Expand Up @@ -189,4 +189,3 @@ register.emailAreNotValid=Os e-mails não correspondem
register.Email=E-mail
register.VisibilityParties=Partes confiáveis
register.emailPlaceholder=O endereço de e-mail que utiliza mais
register.emailIsAlreadyAssociated=Este e-mail já está associado a um registo ORCID existente. Utilize um endereço de e-mail diferente.
11 changes: 10 additions & 1 deletion src/locale/properties/register/register.rl.properties
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,6 @@ register.emailAreNotValid=RL
register.confirmYourPassword=RL
register.VisibilityParties=RL
register.emailPlaceholder=RL
register.emailIsAlreadyAssociated=RL
register.step1.3=RL
register.step3.3=RL
register.step4.3=RL
Expand All @@ -211,3 +210,13 @@ register.yearPlaceholder=RL
register.monthPlaceholder=RL
register.clearOrganization=RL
shared.skipThisStepWithoutAddingAnAffiliation=RL
register.emailIsAlreadyAssociated=RL
register.isAssociatedWith=RL
register.anExisting=RL
register.anUnclaimed=RL
register.aDeactivated=RL
register.orcidRecord=RL
register.youCannotUseThisEmail=RL
register.emailIsAlreadyAssociated=RL
register.resendClaimAddress=RL
register.reactivateOrcidAssociated=RL
1 change: 0 additions & 1 deletion src/locale/properties/register/register.ru.properties
Original file line number Diff line number Diff line change
Expand Up @@ -189,4 +189,3 @@ register.emailAreNotValid=Адреса эл. почты не совпадают.
register.Email=Адрес электронной почты
register.VisibilityParties=Доверенные лица
register.emailPlaceholder=Адрес эл. почты, которым вы пользуетесь чаще всего
register.emailIsAlreadyAssociated=Этот адрес эл. почты уже связан с существующим профилем ORCID. Укажите другой.
1 change: 0 additions & 1 deletion src/locale/properties/register/register.tr.properties
Original file line number Diff line number Diff line change
Expand Up @@ -189,4 +189,3 @@ register.emailAreNotValid=E-postalarınız eşleşmiyor
register.Email=E-posta
register.VisibilityParties=Güvenilen taraflar
register.emailPlaceholder=En çok kullandığınız e-posta adresleri
register.emailIsAlreadyAssociated=Bu e-posta adresi zaten mevcut bir ORCID kaydıyla ilişkili durumda. Lütfen farklı bir e-posta adresi kullanın.
Loading

0 comments on commit 3c5dbdb

Please sign in to comment.