Enforce password complexity. Ref https://github.com/GNS3/gns3-gui/issues/3698
Some checks failed
CodeQL / Analyze (javascript) (push) Has been cancelled
CodeQL / Analyze (python) (push) Has been cancelled
Build / Node 14 (push) Has been cancelled
Build / Node 16 (push) Has been cancelled
Build / Node 18 (push) Has been cancelled

This commit is contained in:
grossmj 2025-02-19 18:51:36 +10:00
parent 050d4158ed
commit 445ce5a864
No known key found for this signature in database
GPG Key ID: 1E7DD6DBB53FF3D7
3 changed files with 5 additions and 4 deletions

View File

@ -4,7 +4,7 @@
<mat-form-field class="input-field">
<input matInput type="password" formControlName="password" placeholder="Password"/>
<mat-error *ngIf="passwordForm.password?.touched && passwordForm.password?.errors"
>Password must be between 6 and 100 characters.
>Password must be at least 8 characters long and contain at least one digit, one lowercase letter and one uppercase letter.
</mat-error>
</mat-form-field>
<mat-form-field class="input-field">

View File

@ -23,12 +23,13 @@ export class ChangeUserPasswordComponent implements OnInit {
private toasterService: ToasterService) { }
ngOnInit(): void {
const password_regex = /^(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{8}$/;
this.user = this.data.user;
this.editPasswordForm = new UntypedFormGroup({
password: new UntypedFormControl(null,
[Validators.minLength(6), Validators.maxLength(100), Validators.required] ),
[Validators.minLength(6), Validators.maxLength(100), Validators.pattern(password_regex), Validators.required] ),
confirmPassword: new UntypedFormControl(null,
[Validators.minLength(6), Validators.maxLength(100), Validators.required] ),
[Validators.minLength(6), Validators.maxLength(100), Validators.pattern(password_regex), Validators.required] ),
},{
validators: [matchingPassword]
})

View File

@ -37,7 +37,7 @@ export class LoggedUserComponent implements OnInit {
changePassword() {
this.dialog.open<ChangeUserPasswordComponent>(ChangeUserPasswordComponent,
{width: '400px', height: '300px', data: {user: this.user, controller: this.controller, self_update: true}});
{width: '500px', height: '300px', data: {user: this.user, controller: this.controller, self_update: true}});
}
copyToken() {