fix
This commit is contained in:
@@ -7,13 +7,54 @@ class Auth extends Start_Controller {
|
||||
public function index() {
|
||||
$login_done = false;
|
||||
$data = array();
|
||||
$username = '';
|
||||
$password = '';
|
||||
$error_message = '';
|
||||
$valid_entry = false;
|
||||
$valid_login = false;
|
||||
$out = [];
|
||||
|
||||
|
||||
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
|
||||
|
||||
|
||||
$this->testLoginInput($username, $password, $error_message, $valid_entry);
|
||||
|
||||
if (true == $valid_entry) {
|
||||
if ($username != '' && $password != '') {
|
||||
|
||||
$data["page_title"] = "";
|
||||
$data["username"] = $username; //"auxsupport";
|
||||
$data["password"] = $password;
|
||||
$out = [];
|
||||
$this->coregrade_webapi(COREGRADE_ACCOUNT_LOGIN, $data, $out);
|
||||
//print_r( $data );
|
||||
//print_r( $out );
|
||||
if (count($out) > 0 && isset($out["session"])) {
|
||||
//print_r($out);
|
||||
//$this->getSessionData($out[0], $session_data); // just for testing
|
||||
|
||||
$this->buildUserSession(PHP_API_OK, $out);
|
||||
$valid_login = true;
|
||||
$this->session->set_flashdata('in', $out);
|
||||
// redirect("page/index");
|
||||
} else {
|
||||
$error_message = "Invalid Username/Password";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
$this->renderMemberPages('view_dash', $data);
|
||||
$login_done = true;
|
||||
|
||||
// exit();
|
||||
}
|
||||
echo 'hhhh jjjj';
|
||||
$this->coregrade_webapi(100, $data, $out);
|
||||
|
||||
print_r($out);
|
||||
|
||||
if (false == $login_done) {
|
||||
$this->renderAuthPages('view_login', $data);
|
||||
@@ -22,6 +63,41 @@ class Auth extends Start_Controller {
|
||||
|
||||
public function newuser() {
|
||||
//$this->load->view('home/home');
|
||||
$data["firstname"] = $data["lastname"] = $data["password"] = $data["email"] = "";
|
||||
$valid_entry = true;
|
||||
$valid_login = false;
|
||||
|
||||
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
|
||||
|
||||
$data['firstname'] = trim($this->input->post('firstname'));
|
||||
$data['lastname'] = trim($this->input->post('lastname'));
|
||||
$data['username'] = trim($this->input->post('username'));
|
||||
$data['password'] = trim($this->input->post('pass1'));
|
||||
$data['email'] = $data['username'];
|
||||
|
||||
if (true == $valid_entry) {
|
||||
if ($data['username'] != '' && $data['password'] != '') {
|
||||
$out = [];
|
||||
$this->coregrade_webapi(COREGRADE_ACCOUNT_PENDING, $data, $out);
|
||||
|
||||
//print_r( $data );
|
||||
// print_r($out);
|
||||
if (count($out) > 0 && isset($out["pending_id"]) && $out["pending_id"] > 0) {
|
||||
//print_r($out);
|
||||
//$this->getSessionData($out[0], $session_data); // just for testing
|
||||
|
||||
$this->renderAuthPages('view_pending', $data);
|
||||
$login_done = true;
|
||||
// redirect("page/index");
|
||||
} else {
|
||||
$error_message = "Invalid Username/Password";
|
||||
}
|
||||
}
|
||||
}
|
||||
// exit();
|
||||
}
|
||||
|
||||
|
||||
$this->load->view('auth/view_head');
|
||||
$this->load->view('auth/view_register');
|
||||
$this->load->view('auth/view_foot');
|
||||
@@ -35,8 +111,8 @@ class Auth extends Start_Controller {
|
||||
$this->load->view('auth/view_foot');
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public function logout() {
|
||||
$this->index();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user