mirror of
https://github.com/goharbor/harbor.git
synced 2024-11-04 01:30:15 +01:00
Refine sign-in form validation behavior
This commit is contained in:
parent
a385684983
commit
7325572f38
@ -3,7 +3,7 @@
|
||||
<label class="title">{{appTitle | translate}}<span class="trademark">™</span>
|
||||
</label>
|
||||
<div class="login-group">
|
||||
<label for="username" aria-haspopup="true" role="tooltip" class="tooltip tooltip-validation tooltip-md tooltip-top-left" [class.invalid]="userNameInput.invalid && (userNameInput.dirty || userNameInput.touched)">
|
||||
<label for="username" aria-haspopup="true" role="tooltip" class="tooltip tooltip-validation tooltip-md tooltip-top-left">
|
||||
<input class="username" type="text" required
|
||||
[(ngModel)]="signInCredential.principal"
|
||||
name="login_username" id="login_username" placeholder='{{"PLACEHOLDER.SIGN_IN_NAME" | translate}}'
|
||||
@ -12,7 +12,7 @@
|
||||
{{ 'TOOLTIP.SIGN_IN_USERNAME' | translate }}
|
||||
</span>
|
||||
</label>
|
||||
<label for="username" aria-haspopup="true" role="tooltip" class="tooltip tooltip-validation tooltip-md tooltip-top-left" [class.invalid]="passwordInput.invalid && (passwordInput.dirty || passwordInput.touched)">
|
||||
<label for="username" aria-haspopup="true" role="tooltip" class="tooltip tooltip-validation tooltip-md tooltip-top-left">
|
||||
<input class="password" type="password" required
|
||||
[(ngModel)]="signInCredential.password"
|
||||
name="login_password" id="login_password" placeholder='{{"PLACEHOLDER.SIGN_IN_PWD" | translate}}'
|
||||
|
@ -82,7 +82,7 @@ export class SignInComponent implements AfterViewChecked, OnInit {
|
||||
|
||||
//App title
|
||||
public get appTitle(): string {
|
||||
if(this.appConfig && this.appConfig.with_admiral){
|
||||
if (this.appConfig && this.appConfig.with_admiral) {
|
||||
return "APP_TITLE.VIC";
|
||||
}
|
||||
|
||||
@ -129,7 +129,7 @@ export class SignInComponent implements AfterViewChecked, OnInit {
|
||||
if (this.rememberedName != this.signInCredential.principal) {
|
||||
//Set expire time
|
||||
let expires: number = expireDays * 3600 * 24 * 1000;
|
||||
let date = new Date(Date.now() + expires);
|
||||
let date = new Date(Date.now() + expires);
|
||||
let cookieptions = new CookieOptions({
|
||||
expires: date
|
||||
});
|
||||
@ -191,7 +191,14 @@ export class SignInComponent implements AfterViewChecked, OnInit {
|
||||
//Trigger the signin action
|
||||
signIn(): void {
|
||||
//Should validate input firstly
|
||||
if (!this.isValid || this.isOnGoing) {
|
||||
if (!this.isValid) {
|
||||
//Set error status
|
||||
this.signInStatus = signInStatusError;
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.isOnGoing) {
|
||||
//Ongoing, directly return
|
||||
return;
|
||||
}
|
||||
|
||||
@ -202,7 +209,8 @@ export class SignInComponent implements AfterViewChecked, OnInit {
|
||||
this.session.signIn(this.signInCredential)
|
||||
.then(() => {
|
||||
//Set status
|
||||
this.signInStatus = signInStatusNormal;
|
||||
//Keep it ongoing to keep the button 'disabled'
|
||||
//this.signInStatus = signInStatusNormal;
|
||||
|
||||
//Remeber me
|
||||
this.remeberMe();
|
||||
|
Loading…
Reference in New Issue
Block a user