From 677bc136d853c1bbb5f6fda8b430ce998afe7f5f Mon Sep 17 00:00:00 2001 From: Olusesan Ameye Date: Sun, 3 Mar 2019 19:36:48 +0000 Subject: [PATCH] Avatar image fix --- providerwww/application/controllers/Login.php | 32 +++++++++++++++++-- .../application/views/welcome_message.php | 4 +++ 2 files changed, 33 insertions(+), 3 deletions(-) diff --git a/providerwww/application/controllers/Login.php b/providerwww/application/controllers/Login.php index c3503b8..d20e02e 100644 --- a/providerwww/application/controllers/Login.php +++ b/providerwww/application/controllers/Login.php @@ -8,6 +8,7 @@ class Login extends Web_Controller { // echo rand(1000, 9999); // print_r($this->input->get()); $data = array(); + $data['username'] = $data['pass'] = $data['error_message']=''; if ($_POST) { @@ -15,9 +16,19 @@ class Login extends Web_Controller { $data['pass'] = htmlspecialchars($this->input->post('pass')); //$this->load->view('provider/dash'); $outData = array(); - $loginResult = $this->loginUser($data, $outData); - if (true == $loginResult) { - $this->renderProviderSecurePage('dash', $data); + //print_r($data); + $loginResult = $this->verifyLoginInput($data); // initial test + if ($loginResult == true) { + + $loginResult = false; // reset again for real login + $loginResult = $this->loginUser($data, $outData); + if (true == $loginResult) { + $this->renderProviderSecurePage('dash', $data); + } + }// if valid input was supplied + + if (false == $loginResult) { + $this->renderExternalPage('welcome_message', $data); // get here if login galis } } else { //$this->load->view('welcome_message'); @@ -29,6 +40,21 @@ class Login extends Web_Controller { //$this->load->view('welcome_message'); } + private function verifyLoginInput(&$data) { + + $ret = false; + if ($data['username'] == '' or $data['pass'] == '') { + $data['error_message']="Username and password required"; + } + + + if (trim($data['username']) != '' or trim($data['pass']) != '') { + $ret = true; + } + + return $ret; + } + public function logout() { $data = array(); $this->destroySession(); diff --git a/providerwww/application/views/welcome_message.php b/providerwww/application/views/welcome_message.php index 08ab05d..5661d5d 100644 --- a/providerwww/application/views/welcome_message.php +++ b/providerwww/application/views/welcome_message.php @@ -27,6 +27,7 @@

Merms Providers

Welcome back, please login to your account.

+
@@ -50,6 +51,9 @@
Forgot Password ?
+
+
+ ".$error_message."":'';?>