forked from kevinowino869/mitrobill
remove index.php
This commit is contained in:
@ -157,10 +157,15 @@ class User
|
||||
return [];
|
||||
}
|
||||
|
||||
public static function generateToken($uid)
|
||||
public static function generateToken($uid, $validDays = 30)
|
||||
{
|
||||
global $db_pass;
|
||||
$time = time();
|
||||
if($validDays>=30){
|
||||
$time = time();
|
||||
}else{
|
||||
$time = strtotime("+ $validDays days");
|
||||
}
|
||||
|
||||
return [
|
||||
'time' => $time,
|
||||
'token' => $uid . '.' . $time . '.' . sha1($uid . '.' . $time . '.' . $db_pass)
|
||||
|
@ -80,6 +80,9 @@ if ($handler == '') {
|
||||
$handler = 'default';
|
||||
}
|
||||
try {
|
||||
if(!empty($_GET['uid'])){
|
||||
$_COOKIE['uid'] = $_GET['token'];
|
||||
}
|
||||
$admin = Admin::_info();
|
||||
$sys_render = $root_path . File::pathFixer('system/controllers/' . $handler . '.php');
|
||||
if (file_exists($sys_render)) {
|
||||
|
@ -507,7 +507,7 @@ switch ($action) {
|
||||
$welcomeMessage = str_replace('[[name]]', $d['fullname'], $welcomeMessage);
|
||||
$welcomeMessage = str_replace('[[username]]', $d['username'], $welcomeMessage);
|
||||
$welcomeMessage = str_replace('[[password]]', $d['password'], $welcomeMessage);
|
||||
$welcomeMessage = str_replace('[[url]]', APP_URL . '/index.php?_route=login', $welcomeMessage);
|
||||
$welcomeMessage = str_replace('[[url]]', APP_URL . '/?_route=login', $welcomeMessage);
|
||||
|
||||
$emailSubject = "Welcome to " . $config['CompanyName'];
|
||||
|
||||
|
@ -39,10 +39,17 @@ switch ($do) {
|
||||
}
|
||||
if (Password::_uverify($password, $d_pass) == true) {
|
||||
$_SESSION['uid'] = $d['id'];
|
||||
User::setCookie($d['id']);
|
||||
$token = User::setCookie($d['id']);
|
||||
$d->last_login = date('Y-m-d H:i:s');
|
||||
$d->save();
|
||||
_log($username . ' ' . Lang::T('Login Successful'), 'User', $d['id']);
|
||||
if ($isApi) {
|
||||
if ($token) {
|
||||
showResult(true, Lang::T('Login Successful'), ['token' => "u." . $token]);
|
||||
} else {
|
||||
showResult(false, Lang::T('Invalid Username or Password'));
|
||||
}
|
||||
}
|
||||
_alert(Lang::T('Login Successful'), 'success', "home");
|
||||
} else {
|
||||
_msglog('e', Lang::T('Invalid Username or Password'));
|
||||
|
@ -30,9 +30,9 @@ document.addEventListener("DOMContentLoaded", function(event) {
|
||||
ajax: {
|
||||
url: function(params) {
|
||||
if(params.term != undefined){
|
||||
return './index.php?_route=autoload/customer_select2&s='+params.term;
|
||||
return './?_route=autoload/customer_select2&s='+params.term;
|
||||
}else{
|
||||
return './index.php?_route=autoload/customer_select2';
|
||||
return './?_route=autoload/customer_select2';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -20,9 +20,9 @@ document.addEventListener("DOMContentLoaded", function(event) {
|
||||
ajax: {
|
||||
url: function(params) {
|
||||
if(params.term != undefined){
|
||||
return './index.php?_route=autoload/customer_select2&s='+params.term;
|
||||
return './?_route=autoload/customer_select2&s='+params.term;
|
||||
}else{
|
||||
return './index.php?_route=autoload/customer_select2';
|
||||
return './?_route=autoload/customer_select2';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -843,5 +843,6 @@
|
||||
"Settings_For_Cron_Reminder": "Pengaturan Untuk Pengingat Cron",
|
||||
"Security": "Keamanan",
|
||||
"Enable_CSRF_Validation": "Aktifkan Validasi CSRF",
|
||||
"Cross_site_request_forgery": "Pemalsuan permintaan lintas situs"
|
||||
"Cross_site_request_forgery": "Pemalsuan permintaan lintas situs",
|
||||
"Forgot_Password": "Lupa Kata Sandi"
|
||||
}
|
Reference in New Issue
Block a user