Code development platform for open source projects from the European Union institutions :large_blue_circle: EU Login authentication by SMS will be completely phased out by mid-2025. To see alternatives please check here

Skip to content
Snippets Groups Projects
Commit 9bfef241 authored by Joze RIHTARSIC's avatar Joze RIHTARSIC
Browse files

Minor UI fixes

parent 58ad1fe8
No related branches found
No related tags found
No related merge requests found
export class SmpConstants {
public static readonly DATE_TIME_FORMAT = 'dd/MM/yyyy, HH:mm:ss z';
public static readonly DATE_FORMAT = 'dd/MM/yyyy';
public static readonly NULL_VALUE: string = "-----------"
public static readonly DATE_TIME_FORMAT = 'dd/MM/yyyy, HH:mm:ss z';
public static readonly DATE_FORMAT = 'dd/MM/yyyy';
public static readonly PATH_PARAM_ENC_USER_ID = '{user-id}';
public static readonly PATH_PARAM_ENC_MANAGED_USER_ID = '{managed-user-id}';
......@@ -21,7 +22,7 @@ export class SmpConstants {
public static readonly REST_PUBLIC_USER_GENERATE_ACCESS_TOKEN = SmpConstants.REST_PUBLIC_USER_UPDATE + 'generate-access-token';
public static readonly REST_PUBLIC_USER_CHANGE_PASSWORD = SmpConstants.REST_PUBLIC_USER_UPDATE + 'change-password';
// truststore public services
public static readonly REST_PUBLIC_TRUSTSTORE = SmpConstants.REST_PUBLIC +"truststore/"+ "/" + SmpConstants.PATH_PARAM_ENC_USER_ID + "/";
public static readonly REST_PUBLIC_TRUSTSTORE = SmpConstants.REST_PUBLIC + "truststore/" + "/" + SmpConstants.PATH_PARAM_ENC_USER_ID + "/";
public static readonly REST_PUBLIC_TRUSTSTORE_CERT_VALIDATE = SmpConstants.REST_PUBLIC_TRUSTSTORE + 'validate-certificate';
// public authentication services
......@@ -30,7 +31,7 @@ export class SmpConstants {
public static readonly REST_PUBLIC_SECURITY_USER = SmpConstants.REST_PUBLIC_SECURITY + 'user';
public static readonly REST_PUBLIC_SERVICE_GROUP = SmpConstants.REST_PUBLIC + 'service-group';
public static readonly REST_PUBLIC_SERVICE_GROUP_ENTITY = SmpConstants.REST_PUBLIC_SERVICE_GROUP + '/' + SmpConstants.PATH_PARAM_SRV_GROUP_ID;
public static readonly REST_PUBLIC_SERVICE_GROUP_ENTITY = SmpConstants.REST_PUBLIC_SERVICE_GROUP + '/' + SmpConstants.PATH_PARAM_SRV_GROUP_ID;
public static readonly REST_PUBLIC_SERVICE_GROUP_ENTITY_EXTENSION = SmpConstants.REST_PUBLIC_SERVICE_GROUP_ENTITY + '/extension';
// service group extension tools
public static readonly REST_SERVICE_GROUP_EXTENSION = `${SmpConstants.REST_PUBLIC_SERVICE_GROUP}/extension`;
......@@ -49,10 +50,10 @@ export class SmpConstants {
public static readonly REST_INTERNAL_DOMAIN_VALIDATE_DELETE = SmpConstants.REST_INTERNAL_DOMAIN_MANAGE + '/validate-delete';
public static readonly REST_INTERNAL_USER_MANAGE = SmpConstants.REST_INTERNAL + 'user';
public static readonly REST_INTERNAL_USER_GENERATE_ACCESS_TOKEN = SmpConstants.REST_INTERNAL_USER_MANAGE +
'/' + SmpConstants.PATH_PARAM_ENC_USER_ID + '/' + 'generate-access-token-for'+ '/' + SmpConstants.PATH_PARAM_ENC_MANAGED_USER_ID;
'/' + SmpConstants.PATH_PARAM_ENC_USER_ID + '/' + 'generate-access-token-for' + '/' + SmpConstants.PATH_PARAM_ENC_MANAGED_USER_ID;
public static readonly REST_INTERNAL_USER_CHANGE_PASSWORD = SmpConstants.REST_INTERNAL_USER_MANAGE +
'/' + SmpConstants.PATH_PARAM_ENC_USER_ID + '/' + 'change-password-for'+ '/' + SmpConstants.PATH_PARAM_ENC_MANAGED_USER_ID;
'/' + SmpConstants.PATH_PARAM_ENC_USER_ID + '/' + 'change-password-for' + '/' + SmpConstants.PATH_PARAM_ENC_MANAGED_USER_ID;
public static readonly REST_INTERNAL_USER_VALIDATE_DELETE = `${SmpConstants.REST_INTERNAL_USER_MANAGE}/validate-delete`;
public static readonly REST_INTERNAL_KEYSTORE = SmpConstants.REST_INTERNAL + 'keystore';
......
......@@ -11,8 +11,22 @@
height: 100%;
}
.user-toggle, .email, .role-field, .role, .username, .password, .password-confirmation,
.certificate-subject, .certificate-issuer, .certificate-serial-number, .certificate-id {
.user-toggle {
width: 220px;
}
.role-field {
width: 220px;
}
.username {
width: calc(100% - 250px);
}
.email {
width: calc(100% - 250px);
}
.role, .certificate-subject, .certificate-issuer, .certificate-serial-number, .certificate-id {
width: 100%;
}
......@@ -26,6 +40,6 @@
}
.has-error {
color:red;
color: red;
font-size: 70%;
}
......@@ -4,52 +4,59 @@
<mat-card>
<mat-card-content>
<mat-form-field class="username">
<input matInput placeholder="Username" [formControl]="userForm.controls['username']"
id="username_id" maxlength="255" required>
<div *ngIf="userForm.controls['username'].hasError('required') && userForm.controls['username'].touched"
class="has-error">You should type an username
</div>
<div *ngIf="userForm.controls['username'].hasError('pattern') && userForm.controls['username'].touched"
class="has-error">Username is case insensitive and can only contain alphanumeric characters (letters a-zA-Z, numbers 0-9) and must
have from 4 to 32 characters!
</div>
<div
*ngIf="(!editMode && userForm.controls['username'].touched || editMode) && userForm.controls['username'].hasError('notInList')"
class="has-error">
Username already exists!
</div>
</mat-form-field>
<div style="display: flex;flex-flow: row;flex-wrap: wrap; justify-content: space-between;">
<mat-slide-toggle *ngIf="!isPreferencesMode()" class="user-toggle"
mat-no-ink class="mat-primary" [formControl]="userForm.controls['active']" id="active_id">
Active
</mat-slide-toggle>
<mat-form-field class="username">
<input matInput placeholder="Username" [formControl]="userForm.controls['username']"
id="username_id" maxlength="255" required>
<div *ngIf="userForm.controls['username'].hasError('required') && userForm.controls['username'].touched"
class="has-error">You should type an username
</div>
<div *ngIf="userForm.controls['username'].hasError('pattern') && userForm.controls['username'].touched"
class="has-error">Username is case insensitive and can only contain alphanumeric characters (letters
a-zA-Z, numbers 0-9) and must
have from 4 to 32 characters!
</div>
<div
*ngIf="(!editMode && userForm.controls['username'].touched || editMode) && userForm.controls['username'].hasError('notInList')"
class="has-error">
Username already exists!
</div>
</mat-form-field>
<mat-form-field class="role-field">
<mat-select matInput placeholder="Role" class="role" [formControl]="userForm.controls['role']"
id="role_id" required>
<mat-option *ngFor="let item of existingRoles" [value]="item">{{item}}</mat-option>
</mat-select>
<div *ngIf="userForm.controls['role'].hasError('required') && userForm.controls['role'].touched"
class="has-error">You need to choose at least one role for this user
<div class="user-toggle">
<mat-slide-toggle *ngIf="!isPreferencesMode()"
mat-no-ink class="mat-primary" [formControl]="userForm.controls['active']" id="active_id">
Active
</mat-slide-toggle>
</div>
</mat-form-field>
<mat-form-field class="emailAddress" class="email">
<input matInput placeholder="Email address" name="emailAddress"
[formControl]="userForm.controls['emailAddress']"
id="emailAddress_id" maxlength="255">
</mat-form-field>
<div *ngIf="userForm.controls['emailAddress'].hasError('pattern') && userForm.controls['emailAddress'].touched"
class="has-error">Email is invalid!
</div>
<div style="display: flex;flex-flow: row;flex-wrap: wrap; justify-content: space-between;">
<mat-form-field class="emailAddress" class="email">
<input matInput placeholder="Email address" name="emailAddress"
[formControl]="userForm.controls['emailAddress']"
id="emailAddress_id" maxlength="255">
<div
*ngIf="userForm.controls['emailAddress'].hasError('pattern') && userForm.controls['emailAddress'].touched"
class="has-error">Email is invalid!
</div>
</mat-form-field>
<mat-form-field class="role-field">
<mat-select matInput placeholder="Role" class="role" [formControl]="userForm.controls['role']"
id="role_id" required>
<mat-option *ngFor="let item of existingRoles" [value]="item">{{item}}</mat-option>
</mat-select>
<div *ngIf="userForm.controls['role'].hasError('required') && userForm.controls['role'].touched"
class="has-error">You need to choose at least one role for this user
</div>
</mat-form-field>
</div>
</mat-card-content>
</mat-card>
<div style="display: flex;flex-flow: row;">
<mat-card style="flex-grow: 1">
<mat-card-title>UI authentication credentials</mat-card-title>
<mat-card-content *ngIf="isUserAuthPasswdEnabled()">
<mat-card-content *ngIf="isUserAuthPasswdEnabled()">
<fieldset style="border: solid gray 1px;">
<legend>Username/password credentials</legend>
<div style="display: flex;flex-flow: row wrap;">
......@@ -71,17 +78,18 @@
</div>
<div style="display: flex;flex-flow: row wrap;">
<mat-form-field style="flex-grow: 2">
<input matInput placeholder="Seq. failed attempts" [value]="userForm.controls['sequentialLoginFailureCount'].value"
<input matInput placeholder="Seq. failed attempts"
[value]="userForm.controls['sequentialLoginFailureCount'].value"
id="sequentialLoginFailureCount_id" maxlength="255" disabled readonly>
</mat-form-field>
<mat-form-field style="flex-grow: 1">
<input matInput placeholder="Last failed attempt"
value="{{!userForm.get('lastFailedLoginAttempt').value?'/':userForm.get('lastFailedLoginAttempt').value | date:dateTimeFormat}}"
value="{{!userForm.get('lastFailedLoginAttempt').value?nullValue:userForm.get('lastFailedLoginAttempt').value | date:dateTimeFormat}}"
maxlength="255" disabled>
</mat-form-field>
<mat-form-field >
<mat-form-field>
<input matInput placeholder="Suspended until"
value="{{!userForm.get('suspendedUtil').value?'/':userForm.get('suspendedUtil').value | date:dateTimeFormat}}"
value="{{!userForm.get('suspendedUtil').value?nullValue:userForm.get('suspendedUtil').value | date:dateTimeFormat}}"
maxlength="255" disabled>
</mat-form-field>
</div>
......@@ -101,7 +109,8 @@
<input matInput placeholder="Cas identifier" [formControl]="userForm.controls['username']"
id="cas-user_id" maxlength="255" disabled readonly>
</mat-form-field>
<button mat-flat-button color="primary" style="width: 100%" id="openCASData" [disabled]="!this.current?.casUserDataUrl"
<button mat-flat-button color="primary" style="width: 100%" id="openCASData"
[disabled]="!this.current?.casUserDataUrl"
(click)="openCurrentCasUserData()">
<span>Open CAS user data</span>
</button>
......@@ -133,21 +142,23 @@
</div>
<div style="display: flex;flex-flow: row wrap;">
<mat-form-field style="flex-grow: 2">
<input matInput placeholder="Seq. failed attempts" [value]="userForm.controls['sequentialTokenLoginFailureCount'].value"
<input matInput placeholder="Seq. failed attempts"
[value]="userForm.controls['sequentialTokenLoginFailureCount'].value"
id="sequentialTokenLoginFailureCount_id" maxlength="255" disabled readonly>
</mat-form-field>
<mat-form-field style="flex-grow: 1">
<input matInput placeholder="Last failed attempt"
value="{{!userForm.get('lastTokenFailedLoginAttempt').value?'/':userForm.get('lastTokenFailedLoginAttempt').value | date:dateTimeFormat}}"
value="{{!userForm.get('lastTokenFailedLoginAttempt').value?nullValue:userForm.get('lastTokenFailedLoginAttempt').value | date:dateTimeFormat}}"
maxlength="255" disabled>
</mat-form-field>
<mat-form-field >
<mat-form-field>
<input matInput placeholder="Suspended until"
value="{{!userForm.get('tokenSuspendedUtil').value?'/':userForm.get('tokenSuspendedUtil').value | date:dateTimeFormat}}"
value="{{!userForm.get('tokenSuspendedUtil').value?nullValue:userForm.get('tokenSuspendedUtil').value | date:dateTimeFormat}}"
maxlength="255" disabled>
</mat-form-field>
</div>
<button mat-flat-button color="primary" style="width: 100%" [disabled]="!editMode" (click)="regenerateAccessToken()">
<button mat-flat-button color="primary" style="width: 100%" [disabled]="!editMode"
(click)="regenerateAccessToken()">
<span>Regenerate access token</span>
</button>
<div *ngIf="!editMode"
......
......@@ -39,7 +39,7 @@ export class UserDetailsDialogComponent {
readonly dateFormat: string = 'yyyy-MM-dd HH:mm:ssZ';
readonly usernamePattern = '^[a-zA-Z0-9]{4,32}$';
readonly dateTimeFormat: string = SmpConstants.DATE_TIME_FORMAT;
readonly nullValue: string = SmpConstants.NULL_VALUE;
mode: UserDetailsDialogMode;
editMode: boolean;
userId: string;
......@@ -119,12 +119,12 @@ export class UserDetailsDialogComponent {
emailAddress: '',
password: '',
confirmation: null,
sequentialLoginFailureCount:null,
lastFailedLoginAttempt:null,
suspendedUtil:null,
sequentialTokenLoginFailureCount:null,
lastTokenFailedLoginAttempt:null,
tokenSuspendedUtil:null,
sequentialLoginFailureCount: null,
lastFailedLoginAttempt: null,
suspendedUtil: null,
sequentialTokenLoginFailureCount: null,
lastTokenFailedLoginAttempt: null,
tokenSuspendedUtil: null,
role: '',
encodedValue: '',
crlUrl: '',
......@@ -190,13 +190,13 @@ export class UserDetailsDialogComponent {
// username/password authentication
this.userForm.controls['username'].setValue(this.current.username);
this.userForm.controls['passwordExpireOn'].setValue(this.current.passwordExpireOn);
this.userForm.controls['sequentialLoginFailureCount'].setValue(!this.current.sequentialLoginFailureCount?0:this.current.sequentialLoginFailureCount);
this.userForm.controls['sequentialLoginFailureCount'].setValue(!this.current.sequentialLoginFailureCount ? 0 : this.current.sequentialLoginFailureCount);
this.userForm.controls['lastFailedLoginAttempt'].setValue(this.current.lastFailedLoginAttempt);
this.userForm.controls['suspendedUtil'].setValue(this.current.suspendedUtil);
this.userForm.controls['accessTokenId'].setValue(this.current.accessTokenId);
this.userForm.controls['accessTokenExpireOn'].setValue(this.current.accessTokenExpireOn);
this.userForm.controls['sequentialTokenLoginFailureCount'].setValue(!this.current.sequentialTokenLoginFailureCount?0:this.current.sequentialTokenLoginFailureCount);
this.userForm.controls['sequentialTokenLoginFailureCount'].setValue(!this.current.sequentialTokenLoginFailureCount ? 0 : this.current.sequentialTokenLoginFailureCount);
this.userForm.controls['lastTokenFailedLoginAttempt'].setValue(this.current.lastTokenFailedLoginAttempt);
this.userForm.controls['tokenSuspendedUtil'].setValue(this.current.tokenSuspendedUtil);
......
......@@ -149,7 +149,7 @@ public enum SMPPropertyEnum {
"Login credentials suspended", "Login suspended mail subject.", false, false,false, STRING,
"^(.{0,255})$", "Subject must have less than 256 character"),
ALERT_USER_SUSPENDED_MOMENT("smp.alert.user.suspended.mail.moment",
"WHEN_BLOCKED", "When should the account disabled alert be triggered. Values: AT_LOGON: An alert will submit mail for all logon attempts to susspended account, WHEN_BLOCKED: An alert will be triggered only the first time when the account got suspended.",
"WHEN_BLOCKED", "When should the account disabled alert be triggered. Values: AT_LOGON: An alert will submit mail for all logon attempts to suspended account, WHEN_BLOCKED: An alert will be triggered only the first time when the account got suspended.",
false, false,false, STRING, "^(AT_LOGON|WHEN_BLOCKED)$", "Allowed values are: AT_LOGON,WHEN_BLOCKED" ),
ALERT_PASSWORD_BEFORE_EXPIRATION_ENABLED("smp.alert.password.imminent_expiration.enabled",
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment