parent
e1c2433dcf
commit
76b02cf282
@ -0,0 +1,25 @@
|
|||||||
|
<section>
|
||||||
|
<h2>Identifiez vous !</h2>
|
||||||
|
|
||||||
|
<form [formGroup]="loginForm">
|
||||||
|
<div>
|
||||||
|
<mat-form-field class="full-width">
|
||||||
|
<mat-label>Login</mat-label>
|
||||||
|
<input matInput type="text" formControlName="login" />
|
||||||
|
</mat-form-field>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<mat-form-field class="full-width">
|
||||||
|
<mat-label>Password</mat-label>
|
||||||
|
<input matInput type="text" formControlName="password" />
|
||||||
|
</mat-form-field>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<button mat-flat-button color="primary" type="button" (click)="Connect()">Connexion</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
</section>
|
||||||
|
|
@ -0,0 +1,50 @@
|
|||||||
|
import { Component, EventEmitter, Output } from '@angular/core';
|
||||||
|
|
||||||
|
import { FormControl, FormGroup, FormsModule, ReactiveFormsModule, Validators } from '@angular/forms';
|
||||||
|
|
||||||
|
import { MatButtonModule } from '@angular/material/button';
|
||||||
|
import { MatNativeDateModule } from '@angular/material/core';
|
||||||
|
import { MatDatepickerModule } from '@angular/material/datepicker';
|
||||||
|
import { MatFormFieldModule } from '@angular/material/form-field';
|
||||||
|
import { MatInputModule } from '@angular/material/input';
|
||||||
|
import { MatMenuModule } from '@angular/material/menu';
|
||||||
|
import { User } from '../../models/user.model';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'app-login',
|
||||||
|
standalone: true,
|
||||||
|
imports: [
|
||||||
|
MatFormFieldModule,
|
||||||
|
MatInputModule,
|
||||||
|
MatButtonModule,
|
||||||
|
MatMenuModule,
|
||||||
|
MatDatepickerModule,
|
||||||
|
MatNativeDateModule,
|
||||||
|
FormsModule,
|
||||||
|
ReactiveFormsModule
|
||||||
|
],
|
||||||
|
templateUrl: './login.component.html',
|
||||||
|
styleUrl: './login.component.css'
|
||||||
|
})
|
||||||
|
export class LoginComponent {
|
||||||
|
user: User = { login: '', password: '' }
|
||||||
|
loginForm: FormGroup = new FormGroup({
|
||||||
|
login: new FormControl(this.user.login, Validators.required),
|
||||||
|
password: new FormControl(this.user.password, Validators.required),
|
||||||
|
});
|
||||||
|
|
||||||
|
Connect() {
|
||||||
|
// if (this.loginForm.invalid) {
|
||||||
|
// console.log("ERREUR");
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
console.log(this.user.login)
|
||||||
|
console.log(this.user.password)
|
||||||
|
|
||||||
|
if(this.user.login != this.user.password){
|
||||||
|
console.log("ERREUR");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in new issue