51 lines
1.6 KiB
PHP
51 lines
1.6 KiB
PHP
<?php
|
|
|
|
defined('BASEPATH') OR exit('No direct script access allowed');
|
|
|
|
class Login extends AGT_Controller {
|
|
|
|
function __construct() {
|
|
parent::__construct();
|
|
}
|
|
|
|
public function index() {
|
|
$data['action_message'] = '';
|
|
|
|
// temporary data to fix all aspect
|
|
$data['username'] = 'ses66181+agent456@gmail.com';
|
|
$data['password'] = 'agentpass';
|
|
|
|
|
|
if ($this->input->post()) {
|
|
// echo 'ameye';
|
|
$valid_entry = false;
|
|
$username = $password = $error_message = '';
|
|
$this->testLoginInput($username, $password, $error_message, $valid_entry);
|
|
if ($valid_entry == true) {
|
|
$in['username'] = $username;
|
|
$in['password'] = $password;
|
|
$in['action'] = MEDTRANS_TRANSP_LOGIN;
|
|
$out = array();
|
|
$ret = $this->medtrans_call_api(MEDTRANS_TRANSP_LOGIN, $in, $out);
|
|
//print_r($out);
|
|
// echo $ret;
|
|
// print_r($_SESSION);
|
|
|
|
if ($ret == PHP_LOGIN_OK) {
|
|
$out = $this->populateAgentsession($out); // just for testing - will be removed
|
|
// $this->buildUserSession($ret, $out);
|
|
redirect('dash');
|
|
} else {
|
|
$data['action_message'] = $this->formatedMesage('ERROR', 'Invalid Username/Password');
|
|
}
|
|
} else {
|
|
|
|
$data['action_message'] = $this->formatedMesage('ERROR', $error_message);
|
|
}
|
|
}
|
|
|
|
$this->load->view('user/view_login', $data);
|
|
}
|
|
|
|
}
|