commit
f69e821f35
|
@ -15,7 +15,20 @@
|
||||||
|
|
||||||
|
|
||||||
<ion-content padding>
|
<ion-content padding>
|
||||||
<ion-buttons>
|
<ion-list>
|
||||||
<button ion-item (click)="changePage()">Rentrer à la maison</button>
|
|
||||||
</ion-buttons>
|
<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>
|
</ion-content>
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import { Component } from '@angular/core';
|
import { Component } from '@angular/core';
|
||||||
import { IonicPage, NavController, NavParams } from 'ionic-angular';
|
import { IonicPage, NavController, NavParams } from 'ionic-angular';
|
||||||
import { HomePage } from '../home/home';
|
import { HomePage } from '../home/home';
|
||||||
|
import { AlertController } from 'ionic-angular';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generated class for the LoginPage page.
|
* Generated class for the LoginPage page.
|
||||||
|
@ -16,8 +17,7 @@ import { HomePage } from '../home/home';
|
||||||
})
|
})
|
||||||
export class LoginPage {
|
export class LoginPage {
|
||||||
|
|
||||||
|
constructor(public navCtrl: NavController, public navParams: NavParams, public alertCtrl: AlertController) {
|
||||||
constructor(public navCtrl: NavController, public navParams: NavParams) {
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -25,8 +25,18 @@ export class LoginPage {
|
||||||
console.log('ionViewDidLoad LoginPage');
|
console.log('ionViewDidLoad LoginPage');
|
||||||
}
|
}
|
||||||
|
|
||||||
changePage() {
|
validLogin($username, $password) {
|
||||||
this.navCtrl.push(HomePage);
|
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