Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import {MyPortsPage} from '../my-ports/my-ports'
- import {Component} from "@angular/core";
- import {NavController} from 'ionic-angular';
- import {UsersService} from '../../providers/users-service/users-service.ts';
- @Component({
- templateUrl: 'build/pages/home/home.html',
- providers: [UsersService]
- })
- export class HomePage {
- email : string
- senha : string
- users:any
- public existUser: number
- constructor(private navController: NavController, public usersService: UsersService) {
- //this.autentication();
- }
- autentication () {
- this.existUser = 0
- this.usersService.autentication()
- .then(data => {
- this.users = data;
- for(var d in data) {
- //alert(data[d].email);
- if (data[d].email == this.email) {
- if (data[d].pass == this.senha) {
- localStorage.setItem('usId', data[d].id);
- localStorage.setItem('usLogin', data[d].login);
- this.existUser++;
- //alert('ok');
- break;
- }
- }
- }
- if (this.existUser == 0) {alert('Não foi possivel autenticar - Usuário não existe');}
- });
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement