70504: Implement feedback

This commit is contained in:
Yana De Pauw
2020-05-15 14:41:14 +02:00
parent 96d76073ef
commit bca1e8bdd4
7 changed files with 28 additions and 14 deletions

View File

@@ -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' },

View File

@@ -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');

View File

@@ -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'));
}
});

View File

@@ -8,6 +8,6 @@
</ng-container>
<div class="dropdown-divider"></div>
<a class="dropdown-item" href="#">{{"login.form.new-user" | translate}}</a>
<a class="dropdown-item" [routerLink]="[getRegisterPath()]">{{"login.form.new-user" | translate}}</a>
<a class="dropdown-item" href="#">{{"login.form.forgot-password" | translate}}</a>
</div>

View File

@@ -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

View File

@@ -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();
}
}

View File

@@ -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",