-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
92 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
ui/projects/web/src/app/pages/security/loginv1/login.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<form (ngSubmit)="submitForm()" [formGroup]="validateForm" class="login-form" nz-form> | ||
<nz-form-item> | ||
<nz-form-control nzErrorTip="Please input your username!"> | ||
<nz-input-group nzPrefixIcon="user"> | ||
<input formControlName="userName" nz-input placeholder="Username" type="text"/> | ||
</nz-input-group> | ||
</nz-form-control> | ||
</nz-form-item> | ||
<nz-form-item> | ||
<nz-form-control nzErrorTip="Please input your Password!"> | ||
<nz-input-group nzPrefixIcon="lock"> | ||
<input formControlName="password" nz-input placeholder="Password" type="password"/> | ||
</nz-input-group> | ||
</nz-form-control> | ||
</nz-form-item> | ||
<div class="login-form-margin" nz-row> | ||
<div [nzSpan]="12" nz-col> | ||
<label formControlName="remember" nz-checkbox> | ||
<span>Remember me</span> | ||
<input name="peas" type="checkbox" /> | ||
</label> | ||
</div> | ||
<div [nzSpan]="12" nz-col> | ||
<a class="login-form-forgot">Forgot password</a> | ||
</div> | ||
</div> | ||
<button [nzType]="'primary'" class="login-form-button login-form-margin" nz-button>Log in</button> | ||
Or | ||
<a>register now!</a> | ||
</form> |
16 changes: 16 additions & 0 deletions
16
ui/projects/web/src/app/pages/security/loginv1/login.component.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
|
||
.login-form { | ||
max-width: 300px; | ||
} | ||
|
||
.login-form-margin { | ||
margin-bottom: 16px; | ||
} | ||
|
||
.login-form-forgot { | ||
float: right; | ||
} | ||
|
||
.login-form-button { | ||
width: 100%; | ||
} |
35 changes: 35 additions & 0 deletions
35
ui/projects/web/src/app/pages/security/loginv1/login.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import {Component} from '@angular/core'; | ||
import {FormControl, FormGroup, NonNullableFormBuilder, Validators} from '@angular/forms'; | ||
|
||
@Component({ | ||
selector: 'app-login-v1', | ||
templateUrl: './login.component.html', | ||
styleUrls: ['./login.component.scss'] | ||
}) | ||
export class LoginV1Component { | ||
validateForm: FormGroup<{ | ||
userName: FormControl<string>; | ||
password: FormControl<string>; | ||
remember: FormControl<boolean>; | ||
}> = this.fb.group({ | ||
userName: ['', [Validators.required]], | ||
password: ['', [Validators.required]], | ||
remember: [true] | ||
}); | ||
|
||
constructor(private fb: NonNullableFormBuilder) { | ||
} | ||
|
||
submitForm(): void { | ||
if (this.validateForm.valid) { | ||
console.log('submit', this.validateForm.value); | ||
} else { | ||
Object.values(this.validateForm.controls).forEach(control => { | ||
if (control.invalid) { | ||
control.markAsDirty(); | ||
control.updateValueAndValidity({onlySelf: true}); | ||
} | ||
}); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters