1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78
| import { Component } from '@angular/core';
import { NavController } from 'ionic-angular';
import {PagePersonnellePage} from '../page-personnelle/page-personnelle'
import {HomeService} from './home-service'
import {Http} from '@angular/http';
import 'rxjs/add/operator/toPromise';
import 'rxjs/add/operator/map';
//declare var atlan: any;
@Component({
selector: 'page-home',
templateUrl: 'home.html',
providers: [HomeService]
})
export class HomePage {
public connection_email: string;
public connection_pwd: string;
constructor(public navCtrl: NavController, public http: Http, public HomeService : HomeService) {
}
doConnection(){
let var_email=this.connection_email;
let var_pwd=this.connection_pwd;
if (var_email==undefined || var_email=="")
{
alert("Please mention the email address");
return;
}
if (validateEmail(var_email)==false)
{
alert("Invalid email address")
this.connection_email="";
return;
}
if (var_pwd==undefined)
{
var_pwd='';
}
if (this.Autentication_get_sessionId(var_email, var_pwd))
{
//change page
this.navCtrl.push(PagePersonnellePage, {
firstPassed: var_email,
secondPassed: var_pwd
});
this.connection_email='';
this.connection_pwd='';
} //if (this.Autentication_get_sessionId())
} //doConnection
MDPOublie(){
alert("ok")
} //MDPOublie
Autentication_get_sessionId(param_email, param_pwd) {
let ws_ok=false;
this.HomeService.loginUser(param_email, param_pwd)
{
};
ws_ok=true;
return ws_ok;
} //Autentication_get_sessionId
} //export class HomePage
function validateEmail(email) {
let re = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
return re.test(email);
} |
Partager