Files
MermsPanel2025/app/Controllers/Login.php
T
CHIEFSOFT\ameye 1afaccc2ef fox login types
2024-10-26 08:31:17 -04:00

63 lines
1.7 KiB
PHP

<?php
namespace App\Controllers;
/*
MERM Providers Login
*/
class Login extends BaseController {
protected \App\Models\Auth_model $auth_model;
public function __construct() {
// parent::__construct();
$this->auth_model = new \App\Models\Auth_model();
}
public function HomeLogin(){
$data = array();
return $this->renderExternalPage('welcome_message', $data);
}
public function StartLogin() {
$data = array();
$data['username'] = $data['pass'] = $data['error_message']='';
//$this->request->getPost();
// Get input from form
$username = $this->request->getVar('username');
$password = $this->request->getVar('mermspassword');
if ($username == 'ameye@chiefsoft.com' && $password=='Awori.Awori'){
//$this->load->model('auth_model');
$out = $this->auth_model->userLogin();
if ($this->createUserSession($out)){ // session was built
return redirect()->to('providers');
}
// var_dump($out);
// exit();
}
$data = array();
return $this->renderExternalPage('welcome_message', $data);
} // end of index Login
public function RegisterAccount(){
$data = array();
return $this->renderExternalPage('register', $data);
}
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;
}
}