Skip to content

Commit 21cb3b1

Browse files
committed
IOT-825: Disable name, email and password fields for kombit users
1 parent dd7db72 commit 21cb3b1

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

src/app/admin/users/user-edit/user-edit.component.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
<div class="row mb-5">
1515
<div class="form-group mt-3 col-12">
1616
<label class="form-label" for="name">{{'USERS.FORM.NAME' | translate}}</label>*
17-
<input type="text" class="form-control" id="name" name="name"
17+
<input type="text" class="form-control" id="name" name="name" [disabled]="isKombit"
1818
[placeholder]="'USERS.FORM.NAME-PLACEHOLDER' | translate" maxlength="50" required
1919
[(ngModel)]="user.name"
2020
[ngClass]="{'is-invalid' : formFailedSubmit && errorFields.includes('name'), 'is-valid' : formFailedSubmit && !errorFields.includes('name')}">
@@ -23,7 +23,7 @@
2323
<div class="row mb-5">
2424
<div class="form-group mt-3 col-12">
2525
<label class="form-label" for="email">{{'USERS.FORM.EMAIL' | translate}}</label>*
26-
<input type="text" class="form-control" id="email" name="email"
26+
<input type="text" class="form-control" id="email" name="email" [disabled]="isKombit"
2727
[placeholder]="'USERS.FORM.EMAIL-PLACEHOLDER' | translate" maxlength="50" required
2828
[(ngModel)]="user.email"
2929
[ngClass]="{'is-invalid' : formFailedSubmit && errorFields.includes('email'), 'is-valid' : formFailedSubmit && !errorFields.includes('email')}">
@@ -33,7 +33,7 @@
3333
<div class="row mb-5">
3434
<div class="form-group mt-3 col-12">
3535
<label class="form-label" for="password">{{'USERS.FORM.PASSWORD' | translate}}</label>*
36-
<input type="text" class="form-control" id="password" name="password"
36+
<input type="text" class="form-control" id="password" name="password" [disabled]="isKombit"
3737
[placeholder]="'USERS.FORM.PASSWORD-PLACEHOLDER' | translate" minlength="6" maxlength="50" required
3838
[(ngModel)]="user.password"
3939
[ngClass]="{'is-invalid' : formFailedSubmit && errorFields.includes('password'), 'is-valid' : formFailedSubmit && !errorFields.includes('password')}">

src/app/admin/users/user-edit/user-edit.component.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ export class UserEditComponent implements OnInit {
2929
id: number;
3030
subscription: Subscription;
3131
isGlobalAdmin = false;
32+
isKombit: boolean;
3233

3334
constructor(
3435
private translate: TranslateService,
@@ -66,6 +67,7 @@ export class UserEditComponent implements OnInit {
6667
this.user.id = response.id;
6768
this.user.active = response.active;
6869
this.user.globalAdmin = response.permissions.some(x => x.type == PermissionType.GlobalAdmin);
70+
this.isKombit = response.nameId != null;
6971
// We cannot set the password.
7072
});
7173
}

src/app/admin/users/user.model.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ export interface UserResponse {
1414
createdAt: string;
1515
updatedAt: string;
1616
name: string;
17+
nameId: string;
1718
email: string;
1819
active: boolean;
1920
lastLogin: Date;

0 commit comments

Comments
 (0)