Skip to content

Commit

Permalink
Increase field size users#513 (#547)
Browse files Browse the repository at this point in the history
* fix #513

* extract email domain in a readonly input

* update changelog

* email domain only visible for admin #513
  • Loading branch information
BobLamarley authored Nov 21, 2024
1 parent 757dd7b commit d00a587
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 22 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

* Clearer error message when adding a website
* Fix error in 'projects' tab from user page
* increase size of input field in users page
* add a readonly input field under email for showing the email domain

## 1.4.31 (2024-09-27)

Expand Down
50 changes: 28 additions & 22 deletions manager2/src/app/user/user.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -76,62 +76,68 @@ <h4>Information</h4>
<form aria-label="user information" role="form" class="user-form form-horizontal form-register">
<div class="form-group row">
<label for="firstname" class="col-4 col-form-label">First name</label>
<div class="col-6">
<div class="col-8">
<input type="text" id="firstname" [ngModelOptions]="{standalone: true}" [(ngModel)]="user.firstname" class="form-control"/>
</div>
</div>
<div class="form-group row">
<label for="lastname" class="col-4 col-form-label">Last name</label>
<div class="col-6">
<div class="col-8">
<input type="text" id="lastname" [ngModelOptions]="{standalone: true}" [(ngModel)]="user.lastname" class="form-control"/>
</div>
</div>
<div class="form-group row">
<label for="email" class="col-4 col-form-label label-control">Email</label>
<div class="col-6">
<div class="col-8">
<input type="email" id="email" [ngModelOptions]="{standalone: true}" [(ngModel)]="user.email" class="form-control"/>
</div>
</div>
<div *ngIf="session_user.is_admin" class="form-group row">
<label for="key" class="col-4 col-form-label">Email domain</label>
<div class="col-8">
<input type="text" id="key" [ngModelOptions]="{standalone: true}" [(ngModel)]="emailDomain" class="form-control" readonly/>
</div>
</div>
<div class="form-group row">
<label for="address" class="col-4 col-form-label">Address</label>
<div class="col-6">
<div class="col-8">
<textarea id="address" [ngModelOptions]="{standalone: true}" [(ngModel)]="user.address" class="form-control"></textarea>
</div>
</div>
<div class="form-group row">
<label for="why" class="col-4 col-form-label">Why</label>
<div class="col-6">
<div class="col-8">
<textarea id="why" [ngModelOptions]="{standalone: true}" [(ngModel)]="user.why" class="form-control"></textarea>
</div>
</div>
<div class="form-group row">
<label for="lab" class="col-4 col-form-label">Laboratory</label>
<div class="col-6">
<div class="col-8">
<input type="text" id="lab" [ngModelOptions]="{standalone: true}" [(ngModel)]="user.lab" class="form-control"/>
</div>
</div>
<div class="form-group row">
<label for="responsible" class="col-4 col-form-label">Manager</label>
<div class="col-6">
<div class="col-8">
<input type="text" id="responsible" [ngModelOptions]="{standalone: true}" [(ngModel)]="user.responsible" class="form-control"/>
</div>
</div>
<div class="form-group row">
<label for="team" class="col-4 col-form-label">Team</label>
<div class="col-6">
<div class="col-8">
<input type="text" id="team" [ngModelOptions]="{standalone: true}" [(ngModel)]="user.team" class="form-control"/>
</div>
</div>
<div *ngIf="session_user.is_admin">
<div class="form-group row">
<label for="key" class="col-4 col-form-label">Key</label>
<div class="col-6">
<div class="col-8">
<input type="text" id="key" [ngModelOptions]="{standalone: true}" [(ngModel)]="user.regkey" class="form-control" readonly/>
</div>
</div>
<div class="form-group row" *ngIf="config.enable_ui && config.enable_ui.user_group">
<label for="group" class="col-4 col-form-label">Group</label>
<div class="col-6">
<div class="col-8">
<input disabled type="text" [ngModelOptions]="{standalone: true}" [(ngModel)]="user.group" class="form-control"/>
</div>
</div>
Expand All @@ -156,73 +162,73 @@ <h4>Information</h4>

<div class="form-group row" *ngIf="config.enable_ui && config.enable_ui.main_group">
<label for="mgroup" class="col-4 col-form-label">Main group directory</label>
<div class="col-6">
<div class="col-8">
<select id="mgroup" [ngModelOptions]="{standalone: true}" [(ngModel)]="user.group" class="form-control">
<option *ngFor="let item of config.main_groups" [value]="item">{{item}}</option>
</select>
</div>
</div>
<div class="form-group row" *ngIf="user.secondarygroups && user.secondarygroups.length > 0">
<label label for="sgroup" class="col-4 col-form-label">Secondary groups</label>
<div class="col-6">
<div class="col-8">
<div *ngFor="let secondary_group of user.secondarygroups">
<input type="text" [ngModelOptions]="{standalone: true}" [value]="secondary_group" class="form-control" readonly/>
</div>
</div>
</div>
<div class="form-group row" *ngIf="config.enable_ui && config.enable_ui.ip">
<label for="ip" class="col-4 col-form-label">IP address</label>
<div class="col-6">
<div class="col-8">
<input type="text" id="ip" [ngModelOptions]="{standalone: true}" [(ngModel)]="user.ip" class="form-control"/>
</div>
</div>
<div class="form-group row">
<label for="loginShell" class="col-4 col-form-label">Shell</label>
<div class="col-6">
<div class="col-8">
<input type="text" id="loginShell" [ngModelOptions]="{standalone: true}" [(ngModel)]="user.loginShell" class="form-control"/>
</div>
</div>
<div class="form-group row">
<label for="duration" class="col-4 col-form-label">Duration</label>
<div class="col-6">
<div class="col-8">
<select [ngModelOptions]="{standalone: true}" [(ngModel)]="user.duration" class="form-control" >
<option *ngFor="let duration of config.duration">{{duration}}</option>
</select>
</div>
</div>
<div class="form-check row">
<input id="staff" name="staff" [ngModelOptions]="{standalone: true}" [(ngModel)]="user.is_internal" type="checkbox" class="form-check-input">
<label class="col-6 form-check-label" for="staff">Staff member</label>
<label class="col-8 form-check-label" for="staff">Staff member</label>
</div>
<div class="form-check row">
<input [ngModelOptions]="{standalone: true}" [(ngModel)]="user.is_fake" type="checkbox" class="form-check-input">
<label class="col-6 form-check-label">Fake/App account</label>
<label class="col-8 form-check-label">Fake/App account</label>
</div>
<div class="form-check row">
<input [ngModelOptions]="{standalone: true}" [(ngModel)]="user.never_expire" type="checkbox" class="form-check-input">
<label class="col-6 form-check-label">Never expire</label>
<label class="col-8 form-check-label">Never expire</label>
</div>
<div class="form-check row">
<input [ngModelOptions]="{standalone: true}" [(ngModel)]="user.is_trainer" type="checkbox" class="form-check-input">
<label class="col-6 form-check-label">Trainer account</label>
<label class="col-8 form-check-label">Trainer account</label>
</div>
<div class="form-check row">
<input [ngModelOptions]="{standalone: true}" [(ngModel)]="user.send_copy_to_support" type="checkbox" class="form-check-input">
<label class="col-6 form-check-label">Copy mail to Support Team</label>
<label class="col-8 form-check-label">Copy mail to Support Team</label>
</div>

</div>

<div *ngIf="! session_user.is_admin">
<div class="form-group">
<label for="group" class="col-4 col-form-label">Group</label>
<div class="col-6">
<div class="col-8">
<input type="text" id="group" [ngModelOptions]="{standalone: true}" [(ngModel)]="user.group" class="form-control" readonly/>
</div>
</div>
<div class="form-group">
<label *ngIf="user.secondarygroups && user.secondarygroups.length > 0" label for="sgroup" class="col-4 col-form-label">Secondary groups</label>
<div class="col-6">
<div class="col-8">
<div *ngFor="let secondary_group of user.secondarygroups">
<input type="text" id="{{secondarygroup}}" [ngModelOptions]="{standalone: true}" [value]="secondary_group" class="form-control" readonly/>
</div>
Expand Down
4 changes: 4 additions & 0 deletions manager2/src/app/user/user.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,10 @@ export class UserComponent implements OnInit {
this.otp_err_msg = ""
}

get emailDomain(): string {
return this.user.email.split('@')[1] || '';
}

onExtraValue(extras: any) {
console.debug('extras updated', extras);
let new_extra = [];
Expand Down

0 comments on commit d00a587

Please sign in to comment.