diff --git a/src/app/external-log-in/email-confirmation/confirm-email/confirm-email.component.ts b/src/app/external-log-in/email-confirmation/confirm-email/confirm-email.component.ts index 5da1c93705..3e1befefbf 100644 --- a/src/app/external-log-in/email-confirmation/confirm-email/confirm-email.component.ts +++ b/src/app/external-log-in/email-confirmation/confirm-email/confirm-email.component.ts @@ -1,46 +1,18 @@ import { NgIf } from '@angular/common'; -import { - ChangeDetectionStrategy, - Component, - Inject, - Input, - OnDestroy, - OnInit, -} from '@angular/core'; -import { - FormBuilder, - FormGroup, - ReactiveFormsModule, - Validators, -} from '@angular/forms'; -import { - TranslateModule, - TranslateService, -} from '@ngx-translate/core'; +import { ChangeDetectionStrategy, Component, Inject, Input, OnDestroy, OnInit, } from '@angular/core'; +import { FormBuilder, FormGroup, ReactiveFormsModule, Validators, } from '@angular/forms'; +import { TranslateModule, TranslateService, } from '@ngx-translate/core'; import isEqual from 'lodash/isEqual'; -import { - combineLatest, - Subscription, - take, -} from 'rxjs'; +import { combineLatest, Subscription, take, } from 'rxjs'; import { AuthService } from '../../../core/auth/auth.service'; import { EPersonDataService } from '../../../core/eperson/eperson-data.service'; import { EPerson } from '../../../core/eperson/models/eperson.model'; import { HardRedirectService } from '../../../core/services/hard-redirect.service'; -import { - NativeWindowRef, - NativeWindowService, -} from '../../../core/services/window.service'; -import { - getFirstCompletedRemoteData, - getRemoteDataPayload, -} from '../../../core/shared/operators'; +import { NativeWindowRef, NativeWindowService, } from '../../../core/services/window.service'; +import { getFirstCompletedRemoteData, getRemoteDataPayload, } from '../../../core/shared/operators'; import { Registration } from '../../../core/shared/registration.model'; -import { - hasNoValue, - hasValue, -} from '../../../shared/empty.util'; +import { hasNoValue, hasValue, } from '../../../shared/empty.util'; import { NotificationsService } from '../../../shared/notifications/notifications.service'; import { ExternalLoginService } from '../../services/external-login.service'; @@ -56,6 +28,9 @@ import { ExternalLoginService } from '../../services/external-login.service'; ReactiveFormsModule, ], }) +/** + * Email confirmation component that will check for user email confirmation after account creation. + */ export class ConfirmEmailComponent implements OnInit, OnDestroy { /** * The form containing the email input diff --git a/src/app/external-log-in/email-confirmation/confirmation-sent/confirmation-sent.component.ts b/src/app/external-log-in/email-confirmation/confirmation-sent/confirmation-sent.component.ts index 5d6f2786cf..1abda02c4d 100644 --- a/src/app/external-log-in/email-confirmation/confirmation-sent/confirmation-sent.component.ts +++ b/src/app/external-log-in/email-confirmation/confirmation-sent/confirmation-sent.component.ts @@ -1,7 +1,4 @@ -import { - ChangeDetectionStrategy, - Component, -} from '@angular/core'; +import { ChangeDetectionStrategy, Component, } from '@angular/core'; import { TranslateModule } from '@ngx-translate/core'; @Component({ @@ -13,4 +10,7 @@ import { TranslateModule } from '@ngx-translate/core'; standalone: true, }) +/** + * Simple component that shows up a confirmation to the user. + */ export class ConfirmationSentComponent { } diff --git a/src/app/external-log-in/email-confirmation/provide-email/provide-email.component.html b/src/app/external-log-in/email-confirmation/provide-email/provide-email.component.html index 46e804e1c2..b369f3e807 100644 --- a/src/app/external-log-in/email-confirmation/provide-email/provide-email.component.html +++ b/src/app/external-log-in/email-confirmation/provide-email/provide-email.component.html @@ -8,7 +8,6 @@ type="email" id="email" formControlName="email" - placeholder="Input box" class="form-control form-control-lg position-relative" /> diff --git a/src/app/external-log-in/email-confirmation/provide-email/provide-email.component.spec.ts b/src/app/external-log-in/email-confirmation/provide-email/provide-email.component.spec.ts index 1e78b5a32a..dbd58d8a3c 100644 --- a/src/app/external-log-in/email-confirmation/provide-email/provide-email.component.spec.ts +++ b/src/app/external-log-in/email-confirmation/provide-email/provide-email.component.spec.ts @@ -1,14 +1,8 @@ import { CommonModule } from '@angular/common'; import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'; -import { - ComponentFixture, - TestBed, -} from '@angular/core/testing'; +import { ComponentFixture, TestBed, } from '@angular/core/testing'; import { FormBuilder } from '@angular/forms'; -import { - TranslateLoader, - TranslateModule, -} from '@ngx-translate/core'; +import { TranslateLoader, TranslateModule, } from '@ngx-translate/core'; import { TranslateLoaderMock } from '../../../shared/mocks/translate-loader.mock'; import { ExternalLoginService } from '../../services/external-login.service'; @@ -53,16 +47,16 @@ describe('ProvideEmailComponent', () => { expect(component).toBeTruthy(); }); - // it('should call externalLoginService.patchUpdateRegistration when form is submitted with valid email', () => { - // const email = 'test@example.com'; - // component.emailForm.setValue({ email }); - // component.registrationId = '123'; - // component.token = '456'; - // fixture.detectChanges(); + it('should call externalLoginService.patchUpdateRegistration when form is submitted with valid email', () => { + const email = 'test@example.com'; + component.emailForm.setValue({ email }); + component.registrationId = '123'; + component.token = '456'; + fixture.detectChanges(); - // const button = fixture.nativeElement.querySelector('button[type="submit"]'); - // button.click(); + const button = fixture.nativeElement.querySelector('button[type="submit"]'); + button.click(); - // expect(externalLoginServiceSpy.patchUpdateRegistration).toHaveBeenCalledWith([email], 'email', component.registrationId, component.token, 'add'); - // }); + expect(externalLoginServiceSpy.patchUpdateRegistration).toHaveBeenCalledWith([email], 'email', component.registrationId, component.token, 'add'); + }); }); diff --git a/src/app/external-log-in/email-confirmation/provide-email/provide-email.component.ts b/src/app/external-log-in/email-confirmation/provide-email/provide-email.component.ts index 0b88a9c573..50a84238e8 100644 --- a/src/app/external-log-in/email-confirmation/provide-email/provide-email.component.ts +++ b/src/app/external-log-in/email-confirmation/provide-email/provide-email.component.ts @@ -1,16 +1,6 @@ import { NgIf } from '@angular/common'; -import { - ChangeDetectionStrategy, - Component, - Input, - OnDestroy, -} from '@angular/core'; -import { - FormBuilder, - FormGroup, - ReactiveFormsModule, - Validators, -} from '@angular/forms'; +import { ChangeDetectionStrategy, Component, Input, OnDestroy, } from '@angular/core'; +import { FormBuilder, FormGroup, ReactiveFormsModule, Validators, } from '@angular/forms'; import { TranslateModule } from '@ngx-translate/core'; import { Subscription } from 'rxjs'; @@ -29,6 +19,9 @@ import { ExternalLoginService } from '../../services/external-login.service'; ], standalone: true, }) +/** + * This component provides a proper field to submit the email that will be updated for its registration token + */ export class ProvideEmailComponent implements OnDestroy { /** * The form group for the email input diff --git a/src/app/external-log-in/external-log-in/external-log-in.component.ts b/src/app/external-log-in/external-log-in/external-log-in.component.ts index 25bac19d85..24243d6885 100644 --- a/src/app/external-log-in/external-log-in/external-log-in.component.ts +++ b/src/app/external-log-in/external-log-in/external-log-in.component.ts @@ -1,23 +1,7 @@ -import { - NgComponentOutlet, - NgIf, -} from '@angular/common'; -import { - ChangeDetectionStrategy, - Component, - Injector, - Input, - OnDestroy, - OnInit, -} from '@angular/core'; -import { - NgbModal, - NgbModalRef, -} from '@ng-bootstrap/ng-bootstrap'; -import { - TranslateModule, - TranslateService, -} from '@ngx-translate/core'; +import { NgComponentOutlet, NgIf, } from '@angular/common'; +import { ChangeDetectionStrategy, Component, Injector, Input, OnDestroy, OnInit, } from '@angular/core'; +import { NgbModal, NgbModalRef, } from '@ng-bootstrap/ng-bootstrap'; +import { TranslateModule, TranslateService, } from '@ngx-translate/core'; import { AuthService } from '../../core/auth/auth.service'; import { AuthMethodType } from '../../core/auth/models/auth.method-type'; @@ -25,10 +9,7 @@ import { AuthRegistrationType } from '../../core/auth/models/auth.registration-t import { Registration } from '../../core/shared/registration.model'; import { AlertComponent } from '../../shared/alert/alert.component'; import { AlertType } from '../../shared/alert/alert-type'; -import { - hasValue, - isEmpty, -} from '../../shared/empty.util'; +import { hasValue, isEmpty, } from '../../shared/empty.util'; import { ThemedLogInComponent } from '../../shared/log-in/themed-log-in.component'; import { ExternalLoginTypeComponent, @@ -53,6 +34,9 @@ import { ProvideEmailComponent } from '../email-confirmation/provide-email/provi ], standalone: true, }) +/** + * This component is responsible to handle the external-login depending on the RegistrationData details provided + */ export class ExternalLogInComponent implements OnInit, OnDestroy { /** * The AlertType enumeration for access in the component's template diff --git a/src/app/external-log-in/registration-types/orcid-confirmation/orcid-confirmation.component.ts b/src/app/external-log-in/registration-types/orcid-confirmation/orcid-confirmation.component.ts index 909f17c2df..4b74b6b09e 100644 --- a/src/app/external-log-in/registration-types/orcid-confirmation/orcid-confirmation.component.ts +++ b/src/app/external-log-in/registration-types/orcid-confirmation/orcid-confirmation.component.ts @@ -1,15 +1,6 @@ import { NgIf } from '@angular/common'; -import { - ChangeDetectionStrategy, - Component, - Inject, - OnInit, -} from '@angular/core'; -import { - FormBuilder, - FormGroup, - ReactiveFormsModule, -} from '@angular/forms'; +import { ChangeDetectionStrategy, Component, Inject, OnInit, } from '@angular/core'; +import { FormBuilder, FormGroup, ReactiveFormsModule, } from '@angular/forms'; import { TranslateModule } from '@ngx-translate/core'; import { Registration } from '../../../core/shared/registration.model'; @@ -29,6 +20,9 @@ import { ExternalLoginMethodEntryComponent } from '../../decorators/external-log ], standalone: true, }) +/** + * This component is responsible to show the registered data inside the registration token to the user + */ export class OrcidConfirmationComponent extends ExternalLoginMethodEntryComponent implements OnInit { /** diff --git a/src/app/external-log-in/services/external-login.service.ts b/src/app/external-log-in/services/external-login.service.ts index fb9f9fd66f..365f3d6541 100644 --- a/src/app/external-log-in/services/external-login.service.ts +++ b/src/app/external-log-in/services/external-login.service.ts @@ -1,15 +1,8 @@ import { Injectable } from '@angular/core'; import { Router } from '@angular/router'; -import { - select, - Store, -} from '@ngrx/store'; +import { select, Store, } from '@ngrx/store'; import { TranslateService } from '@ngx-translate/core'; -import { - filter, - map, - Observable, -} from 'rxjs'; +import { filter, map, Observable, } from 'rxjs'; import { AuthMethod } from 'src/app/core/auth/models/auth.method'; import { getAuthenticationMethods } from 'src/app/core/auth/selectors'; import { CoreState } from 'src/app/core/core-state.model'; @@ -23,6 +16,10 @@ import { NotificationsService } from '../../shared/notifications/notifications.s @Injectable({ providedIn: 'root', }) +/** + * This service is responsible to communicate with the epersonRegistrationService to update the RegistrationData + * provided by the user. + */ export class ExternalLoginService { constructor( diff --git a/src/app/external-login-page/external-login-page.component.ts b/src/app/external-login-page/external-login-page.component.ts index 5a656159fd..709b86ab86 100644 --- a/src/app/external-login-page/external-login-page.component.ts +++ b/src/app/external-login-page/external-login-page.component.ts @@ -1,19 +1,8 @@ -import { - AsyncPipe, - NgIf, -} from '@angular/common'; -import { - Component, - OnInit, -} from '@angular/core'; +import { AsyncPipe, NgIf, } from '@angular/common'; +import { Component, OnInit, } from '@angular/core'; import { ActivatedRoute } from '@angular/router'; import { TranslateModule } from '@ngx-translate/core'; -import { - first, - map, - Observable, - tap, -} from 'rxjs'; +import { first, map, Observable, tap, } from 'rxjs'; import { RemoteData } from '../core/data/remote-data'; import { Registration } from '../core/shared/registration.model'; @@ -34,6 +23,9 @@ import { hasNoValue } from '../shared/empty.util'; ], standalone: true, }) +/** + * This component is a wrapper of the external-login component that loads up the RegistrationData. + */ export class ExternalLoginPageComponent implements OnInit { /** * The token used to get the registration data, diff --git a/src/app/external-login-review-account-info-page/external-login-review-account-info-page.component.ts b/src/app/external-login-review-account-info-page/external-login-review-account-info-page.component.ts index cc8ba6aa55..2425ce794e 100644 --- a/src/app/external-login-review-account-info-page/external-login-review-account-info-page.component.ts +++ b/src/app/external-login-review-account-info-page/external-login-review-account-info-page.component.ts @@ -1,18 +1,7 @@ -import { - AsyncPipe, - NgIf, -} from '@angular/common'; -import { - Component, - OnInit, -} from '@angular/core'; +import { AsyncPipe, NgIf, } from '@angular/common'; +import { Component, OnInit, } from '@angular/core'; import { ActivatedRoute } from '@angular/router'; -import { - first, - map, - Observable, - tap, -} from 'rxjs'; +import { first, map, Observable, tap, } from 'rxjs'; import { RemoteData } from '../core/data/remote-data'; import { Registration } from '../core/shared/registration.model'; @@ -32,6 +21,9 @@ import { ReviewAccountInfoComponent } from './review-account-info/review-account ], standalone: true, }) +/** + * This component is a wrapper for review-account-info component responsible to provide RegistrationData. + */ export class ExternalLoginReviewAccountInfoPageComponent implements OnInit { /** * The token used to get the registration data diff --git a/src/app/external-login-review-account-info-page/review-account-info/review-account-info.component.ts b/src/app/external-login-review-account-info-page/review-account-info/review-account-info.component.ts index f7ce0178d1..6c69233c7c 100644 --- a/src/app/external-login-review-account-info-page/review-account-info/review-account-info.component.ts +++ b/src/app/external-login-review-account-info-page/review-account-info/review-account-info.component.ts @@ -1,34 +1,10 @@ -import { - NgFor, - NgIf, - TitleCasePipe, -} from '@angular/common'; -import { - ChangeDetectionStrategy, - Component, - Inject, - Input, - OnDestroy, - OnInit, -} from '@angular/core'; +import { NgFor, NgIf, TitleCasePipe, } from '@angular/common'; +import { ChangeDetectionStrategy, Component, Inject, Input, OnDestroy, OnInit, } from '@angular/core'; import { Router } from '@angular/router'; import { NgbModal } from '@ng-bootstrap/ng-bootstrap'; -import { - TranslateModule, - TranslateService, -} from '@ngx-translate/core'; +import { TranslateModule, TranslateService, } from '@ngx-translate/core'; import { UiSwitchModule } from 'ngx-ui-switch'; -import { - combineLatest, - filter, - from, - map, - Observable, - Subscription, - switchMap, - take, - tap, -} from 'rxjs'; +import { combineLatest, filter, from, map, Observable, Subscription, switchMap, take, tap, } from 'rxjs'; import { AuthService } from '../../core/auth/auth.service'; import { AuthRegistrationType } from '../../core/auth/models/auth.registration-type'; @@ -36,10 +12,7 @@ import { RemoteData } from '../../core/data/remote-data'; import { EPersonDataService } from '../../core/eperson/eperson-data.service'; import { EPerson } from '../../core/eperson/models/eperson.model'; import { HardRedirectService } from '../../core/services/hard-redirect.service'; -import { - NativeWindowRef, - NativeWindowService, -} from '../../core/services/window.service'; +import { NativeWindowRef, NativeWindowService, } from '../../core/services/window.service'; import { Registration } from '../../core/shared/registration.model'; import { ExternalLoginService } from '../../external-log-in/services/external-login.service'; import { AlertComponent } from '../../shared/alert/alert.component'; @@ -73,6 +46,10 @@ export interface ReviewAccountInfoData { changeDetection: ChangeDetectionStrategy.OnPush, standalone: true, }) +/** + * This component shows up the difference between the current account details and the one provided by the + * Registration data. + */ export class ReviewAccountInfoComponent implements OnInit, OnDestroy { /** * The AlertType enumeration for access in the component's template diff --git a/src/assets/i18n/en.json5 b/src/assets/i18n/en.json5 index e06a1a0e32..75b74fcd70 100644 --- a/src/assets/i18n/en.json5 +++ b/src/assets/i18n/en.json5 @@ -6795,4 +6795,63 @@ "live-region.ordering.dropped": "{{ itemName }}, dropped at position {{ index }} of {{ length }}.", "dynamic-form-array.sortable-list.label": "Sortable list", + + "external-login.confirmation.header": "Information needed to complete the login process", + + "external-login.noEmail.informationText": "The information received from {{authMethod}} are not sufficient to complete the login process. Please provide the missing information below, or login via a different method to associate your {{authMethod}} to an existing account.", + + "external-login.haveEmail.informationText": "It seems that you have not yet an account in this system. If this is the case, please confirm the data received from {{authMethod}} and a new account will be created for you. Otherwise, if you already have an account in the system, please update the email address to match the one already in use in the system or login via a different method to associate your {{authMethod}} to your existing account.", + + "external-login.confirm-email.header": "Confirm or update email", + + "external-login.confirmation.email-required": "Email is required.", + + "external-login.confirmation.email-invalid": "Invalid email format.", + + "external-login.confirm.button.label": "Confirm this email", + + "external-login.confirm-email-sent.header": "Confirmation email sent", + + "external-login.confirm-email-sent.info": " We have sent an emait to the provided address to validate your input.
Please follow the instructions in the email to complete the login process.", + + "external-login.provide-email.header": "Provide email", + + "external-login.provide-email.button.label": "Send Verification link", + + "external-login-validation.review-account-info.header": "Review your account information", + + "external-login-validation.review-account-info.info": "The information received from ORCID differs from the one recorded in your profile.
Please review them and decide if you want to update any of them.After saving you will be redirected to your profile page.", + + "external-login-validation.review-account-info.table.header.information": "Information", + + "external-login-validation.review-account-info.table.header.received-value": "Received value", + + "external-login-validation.review-account-info.table.header.current-value": "Current value", + + "external-login-validation.review-account-info.table.header.action": "Override", + + "on-label": "ON", + + "off-label": "OFF", + + "review-account-info.merge-data.notification.success": "Your account information has been updated successfully", + + "review-account-info.merge-data.notification.error": "Something went wrong while updating your account information", + + "review-account-info.alert.error.content": "Something went wrong. Please try again later.", + + "external-login-page.provide-email.notifications.error": "Something went wrong.Email address was omitted or the operation is not valid.", + + "external-login.error.notification": "There was an error while processing your request. Please try again later.", + + "external-login.connect-to-existing-account.label": "Connect to an existing user", + + "external-login.modal.label.close": "Close", + + "external-login-page.provide-email.create-account.notifications.error.header": "Something went wrong", + + "external-login-page.provide-email.create-account.notifications.error.content": "Please check again your email address and try again.", + + "external-login-page.confirm-email.create-account.notifications.error.no-netId": "Something went wrong with this email account. Try again or use a different method to login." + }