commit
f69e821f35
|
@ -15,7 +15,20 @@
|
|||
|
||||
|
||||
<ion-content padding>
|
||||
<ion-buttons>
|
||||
<button ion-item (click)="changePage()">Rentrer à la maison</button>
|
||||
</ion-buttons>
|
||||
<ion-list>
|
||||
|
||||
<ion-item>
|
||||
<ion-label stacked>Identifiant</ion-label>
|
||||
<ion-input [(ngModel)]="username" name="username" type="text"></ion-input>
|
||||
</ion-item>
|
||||
|
||||
<ion-item>
|
||||
<ion-label stacked>Mot de passe</ion-label>
|
||||
<ion-input [(ngModel)]="password" name="password" type="password"></ion-input>
|
||||
</ion-item>
|
||||
|
||||
</ion-list>
|
||||
|
||||
<button ion-button (click)="validLogin(username, password)">Connexion</button>
|
||||
|
||||
</ion-content>
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import { Component } from '@angular/core';
|
||||
import { IonicPage, NavController, NavParams } from 'ionic-angular';
|
||||
import { HomePage } from '../home/home';
|
||||
import { AlertController } from 'ionic-angular';
|
||||
|
||||
/**
|
||||
* Generated class for the LoginPage page.
|
||||
|
@ -16,8 +17,7 @@ import { HomePage } from '../home/home';
|
|||
})
|
||||
export class LoginPage {
|
||||
|
||||
|
||||
constructor(public navCtrl: NavController, public navParams: NavParams) {
|
||||
constructor(public navCtrl: NavController, public navParams: NavParams, public alertCtrl: AlertController) {
|
||||
}
|
||||
|
||||
|
||||
|
@ -25,8 +25,18 @@ export class LoginPage {
|
|||
console.log('ionViewDidLoad LoginPage');
|
||||
}
|
||||
|
||||
changePage() {
|
||||
this.navCtrl.push(HomePage);
|
||||
validLogin($username, $password) {
|
||||
if ($username === "test" && $password === "test") {
|
||||
this.navCtrl.setRoot(HomePage);
|
||||
}
|
||||
else {
|
||||
const alert = this.alertCtrl.create({
|
||||
title: 'Erreur',
|
||||
subTitle: 'Identifiant ou mot de passe erroné. Veuillez réessayer.',
|
||||
buttons: ['OK']
|
||||
});
|
||||
alert.present();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue