Skip to content
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,7 @@ describe('EPersonFormComponent', () => {
let requireCertificate;

let expected;

beforeEach(() => {
firstName = 'testName';
lastName = 'testLastName';
Expand All @@ -386,11 +387,17 @@ describe('EPersonFormComponent', () => {
value: lastName,
},
],
'eperson.phone': [
{
value: null,
},
],
},
email: email,
canLogIn: canLogIn,
requireCertificate: requireCertificate,
});

spyOn(component.submitForm, 'emit');
component.ngOnInit();
component.firstName.value = firstName;
Expand All @@ -399,6 +406,7 @@ describe('EPersonFormComponent', () => {
component.canLogIn.value = canLogIn;
component.requireCertificate.value = requireCertificate;
});

describe('without active EPerson', () => {
beforeEach(() => {
spyOn(epeopleRegistryServiceStub, 'getActiveEPerson').and.returnValue(of(undefined));
Expand Down Expand Up @@ -428,6 +436,11 @@ describe('EPersonFormComponent', () => {
value: lastName,
},
],
'eperson.phone': [
{
value: null,
},
],
},
email: email,
canLogIn: canLogIn,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ export class EPersonFormComponent implements OnInit, OnDestroy {
firstName: DynamicInputModel;
lastName: DynamicInputModel;
email: DynamicInputModel;
phone: DynamicInputModel;
// booleans
canLogIn: DynamicCheckboxModel;
requireCertificate: DynamicCheckboxModel;
Expand Down Expand Up @@ -144,6 +145,11 @@ export class EPersonFormComponent implements OnInit, OnDestroy {
host: 'row',
},
},
phone: {
grid: {
host: 'row',
},
},
canLogIn: {
grid: {
host: 'col col-sm-6 d-inline-block',
Expand Down Expand Up @@ -318,6 +324,12 @@ export class EPersonFormComponent implements OnInit, OnDestroy {
},
hint: this.translateService.instant(`${this.messagePrefix}.emailHint`),
});
this.phone = new DynamicInputModel({
id: 'phone',
label: this.translateService.instant(`${this.messagePrefix}.phone`),
name: 'phone',
required: false,
});
this.canLogIn = new DynamicCheckboxModel(
{
id: 'canLogIn',
Expand All @@ -336,6 +348,7 @@ export class EPersonFormComponent implements OnInit, OnDestroy {
this.firstName,
this.lastName,
this.email,
this.phone,
this.canLogIn,
this.requireCertificate,
];
Expand All @@ -351,6 +364,7 @@ export class EPersonFormComponent implements OnInit, OnDestroy {
firstName: eperson != null ? eperson.firstMetadataValue('eperson.firstname') : '',
lastName: eperson != null ? eperson.firstMetadataValue('eperson.lastname') : '',
email: eperson != null ? eperson.email : '',
phone: eperson != null ? eperson.firstMetadataValue('eperson.phone') : '',
canLogIn: eperson != null ? eperson.canLogIn : true,
requireCertificate: eperson != null ? eperson.requireCertificate : false,
});
Expand Down Expand Up @@ -427,6 +441,11 @@ export class EPersonFormComponent implements OnInit, OnDestroy {
value: this.lastName.value,
},
],
'eperson.phone': [
{
value: this.phone.value,
},
],
},
email: this.email.value,
canLogIn: this.canLogIn.value,
Expand Down Expand Up @@ -484,6 +503,11 @@ export class EPersonFormComponent implements OnInit, OnDestroy {
value: (this.lastName.value ? this.lastName.value : ePerson.firstMetadataValue('eperson.lastname')),
},
],
'eperson.phone': [
{
value: this.phone.value,
},
],
},
email: (hasValue(values.email) ? values.email : ePerson.email),
canLogIn: (hasValue(values.canLogIn) ? values.canLogIn : ePerson.canLogIn),
Expand Down
1 change: 1 addition & 0 deletions src/app/core/auth/auth.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,7 @@ describe('AuthService test', () => {
mockStore = TestBed.inject(MockStore);
authService = TestBed.inject(AuthService);
mockStore.overrideSelector(isAuthenticated, true);
mockStore.overrideSelector(getAuthenticationToken, token);
mockStore.refreshState();
storage = (authService as any).storage;
storage.get = jasmine.createSpy().and.returnValue(null);
Expand Down
2 changes: 2 additions & 0 deletions src/assets/i18n/en.json5
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,8 @@

"admin.access-control.epeople.form.email": "Email",

"admin.access-control.epeople.form.phone": "Phone",

"admin.access-control.epeople.form.emailHint": "Must be a valid email address",

"admin.access-control.epeople.form.canLogIn": "Can log in",
Expand Down