diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts index 3eca07061a..d0674047d1 100644 --- a/src/app/app-routing.module.ts +++ b/src/app/app-routing.module.ts @@ -45,6 +45,13 @@ export function getProfileModulePath() { return `/${PROFILE_MODULE_PATH}`; } +const REGISTER_PATH = 'register'; + +export function getRegisterPath() { + return `/${REGISTER_PATH}`; + +} + const WORKFLOW_ITEM_MODULE_PATH = 'workflowitems'; export function getWorkflowItemModulePath() { @@ -71,7 +78,7 @@ export function getDSOPath(dso: DSpaceObject): string { { path: 'community-list', loadChildren: './community-list-page/community-list-page.module#CommunityListPageModule' }, { path: 'id', loadChildren: './+lookup-by-id/lookup-by-id.module#LookupIdModule' }, { path: 'handle', loadChildren: './+lookup-by-id/lookup-by-id.module#LookupIdModule' }, - { path: 'register', loadChildren: './register-page/register-page.module#RegisterPageModule' }, + { path: REGISTER_PATH, loadChildren: './register-page/register-page.module#RegisterPageModule' }, { path: COMMUNITY_MODULE_PATH, loadChildren: './+community-page/community-page.module#CommunityPageModule' }, { path: COLLECTION_MODULE_PATH, loadChildren: './+collection-page/collection-page.module#CollectionPageModule' }, { path: ITEM_MODULE_PATH, loadChildren: './+item-page/item-page.module#ItemPageModule' }, diff --git a/src/app/register-page/create-profile/confirmed.validator.spec.ts b/src/app/register-page/create-profile/confirmed.validator.spec.ts index e178abea2a..9bbbda9f29 100644 --- a/src/app/register-page/create-profile/confirmed.validator.spec.ts +++ b/src/app/register-page/create-profile/confirmed.validator.spec.ts @@ -15,7 +15,7 @@ describe('ConfirmedValidator', () => { }); })); - it('should validate a language according to the iso-639-1 standard', fakeAsync(() => { + it('should validate that the password and confirm password match', fakeAsync(() => { passwordForm.get('password').patchValue('test-password'); passwordForm.get('confirmPassword').patchValue('test-password-mismatch'); @@ -23,7 +23,7 @@ describe('ConfirmedValidator', () => { expect(passwordForm.valid).toBe(false); })); - it('should invalidate a language that does not comply to the iso-639-1 standard', fakeAsync(() => { + it('should invalidate that the password and confirm password match', fakeAsync(() => { passwordForm.get('password').patchValue('test-password'); passwordForm.get('confirmPassword').patchValue('test-password'); diff --git a/src/app/register-page/create-profile/create-profile.component.ts b/src/app/register-page/create-profile/create-profile.component.ts index 715ec5031d..947a8ac1ef 100644 --- a/src/app/register-page/create-profile/create-profile.component.ts +++ b/src/app/register-page/create-profile/create-profile.component.ts @@ -142,11 +142,13 @@ export class CreateProfileComponent implements OnInit { const eperson = Object.assign(new EPerson(), values); this.ePersonDataService.createEPersonForToken(eperson, this.token).subscribe((response) => { if (response.isSuccessful) { - this.notificationsService.success('register-page.create-profile.submit.success.head', 'register-page.create-profile.submit.success.content'); + this.notificationsService.success(this.translateService.get('register-page.create-profile.submit.success.head'), + this.translateService.get('register-page.create-profile.submit.success.content')); this.store.dispatch(new AuthenticateAction(this.email, this.password.value)); this.router.navigate(['/home']); } else { - this.notificationsService.error('register-page.create-profile.submit.error.head', 'register-page.create-profile.submit.error.content'); + this.notificationsService.error(this.translateService.get('register-page.create-profile.submit.error.head'), + this.translateService.get('register-page.create-profile.submit.error.content')); } }); diff --git a/src/app/shared/log-in/log-in.component.html b/src/app/shared/log-in/log-in.component.html index 8e23f00d9b..2d52bf79bb 100644 --- a/src/app/shared/log-in/log-in.component.html +++ b/src/app/shared/log-in/log-in.component.html @@ -8,6 +8,6 @@ - {{"login.form.new-user" | translate}} + {{"login.form.new-user" | translate}} {{"login.form.forgot-password" | translate}} diff --git a/src/app/shared/log-in/log-in.component.spec.ts b/src/app/shared/log-in/log-in.component.spec.ts index 0167d61686..a9a42bf3dd 100644 --- a/src/app/shared/log-in/log-in.component.spec.ts +++ b/src/app/shared/log-in/log-in.component.spec.ts @@ -1,7 +1,7 @@ import { Component, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'; import { async, ComponentFixture, inject, TestBed } from '@angular/core/testing'; import { By } from '@angular/platform-browser'; -import { Store, StoreModule } from '@ngrx/store'; +import { StoreModule } from '@ngrx/store'; import { LogInComponent } from './log-in.component'; import { authReducer } from '../../core/auth/auth.reducer'; @@ -13,11 +13,11 @@ import { FormsModule, ReactiveFormsModule } from '@angular/forms'; import { SharedModule } from '../shared.module'; import { NativeWindowMockFactory } from '../mocks/mock-native-window-ref'; import { ActivatedRouteStub } from '../testing/active-router.stub'; -import { ActivatedRoute, Router } from '@angular/router'; -import { RouterStub } from '../testing/router.stub'; +import { ActivatedRoute } from '@angular/router'; import { NativeWindowService } from '../../core/services/window.service'; import { provideMockStore } from '@ngrx/store/testing'; import { createTestComponent } from '../testing/utils.test'; +import { RouterTestingModule } from '@angular/router/testing'; describe('LogInComponent', () => { @@ -46,6 +46,7 @@ describe('LogInComponent', () => { strictActionImmutability: false } }), + RouterTestingModule, SharedModule, TranslateModule.forRoot() ], @@ -55,7 +56,7 @@ describe('LogInComponent', () => { providers: [ { provide: AuthService, useClass: AuthServiceStub }, { provide: NativeWindowService, useFactory: NativeWindowMockFactory }, - { provide: Router, useValue: new RouterStub() }, + // { provide: Router, useValue: new RouterStub() }, { provide: ActivatedRoute, useValue: new ActivatedRouteStub() }, provideMockStore({ initialState }), LogInComponent diff --git a/src/app/shared/log-in/log-in.component.ts b/src/app/shared/log-in/log-in.component.ts index 92350de442..6634389c26 100644 --- a/src/app/shared/log-in/log-in.component.ts +++ b/src/app/shared/log-in/log-in.component.ts @@ -8,6 +8,7 @@ import { AuthMethod } from '../../core/auth/models/auth.method'; import { getAuthenticationMethods, isAuthenticated, isAuthenticationLoading } from '../../core/auth/selectors'; import { CoreState } from '../../core/core.reducers'; import { AuthService } from '../../core/auth/auth.service'; +import { getRegisterPath } from '../../app-routing.module'; /** * /users/sign-in @@ -82,4 +83,7 @@ export class LogInComponent implements OnInit, OnDestroy { this.alive = false; } + getRegisterPath() { + return getRegisterPath(); + } } diff --git a/src/assets/i18n/en.json5 b/src/assets/i18n/en.json5 index 67290ed2e3..a07f4fbbae 100644 --- a/src/assets/i18n/en.json5 +++ b/src/assets/i18n/en.json5 @@ -2068,13 +2068,13 @@ "register-page.create-profile.submit": "Complete Registration", - "register-page.create-profile.submit.error.content": "Registration failed", + "register-page.create-profile.submit.error.content": "Something went wrong while registering a new user.", - "register-page.create-profile.submit.error.head": "Something went wrong while registering a new user.", + "register-page.create-profile.submit.error.head": "Registration failed", - "register-page.create-profile.submit.success.content": "Registration completed", + "register-page.create-profile.submit.success.content": "The registration was successful. You have been logged in as the created user.", - "register-page.create-profile.submit.success.head": "The registration was successful. You have been logged in as the created user.", + "register-page.create-profile.submit.success.head": "Registration completed", "register-page.registration.header": "New user registration",