version stable avant rdv 04 10 2017

thierry
Tmadkaud 7 years ago
parent a5d94b1a40
commit e8b781d32d

@ -1,28 +1,31 @@
<div class="card">
<div class="well">
<p class="h5 text-center mb-4">Login</p>
<!--<div> ID: {{ (user | async)?.uid }} </div>
<div> Email: {{ (user | async)?.email }} </div>-->
<form (keydown)="keyDownFunction($event)">
<!--<div> ID: {{ (user | async)?.uid }} </div>
<div> Email: {{ (user | async)?.email }} </div>-->
<div class="md-form">
<i class="fa fa-envelope prefix grey-text"></i>
<input type="email" [(ngModel)]="email" placeholder="Email" name="mail" required pattern="^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$" #mail="ngModel">
<div *ngIf="mail.errors && mail.errors.pattern && (mail.dirty || mail.touched)" class="alert alert-danger">
Email is required and format should be <strong><i>john@parrain.fr</i></strong>.
<div class="md-form">
<i class="fa fa-envelope prefix grey-text"></i>
<input type="email" [(ngModel)]="email" placeholder="Email" name="mail" required pattern="^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$" #mail="ngModel">
<div *ngIf="mail.errors && mail.errors.pattern && (mail.dirty || mail.touched)" class="alert alert-danger">
Email is required and format should be <strong><i>john@parrain.fr</i></strong>.
</div>
</div>
</div>
<div class="md-form">
<i class="fa fa-lock prefix grey-text"></i>
<input type="password" [(ngModel)]="password" placeholder="Password" name="pass" #pass= "ngModel" required minlength="5">
<div *ngIf="pass.errors && (pass.dirty || pass.touched)" class="alert alert-danger">
<strong>Password</strong> must have more than 5 caracteres
<div class="md-form">
<i class="fa fa-lock prefix grey-text"></i>
<input type="password" [(ngModel)]="password" placeholder="Password" name="pass" #pass= "ngModel" required minlength="5">
<div *ngIf="pass.errors && (pass.dirty || pass.touched)" class="alert alert-danger">
<strong>Password</strong> must have more than 5 caracteres
</div>
</div>
</div>
<div class="text-center" style="margin-top:5%">
<button class="btn btn-dark-green" [disabled]="mail.errors || pass.errors" (click)="login()">Login <i class="fa fa-paper-plane-o ml-1"></i></button>
<!--<button class="btn btn-cyan" (click)="loadHomeComponent()">Back</button>-->
</div>
<div class="text-center" style="margin-top:5%">
<button type="submit" class="btn btn-dark-green" [disabled]="mail.errors || pass.errors" (click)="login()">Login <i class="fa fa-paper-plane-o ml-1"></i></button>
<!--<button class="btn btn-cyan" (click)="loadHomeComponent()">Back</button>-->
</div>
</form>
</div>
</div>

@ -36,7 +36,15 @@ export class LoginComponent implements OnInit, OnDestroy {
this.password = '';
this.myUser = new User();
}
keyDownFunction(event) {
if(event.keyCode === 13) {
console.log('you just clicked enter');
// rest of your code
if(this.email !== '' && this.password !== ''){
this.login();
}
}
}
login() {
this.authService.signIn(this.email, this.password);
}

Loading…
Cancel
Save