diff --git a/config.xml b/config.xml index 32452b9..0a377a9 100644 --- a/config.xml +++ b/config.xml @@ -1,5 +1,5 @@ - + CoreGrade Intelligent Learning Platform. CoreGrade diff --git a/src/app/login/login.page.ts b/src/app/login/login.page.ts index 333037f..d3800b3 100644 --- a/src/app/login/login.page.ts +++ b/src/app/login/login.page.ts @@ -1,6 +1,8 @@ import { Router } from '@angular/router'; -import { Component, OnInit } from '@angular/core'; +import { Component, OnInit, ViewChild } from '@angular/core'; +import { AlertController } from '@ionic/angular'; +AlertController @Component({ selector: 'app-login', @@ -9,13 +11,37 @@ import { Component, OnInit } from '@angular/core'; }) export class LoginPage implements OnInit { - constructor( private router:Router) { } + @ViewChild('username', { static: false }) username; + @ViewChild('password', { static: false }) password; + + + constructor( + private alertCtrl: AlertController, + private router: Router + ) { } ngOnInit() { } - onStartLogin(){ - this.router.navigateByUrl('tabs'); + async onStartLogin() { + if (this.username == null || this.username === '' /* || this.floatValidatorsProvider.validateEmail(this.username) === false */ + || this.password == null || this.password === '') { + this.showAlert('Invalid Login', 'Enter username(email) and password to login'); + } else { + + this.router.navigateByUrl('tabs'); + } + } + + async showAlert(mtitle: string, amessage: string) { + const alert = await this.alertCtrl.create({ + header: mtitle, + message: amessage, + buttons: ['OK'] + }); + alert.present(); + } + }