mirror of
https://github.com/goharbor/harbor.git
synced 2024-11-22 18:25:56 +01:00
Merge pull request #19 from steven-zou/fix/reset_password
fix issue of resetting password
This commit is contained in:
commit
0ae5360a4b
@ -7,7 +7,7 @@
|
||||
<div class="form-group">
|
||||
<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'>
|
||||
<input type="password" id="newPassword" placeholder='{{"PLACEHOLDER.NEW_PWD" | translate}}'
|
||||
<input [disabled]="resetOk" type="password" id="newPassword" placeholder='{{"PLACEHOLDER.NEW_PWD" | translate}}'
|
||||
required
|
||||
pattern="^(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?!.*\s).{8,20}$"
|
||||
name="newPassword"
|
||||
@ -24,7 +24,7 @@
|
||||
<div class="form-group">
|
||||
<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'>
|
||||
<input type="password" id="reNewPassword" placeholder='{{"PLACEHOLDER.CONFIRM_PWD" | translate}}'
|
||||
<input [disabled]="resetOk" type="password" id="reNewPassword" placeholder='{{"PLACEHOLDER.CONFIRM_PWD" | translate}}'
|
||||
required
|
||||
pattern="^(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?!.*\s).{8,20}$"
|
||||
name="reNewPassword"
|
||||
@ -45,7 +45,7 @@
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<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-primary" [disabled]="!isValid || showProgress" (click)="send()">{{'BUTTON.OK' | translate}}</button>
|
||||
<button type="button" class="btn btn-outline" (click)="close()">{{btnCancelCaption | translate}}</button>
|
||||
<button *ngIf="!resetOk" type="button" class="btn btn-primary" [disabled]="!isValid || showProgress" (click)="send()">{{'BUTTON.OK' | translate}}</button>
|
||||
</div>
|
||||
</clr-modal>
|
@ -5,6 +5,7 @@ import { NgForm } from '@angular/forms';
|
||||
import { PasswordSettingService } from './password-setting.service';
|
||||
import { InlineAlertComponent } from '../../shared/inline-alert/inline-alert.component';
|
||||
import { MessageHandlerService } from '../../shared/message-handler/message-handler.service';
|
||||
import { CommonRoutes } from '../../shared/shared.const';
|
||||
|
||||
@Component({
|
||||
selector: 'reset-password',
|
||||
@ -45,6 +46,14 @@ export class ResetPasswordComponent implements OnInit {
|
||||
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 {
|
||||
return this.validationState &&
|
||||
this.validationState[key] &&
|
||||
@ -65,16 +74,14 @@ export class ResetPasswordComponent implements OnInit {
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
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
|
||||
if (!this.password) {
|
||||
return;
|
||||
|
@ -24,7 +24,7 @@
|
||||
<div class="checkbox">
|
||||
<input type="checkbox" id="rememberme" #rememberMeBox (click)="clickRememberMe($event)" [checked]="rememberMe">
|
||||
<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 [class.visibility-hidden]="!isError" class="error active">
|
||||
{{ 'SIGN_IN.INVALID_MSG' | translate }}
|
||||
|
@ -109,6 +109,10 @@ export class SignInComponent implements AfterViewChecked, OnInit {
|
||||
&& this.appConfig.self_registration;
|
||||
}
|
||||
|
||||
public get showForgetPwd(): boolean {
|
||||
return this.appConfig.auth_mode != 'ldap_auth';
|
||||
}
|
||||
|
||||
private clickRememberMe($event): void {
|
||||
if ($event && $event.target) {
|
||||
this.rememberMe = $event.target.checked;
|
||||
|
Loading…
Reference in New Issue
Block a user