Created
November 9, 2020 21:58
-
-
Save blogcacanid/c231fd6c4217595288ef01a7f6f5df1b to your computer and use it in GitHub Desktop.
login.component.html Authentication JWT Angular 9 Lumen 7
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
<div class="col-md-12"> | |
<div class="card card-container"> | |
<img | |
id="profile-img" | |
src="//ssl.gstatic.com/accounts/ui/avatar_2x.png" | |
class="profile-img-card" | |
/> | |
<form | |
*ngIf="!isLoggedIn" | |
name="form" | |
(ngSubmit)="f.form.valid && onSubmit()" | |
#f="ngForm" | |
novalidate | |
> | |
<div class="form-group"> | |
<label for="username">Username</label> | |
<input | |
type="text" | |
class="form-control" | |
name="username" | |
[(ngModel)]="form.username" | |
required | |
#username="ngModel" | |
placeholder="Enter username" | |
/> | |
<div | |
class="alert alert-danger" | |
role="alert" | |
*ngIf="f.submitted && username.invalid" | |
> | |
Username is required! | |
</div> | |
</div> | |
<div class="form-group"> | |
<label for="password">Password</label> | |
<input | |
type="password" | |
class="form-control" | |
name="password" | |
[(ngModel)]="form.password" | |
required | |
minlength="6" | |
#password="ngModel" | |
placeholder="Enter password" | |
/> | |
<div | |
class="alert alert-danger" | |
role="alert" | |
*ngIf="f.submitted && password.invalid" | |
> | |
<div *ngIf="password.errors.required">Password is required</div> | |
<div *ngIf="password.errors.minlength"> | |
Password must be at least 6 characters | |
</div> | |
</div> | |
</div> | |
<div class="form-group"> | |
<button class="btn btn-primary btn-block"> | |
Login | |
</button> | |
</div> | |
<div class="form-group"> | |
<div | |
class="alert alert-danger" | |
role="alert" | |
*ngIf="f.submitted && isLoginFailed" | |
> | |
Login failed: {{ errorMessage }} | |
</div> | |
</div> | |
</form> | |
</div> | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment