diff --git a/core-ext/login.php b/core-ext/login.php
deleted file mode 100644
index 8743ad38..00000000
--- a/core-ext/login.php
+++ /dev/null
@@ -1,409 +0,0 @@
-Load("login_hash = ?",array($_COOKIE['icehrmLF']));
-
- if(!empty($tempUser->id) &&
- sha1($tempUser->email."_".$tempUser->password) == $_COOKIE['icehrmLF']){
-
- $_REQUEST['username'] = $tempUser->username;
- $_REQUEST['password'] = $tempUser->password;
- $_REQUEST['hashedPwd'] = $tempUser->password;
- }
- }
-
- if(!empty($_REQUEST['username']) && !empty($_REQUEST['password'])){
-
- $suser = null;
- $ssoUserLoaded = false;
-
- if($_REQUEST['username'] != "admin") {
- LogManager::getInstance()->debug("LDAP: Enabled :" . SettingsManager::getInstance()->getSetting("LDAP: Enabled"));
- if (SettingsManager::getInstance()->getSetting("LDAP: Enabled") == "1") {
- $ldapResp = LDAPManager::getInstance()->checkLDAPLogin($_REQUEST['username'], $_REQUEST['password']);
- LogManager::getInstance()->debug("LDAP Response :" . print_r($ldapResp, true));
- LogManager::getInstance()->debug("LDAP Response Status :" . $ldapResp->getStatus());
- if ($ldapResp->getStatus() == IceResponse::ERROR) {
- header("Location:" . CLIENT_BASE_URL . "login.php?f=1");
- exit();
- } else {
- $suser = new User();
- $suser->Load("username = ?", array($_REQUEST['username']));
- LogManager::getInstance()->debug("LDAP Response :[".$_REQUEST['username']."]" . print_r($suser, true));
- if (empty($suser)) {
- header("Location:" . CLIENT_BASE_URL . "login.php?f=1");
- exit();
- }
-
- $ssoUserLoaded = true;
- }
- }
- }
-
-
- if(!isset($_REQUEST['hashedPwd'])){
- $_REQUEST['hashedPwd'] = md5($_REQUEST['password']);
- }
-
- include 'login.com.inc.php';
-
- if(empty($suser)){
- $suser = new User();
- $suser->Load("(username = ? or email = ?) and password = ?",array($_REQUEST['username'],$_REQUEST['username'],$_REQUEST['hashedPwd']));
- }
-
- if($suser->password == $_REQUEST['hashedPwd'] || $ssoUserLoaded){
- $user = $suser;
- SessionUtils::saveSessionObject('user', $user);
- $suser->last_login = date("Y-m-d H:i:s");
- $suser->Save();
-
- if(!$ssoUserLoaded && !empty(BaseService::getInstance()->auditManager)){
- BaseService::getInstance()->auditManager->user = $user;
- BaseService::getInstance()->audit(IceConstants::AUDIT_AUTHENTICATION, "User Login");
- }
-
- if(!$ssoUserLoaded && isset($_REQUEST['remember'])){
- //Add cookie
- $suser->login_hash = sha1($suser->email."_".$suser->password);
- $suser->Save();
-
- setcookie('icehrmLF',$suser->login_hash);
- }
-
- if(!isset($_REQUEST['remember'])){
- setcookie('icehrmLF');
- }
-
- $redirectUrl = SessionUtils::getSessionObject('loginRedirect');
- if(!empty($redirectUrl)){
- header("Location:".$redirectUrl);
- }else{
- if($user->user_level == "Admin"){
- if(SessionUtils::getSessionObject('account_locked') == "1"){
- header("Location:".CLIENT_BASE_URL."?g=admin&n=billing&m=admin_System");
- }else{
- header("Location:".HOME_LINK_ADMIN);
- }
-
- }else{
- if(empty($user->default_module)){
- header("Location:".HOME_LINK_OTHERS);
- }else{
- $defaultModule = new Module();
- $defaultModule->Load("id = ?",array($user->default_module));
- if($defaultModule->mod_group == "user"){
- $defaultModule->mod_group = "modules";
- }
- $homeLink = CLIENT_BASE_URL."?g=".$defaultModule->mod_group."&&n=".$defaultModule->name.
- "&m=".$defaultModule->mod_group."_".str_replace(" ","_",$defaultModule->menu);
- header("Location:".$homeLink);
- }
- }
- }
-
- }else{
- header("Location:".CLIENT_BASE_URL."login.php?f=1");
- }
- }
-}else{
- if($user->user_level == "Admin"){
- header("Location:".HOME_LINK_ADMIN);
- }else{
- if(empty($user->default_module)){
- header("Location:".HOME_LINK_OTHERS);
- }else{
- $defaultModule = new Module();
- $defaultModule->Load("id = ?",array($user->default_module));
- if($defaultModule->mod_group == "user"){
- $defaultModule->mod_group = "modules";
- }
- $homeLink = CLIENT_BASE_URL."?g=".$defaultModule->mod_group."&n=".$defaultModule->name.
- "&m=".$defaultModule->mod_group."_".str_replace(" ","_",$defaultModule->menu);
- header("Location:".$homeLink);
- }
- }
-
-}
-
-$tuser = SessionUtils::getSessionObject('user');
-$logoFileUrl = UIManager::getInstance()->getCompanyLogoUrl();
-
-?>
-
-
-
- =APP_NAME?> Login
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- - Admin: (Username = admin/ Password = admin)
- - Manager: (Username = manager/ Password = demouserpwd)
- - User: (Username = user1/ Password = demouserpwd)
- - User: (Username = user2/ Password = demouserpwd)
-
-
-
-
-
-
-
diff --git a/src/login.php b/src/login.php
index 721fedff..3182edba 100644
--- a/src/login.php
+++ b/src/login.php
@@ -1,304 +1,409 @@
Load("login_hash = ?",array($_COOKIE['icehrmLF']));
+
+ if(!empty($tempUser->id) &&
+ sha1($tempUser->email."_".$tempUser->password) == $_COOKIE['icehrmLF']){
+
+ $_REQUEST['username'] = $tempUser->username;
+ $_REQUEST['password'] = $tempUser->password;
+ $_REQUEST['hashedPwd'] = $tempUser->password;
+ }
+ }
+
if(!empty($_REQUEST['username']) && !empty($_REQUEST['password'])){
+
$suser = null;
$ssoUserLoaded = false;
-
+
+ if($_REQUEST['username'] != "admin") {
+ //LogManager::getInstance()->debug("LDAP: Enabled :" . SettingsManager::getInstance()->getSetting("LDAP: Enabled"));
+ if (SettingsManager::getInstance()->getSetting("LDAP: Enabled") == "1") {
+ $ldapResp = LDAPManager::getInstance()->checkLDAPLogin($_REQUEST['username'], $_REQUEST['password']);
+ //LogManager::getInstance()->debug("LDAP Response :" . print_r($ldapResp, true));
+ //LogManager::getInstance()->debug("LDAP Response Status :" . $ldapResp->getStatus());
+ if ($ldapResp->getStatus() == IceResponse::ERROR) {
+ header("Location:" . CLIENT_BASE_URL . "login.php?f=1");
+ exit();
+ } else {
+ $suser = new User();
+ $suser->Load("username = ?", array($_REQUEST['username']));
+ //LogManager::getInstance()->debug("LDAP Response :[".$_REQUEST['username']."]" . print_r($suser, true));
+ if (empty($suser)) {
+ header("Location:" . CLIENT_BASE_URL . "login.php?f=1");
+ exit();
+ }
+
+ $ssoUserLoaded = true;
+ }
+ }
+ }
+
+
+ if(!isset($_REQUEST['hashedPwd'])){
+ $_REQUEST['hashedPwd'] = md5($_REQUEST['password']);
+ }
+
include 'login.com.inc.php';
-
+
if(empty($suser)){
$suser = new User();
- $suser->Load("(username = ? or email = ?) and password = ?",array($_REQUEST['username'],$_REQUEST['username'],md5($_REQUEST['password'])));
+ $suser->Load("(username = ? or email = ?) and password = ?",array($_REQUEST['username'],$_REQUEST['username'],$_REQUEST['hashedPwd']));
}
-
- if($suser->password == md5($_REQUEST['password']) || $ssoUserLoaded){
+
+ if($suser->password == $_REQUEST['hashedPwd'] || $ssoUserLoaded){
$user = $suser;
SessionUtils::saveSessionObject('user', $user);
$suser->last_login = date("Y-m-d H:i:s");
$suser->Save();
-
+
if(!$ssoUserLoaded && !empty(BaseService::getInstance()->auditManager)){
BaseService::getInstance()->auditManager->user = $user;
BaseService::getInstance()->audit(IceConstants::AUDIT_AUTHENTICATION, "User Login");
}
-
- if($user->user_level == "Admin"){
- header("Location:".HOME_LINK_ADMIN);
- }else{
- header("Location:".HOME_LINK_OTHERS);
+
+ if(!$ssoUserLoaded && isset($_REQUEST['remember'])){
+ //Add cookie
+ $suser->login_hash = sha1($suser->email."_".$suser->password);
+ $suser->Save();
+
+ setcookie('icehrmLF',$suser->login_hash);
}
+
+ if(!isset($_REQUEST['remember'])){
+ setcookie('icehrmLF');
+ }
+
+ $redirectUrl = SessionUtils::getSessionObject('loginRedirect');
+ if(!empty($redirectUrl)){
+ header("Location:".$redirectUrl);
+ }else{
+ if($user->user_level == "Admin"){
+ if(SessionUtils::getSessionObject('account_locked') == "1"){
+ header("Location:".CLIENT_BASE_URL."?g=admin&n=billing&m=admin_System");
+ }else{
+ header("Location:".HOME_LINK_ADMIN);
+ }
+
+ }else{
+ if(empty($user->default_module)){
+ header("Location:".HOME_LINK_OTHERS);
+ }else{
+ $defaultModule = new Module();
+ $defaultModule->Load("id = ?",array($user->default_module));
+ if($defaultModule->mod_group == "user"){
+ $defaultModule->mod_group = "modules";
+ }
+ $homeLink = CLIENT_BASE_URL."?g=".$defaultModule->mod_group."&&n=".$defaultModule->name.
+ "&m=".$defaultModule->mod_group."_".str_replace(" ","_",$defaultModule->menu);
+ header("Location:".$homeLink);
+ }
+ }
+ }
+
}else{
header("Location:".CLIENT_BASE_URL."login.php?f=1");
- }
+ }
}
}else{
if($user->user_level == "Admin"){
- header("Location:".HOME_LINK_ADMIN);
+ header("Location:".HOME_LINK_ADMIN);
}else{
- header("Location:".HOME_LINK_OTHERS);
+ if(empty($user->default_module)){
+ header("Location:".HOME_LINK_OTHERS);
+ }else{
+ $defaultModule = new Module();
+ $defaultModule->Load("id = ?",array($user->default_module));
+ if($defaultModule->mod_group == "user"){
+ $defaultModule->mod_group = "modules";
+ }
+ $homeLink = CLIENT_BASE_URL."?g=".$defaultModule->mod_group."&n=".$defaultModule->name.
+ "&m=".$defaultModule->mod_group."_".str_replace(" ","_",$defaultModule->menu);
+ header("Location:".$homeLink);
+ }
}
-
+
}
$tuser = SessionUtils::getSessionObject('user');
-//check user
-/*
-$logoFileName = CLIENT_BASE_PATH."data/logo.png";
-$logoFileUrl = CLIENT_BASE_URL."data/logo.png";
-if(!file_exists($logoFileName)){
- $logoFileUrl = BASE_URL."images/logo.png";
-}*/
$logoFileUrl = UIManager::getInstance()->getCompanyLogoUrl();
?>
-
-
- =APP_NAME?> Login
-
-
-
+
+
+ =APP_NAME?> Login
+
+
+
+
+
+
-
-
-
-
+
-
-
-
-
+
+
+
+
+
+
+
-
-
-
-
-
-
+
-
-
-
-
-
+
+
-