mirror of
https://github.com/goharbor/harbor.git
synced 2024-11-26 20:26:13 +01:00
fix issue of resetting password
This commit is contained in:
parent
e4106aa05c
commit
ec0baa5785
@ -7,7 +7,7 @@
|
|||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="newPassword" class="form-group-label-override">{{'CHANGE_PWD.NEW_PWD' | translate}}</label>
|
<label for="newPassword" class="form-group-label-override">{{'CHANGE_PWD.NEW_PWD' | translate}}</label>
|
||||||
<label for="newPassword" aria-haspopup="true" role="tooltip" class="tooltip tooltip-validation tooltip-md tooltip-bottom-left" [class.invalid]='getValidationState("newPassword") === false'>
|
<label for="newPassword" aria-haspopup="true" role="tooltip" class="tooltip tooltip-validation tooltip-md tooltip-bottom-left" [class.invalid]='getValidationState("newPassword") === false'>
|
||||||
<input type="password" id="newPassword" placeholder='{{"PLACEHOLDER.NEW_PWD" | translate}}'
|
<input [disabled]="resetOk" type="password" id="newPassword" placeholder='{{"PLACEHOLDER.NEW_PWD" | translate}}'
|
||||||
required
|
required
|
||||||
pattern="^(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?!.*\s).{8,20}$"
|
pattern="^(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?!.*\s).{8,20}$"
|
||||||
name="newPassword"
|
name="newPassword"
|
||||||
@ -24,7 +24,7 @@
|
|||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="reNewPassword" class="form-group-label-override">{{'CHANGE_PWD.CONFIRM_PWD' | translate}}</label>
|
<label for="reNewPassword" class="form-group-label-override">{{'CHANGE_PWD.CONFIRM_PWD' | translate}}</label>
|
||||||
<label for="reNewPassword" aria-haspopup="true" role="tooltip" class="tooltip tooltip-validation tooltip-md tooltip-bottom-left" [class.invalid]='getValidationState("reNewPassword") === false'>
|
<label for="reNewPassword" aria-haspopup="true" role="tooltip" class="tooltip tooltip-validation tooltip-md tooltip-bottom-left" [class.invalid]='getValidationState("reNewPassword") === false'>
|
||||||
<input type="password" id="reNewPassword" placeholder='{{"PLACEHOLDER.CONFIRM_PWD" | translate}}'
|
<input [disabled]="resetOk" type="password" id="reNewPassword" placeholder='{{"PLACEHOLDER.CONFIRM_PWD" | translate}}'
|
||||||
required
|
required
|
||||||
pattern="^(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?!.*\s).{8,20}$"
|
pattern="^(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?!.*\s).{8,20}$"
|
||||||
name="reNewPassword"
|
name="reNewPassword"
|
||||||
@ -45,7 +45,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="modal-footer">
|
<div class="modal-footer">
|
||||||
<span class="spinner spinner-inline" style="top:8px;" [hidden]="showProgress === false"></span>
|
<span class="spinner spinner-inline" style="top:8px;" [hidden]="showProgress === false"></span>
|
||||||
<button type="button" class="btn btn-outline" (click)="close()">{{'BUTTON.CANCEL' | translate}}</button>
|
<button type="button" class="btn btn-outline" (click)="close()">{{btnCancelCaption | translate}}</button>
|
||||||
<button type="button" class="btn btn-primary" [disabled]="!isValid || showProgress" (click)="send()">{{'BUTTON.OK' | translate}}</button>
|
<button *ngIf="!resetOk" type="button" class="btn btn-primary" [disabled]="!isValid || showProgress" (click)="send()">{{'BUTTON.OK' | translate}}</button>
|
||||||
</div>
|
</div>
|
||||||
</clr-modal>
|
</clr-modal>
|
@ -5,6 +5,7 @@ import { NgForm } from '@angular/forms';
|
|||||||
import { PasswordSettingService } from './password-setting.service';
|
import { PasswordSettingService } from './password-setting.service';
|
||||||
import { InlineAlertComponent } from '../../shared/inline-alert/inline-alert.component';
|
import { InlineAlertComponent } from '../../shared/inline-alert/inline-alert.component';
|
||||||
import { MessageHandlerService } from '../../shared/message-handler/message-handler.service';
|
import { MessageHandlerService } from '../../shared/message-handler/message-handler.service';
|
||||||
|
import { CommonRoutes } from '../../shared/shared.const';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'reset-password',
|
selector: 'reset-password',
|
||||||
@ -45,6 +46,14 @@ export class ResetPasswordComponent implements OnInit {
|
|||||||
return this.resetPwdForm && this.resetPwdForm.valid && this.samePassword();
|
return this.resetPwdForm && this.resetPwdForm.valid && this.samePassword();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public get btnCancelCaption(): string {
|
||||||
|
if (!this.resetOk) {
|
||||||
|
return 'BUTTON.CANCEL';
|
||||||
|
} else {
|
||||||
|
return 'BUTTON.CLOSE';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public getValidationState(key: string): boolean {
|
public getValidationState(key: string): boolean {
|
||||||
return this.validationState &&
|
return this.validationState &&
|
||||||
this.validationState[key] &&
|
this.validationState[key] &&
|
||||||
@ -65,16 +74,14 @@ export class ResetPasswordComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public close(): void {
|
public close(): void {
|
||||||
|
//If already reset password ok, navigator to sign-in
|
||||||
|
if (this.resetOk) {
|
||||||
|
this.router.navigateByUrl(CommonRoutes.EMBEDDED_SIGN_IN);
|
||||||
|
}
|
||||||
this.opened = false;
|
this.opened = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public send(): void {
|
public send(): void {
|
||||||
//If already reset password ok, navigator to sign-in
|
|
||||||
if (this.resetOk) {
|
|
||||||
this.router.navigate(['sign-in']);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
//Double confirm to avoid improper situations
|
//Double confirm to avoid improper situations
|
||||||
if (!this.password) {
|
if (!this.password) {
|
||||||
return;
|
return;
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
<div class="checkbox">
|
<div class="checkbox">
|
||||||
<input type="checkbox" id="rememberme" #rememberMeBox (click)="clickRememberMe($event)" [checked]="rememberMe">
|
<input type="checkbox" id="rememberme" #rememberMeBox (click)="clickRememberMe($event)" [checked]="rememberMe">
|
||||||
<label for="rememberme">{{ 'SIGN_IN.REMEMBER' | translate }}</label>
|
<label for="rememberme">{{ 'SIGN_IN.REMEMBER' | translate }}</label>
|
||||||
<a href="javascript:void(0)" class="forgot-password-link" (click)="forgotPassword()">{{'SIGN_IN.FORGOT_PWD' | translate}}</a>
|
<a *ngIf="showForgetPwd" href="javascript:void(0)" class="forgot-password-link" (click)="forgotPassword()">{{'SIGN_IN.FORGOT_PWD' | translate}}</a>
|
||||||
</div>
|
</div>
|
||||||
<div [class.visibility-hidden]="!isError" class="error active">
|
<div [class.visibility-hidden]="!isError" class="error active">
|
||||||
{{ 'SIGN_IN.INVALID_MSG' | translate }}
|
{{ 'SIGN_IN.INVALID_MSG' | translate }}
|
||||||
|
@ -109,6 +109,10 @@ export class SignInComponent implements AfterViewChecked, OnInit {
|
|||||||
&& this.appConfig.self_registration;
|
&& this.appConfig.self_registration;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public get showForgetPwd(): boolean {
|
||||||
|
return this.appConfig.auth_mode != 'ldap_auth';
|
||||||
|
}
|
||||||
|
|
||||||
private clickRememberMe($event): void {
|
private clickRememberMe($event): void {
|
||||||
if ($event && $event.target) {
|
if ($event && $event.target) {
|
||||||
this.rememberMe = $event.target.checked;
|
this.rememberMe = $event.target.checked;
|
||||||
|
Loading…
Reference in New Issue
Block a user