BUG 8875 "Feature: New ExtJS based Login & Main ProcessMaker inter..." 3rd

- fixed compatibilities to user default redirection after login
-  user experience simplified compatibilities with uxmodern interface
This commit is contained in:
Erik Amaru Ortiz
2012-04-05 12:52:33 -04:00
parent 7dac53be11
commit 561832bb06
15 changed files with 336 additions and 518 deletions

View File

@@ -32,6 +32,11 @@ class Controller
*/
private $responseType = '';
/**
* @var string - layout to pass skinEngine
*/
private $layout = '';
/**
* Magic setter method
*

View File

@@ -666,23 +666,17 @@ class G
$G_CONTENT = $objContent;
$G_TEMPLATE = $strTemplate;
$G_SKIN = $strSkin;
//echo 'x'; g::dump($G_PUBLISH); die;
try {
///////G::LoadSkin( $strSkin );
//G::skinEngine($strSkin);
$file = G::ExpandPath( "skinEngine" ) . "skinEngine.php";
include $file;
$skinEngine = new SkinEngine($G_TEMPLATE, $G_SKIN, $G_CONTENT);
$skinEngine->setLayout($layout);
$skinEngine->dispatch();
}
catch ( Exception $e ) {
echo $aMessage['MESSAGE'] = $e->getMessage();
die;
$aMessage['MESSAGE'] = $e->getMessage();
global $G_PUBLISH;
global $G_MAIN_MENU;
global $G_SUB_MENU;
@@ -707,18 +701,6 @@ class G
}
}
function skinEngine($strSkin){
// $file = G::ExpandPath( "skinEngine" ) . "skinEngine.php";
// require_once( $file );
$file = G::ExpandPath( "skinEngine" ) . "class.skinEngine.php";
//die($file);
include $file;
$skinEngine = new SkinEngine();
$skinEngine->dispatch();
}
/**
* Load a skin
*
@@ -994,18 +976,8 @@ class G
while ( count ( $URI_VARS ) > 0 && $exit == 0) {
$SYS_TARGET .= '/' . array_shift($URI_VARS);
}
// if ($SYS_TARGET == 'login') {
// if (isset($config['default_lang']) && !empty($config['default_lang'])) {
// $SYS_LANG = $config['default_lang'];
// }
// if (isset($config['default_skin']) && !empty($config['default_skin'])) {
// $SYS_SKIN = $config['default_skin'];
// }
// }
/* Fix to prevent use uxs skin outside siplified interface, because that skin is not compatible with others interfaces*/
/* Fix to prevent use uxs skin outside siplified interface,
because that skin is not compatible with others interfaces*/
if ($SYS_SKIN == 'uxs' && $SYS_COLLECTION !== 'home') {
$SYS_SKIN = 'classic';
}

View File

@@ -933,15 +933,25 @@ class System {
//Get Skin Config files
$skinListArray = array();
$customSkins = glob(PATH_CUSTOM_SKINS . "*/config.xml");
$configurationFile = G::ExpandPath("skinEngine") . 'base' . PATH_SEP . 'config.xml';
array_unshift($customSkins, $configurationFile);
// getting al base skins
$baseSkins = glob(G::ExpandPath("skinEngine") . '*/config.xml');
// filtering no public skins (uxs, simplified)
foreach ($baseSkins as $i => $skinName) {
if (strpos($skinName, 'simplified') !== false || strpos($skinName, 'uxs') !== false) {
unset($baseSkins[$i]);
}
}
$customSkins = array_merge($baseSkins, $customSkins);
//Read and parse each Configuration File
foreach ($customSkins as $key => $configInformation) {
$folderId = str_replace(G::ExpandPath("skinEngine") . 'base', "", str_replace(PATH_CUSTOM_SKINS, "", str_replace("/config.xml", "", $configInformation)));
$folderId = basename(dirname($configInformation));
if ($folderId == "") {
$folderId = "classic";
if ($folderId == 'base') {
$folderId = 'classic';
}
$xmlConfiguration = file_get_contents($configInformation);

View File

@@ -18,10 +18,17 @@ require_once 'classes/model/om/BaseUsersProperties.php';
*/
class UsersProperties extends BaseUsersProperties
{
var $fields = null;
public $fields = null;
public $usrID = '';
public $lang = 'en';
function UserPropertyExists($sUserUID) {
try {
function __construct()
{
$this->lang = defined('SYS_LANG') ? SYS_LANG : 'en';
}
function UserPropertyExists($sUserUID)
{
$oUserProperty = UsersPropertiesPeer::retrieveByPk($sUserUID);
if (!is_null($oUserProperty) && is_object($oUserProperty) && get_class($oUserProperty) == 'UsersProperties') {
$this->fields = $oUserProperty->toArray(BasePeer::TYPE_FIELDNAME);
@@ -32,14 +39,9 @@ class UsersProperties extends BaseUsersProperties
return false;
}
}
catch (Exception $oError) {
throw($oError);
}
}
public function load($sUserUID)
{
try {
$oUserProperty = UsersPropertiesPeer::retrieveByPK($sUserUID);
if (!is_null($oUserProperty)) {
$aFields = $oUserProperty->toArray(BasePeer::TYPE_FIELDNAME);
@@ -47,11 +49,7 @@ class UsersProperties extends BaseUsersProperties
return $aFields;
}
else {
throw(new Exception('This row doesn\'t exist!'));
}
}
catch (Exception $oError) {
throw($oError);
throw new Exception("User with $sUserUID does not exist!");
}
}
@@ -129,6 +127,7 @@ class UsersProperties extends BaseUsersProperties
else {
$aUserProperty = $this->fields;
}
return $aUserProperty;
}
@@ -199,12 +198,84 @@ class UsersProperties extends BaseUsersProperties
return $aErrors;
}
public function redirectTo($sUserUID, $sLanguage = 'en')
/**
* get user location
* defined by precedence plugin->ux->default
*/
public function redirectTo($usrID, $lang='')
{
$this->usrID = $usrID;
$this->lang = empty($lang) ? $this->lang : $lang;
$url = $this->_getPluginLocation();
if (empty($url)) {
$url = $this->_getUXLocation();
}
$urlUx = $this->_getUXSkinVariant();
if (empty($url) && !empty($urlUx)) {
$_SESSION['_defaultUserLocation'] = $url;
$url = $urlUx;
}
if (empty($url)) {
$url = $this->_getDefaultLocation();
}
return $url;
}
/**
* get user location
* defined by precedence plugin->default
* note that is getting location without User Inbox Simplified varification
*/
public function getUserLocation($usrID, $lang = 'en')
{
$this->usrID = $usrID;
$this->lang = empty($lang) ? $this->lang : $lang;
$url = $this->_getPluginLocation();
if (empty($url)) {
$url = $this->_getDefaultLocation();
}
$urlUx = $this->_getUXSkinVariant();
if (!empty($urlUx)) {
$_SESSION['_defaultUserLocation'] = $url;
$url = $urlUx;
}
return $url;
}
/**
* to verify if the user is using some "ux..." skin variant
* if that is the case, the redirection will change to 'main' controller
*/
public function _getUXSkinVariant()
{
$url = '';
if (substr(SYS_SKIN, 0, 2) == 'ux' && SYS_SKIN != 'uxs') {
$url = '/sys' . SYS_SYS . '/' . $this->lang . '/' . SYS_SKIN . '/main';
}
return $url;
}
/**
* get the plugins, and check if there is redirectLogins
* if yes, then redirect goes according his Role
*/
public function _getPluginLocation()
{
global $RBAC;
$url = '';
//get the plugins, and check if there is redirectLogins
//if yes, then redirect goes according his Role
if ( class_exists('redirectDetail')) {
//to do: complete the validation
if(isset($RBAC->aUserInfo['PROCESSMAKER']['ROLE']['ROL_CODE']))
@@ -215,24 +286,25 @@ class UsersProperties extends BaseUsersProperties
if (isset($aRedirectLogin) && is_array($aRedirectLogin) ) {
foreach ($aRedirectLogin as $key=>$detail) {
if (isset($detail->sPathMethod) && $detail->sRoleCode == $userRole ) {
return '/sys' . SYS_SYS . '/' . $sLanguage . '/' . SYS_SKIN . '/' . $detail->sPathMethod;
$url = '/sys' . SYS_SYS . '/' . $this->lang . '/' . SYS_SKIN . '/' . $detail->sPathMethod;
}
}
}
}
//end plugin
if (substr(SYS_SKIN, 0, 2) === 'ux' && SYS_SKIN != 'uxs') {
return '../main';
}
return $url;
}
/**
* New feature - User Experience Redirector
* @author Erik Amaru Ortiz <erik@colosa.com>
*/
public function _getUXLocation()
{
require_once 'classes/model/Users.php';
$u = UsersPeer::retrieveByPK($sUserUID);
$u = UsersPeer::retrieveByPK($this->usrID);
$url = '';
$uxType = $u->getUsrUx();
$_SESSION['user_experience'] = 'NORMAL';
@@ -240,7 +312,7 @@ class UsersProperties extends BaseUsersProperties
if ($uxType == '' || $uxType == 'NORMAL') {
require_once 'classes/model/GroupUser.php';
$gu = new GroupUser();
$ugList = $gu->getAllUserGroups($sUserUID);
$ugList = $gu->getAllUserGroups($this->usrID);
foreach ($ugList as $row) {
if ($row['GRP_UX'] != 'NORMAL' && $row['GRP_UX'] != '') {
@@ -256,69 +328,85 @@ class UsersProperties extends BaseUsersProperties
case 'SINGLE':
$_SESSION['user_experience'] = $uxType;
$_SESSION['user_last_skin'] = SYS_SKIN;
return '/sys' . SYS_SYS . '/' . $sLanguage . '/uxs/' . 'home';
$url = '/sys' . SYS_SYS . '/' . $this->lang . '/uxs/' . 'home';
break;
}
// end user experience redirection
// get user preferences for default redirect
// verifying if it has any preferences on configurations table
return $url;
}
/**
* get user preferences for default redirect
* verifying if it has any preferences on configurations table
*/
public function _getDefaultLocation()
{
global $RBAC;
G::loadClass('configuration');
$oConf = new Configurations;
$oConf->loadConfig($x, 'USER_PREFERENCES','','',$_SESSION['USER_LOGGED'],'');
$baseUrl = '/sys' . SYS_SYS . '/' . $this->lang . '/' . SYS_SKIN . '/';
$url = '';
if( sizeof($oConf->aConfig) > 0) { // this user has a configuration record
// backward compatibility, because now, we don't have user and dashboard menu.
if ( $oConf->aConfig['DEFAULT_MENU'] == 'PM_USERS') $oConf->aConfig['DEFAULT_MENU'] = 'PM_SETUP';
if ( $oConf->aConfig['DEFAULT_MENU'] == 'PM_DASHBOARD') $oConf->aConfig['DEFAULT_MENU'] = 'PM_SETUP';
if ($oConf->aConfig['DEFAULT_MENU'] == 'PM_USERS')
$oConf->aConfig['DEFAULT_MENU'] = 'PM_SETUP';
if ($oConf->aConfig['DEFAULT_MENU'] == 'PM_DASHBOARD')
$oConf->aConfig['DEFAULT_MENU'] = 'PM_SETUP';
switch($oConf->aConfig['DEFAULT_MENU']) {
case 'PM_SETUP':
if ($RBAC->userCanAccess('PM_SETUP') == 1) {
return '/sys' . SYS_SYS . '/' . $sLanguage . '/' . SYS_SKIN . '/' . 'setup/main';
$url = 'setup/main';
}
break;
case 'PM_FACTORY':
if ($RBAC->userCanAccess('PM_FACTORY') == 1) {
return '/sys' . SYS_SYS . '/' . $sLanguage . '/' . SYS_SKIN . '/' . 'processes/main';
$url = 'processes/main';
}
break;
case 'PM_CASES':
if ($RBAC->userCanAccess('PM_CASES') == 1) {
return '/sys' . SYS_SYS . '/' . $sLanguage . '/' . SYS_SKIN . '/' . 'cases/main';
$url = 'cases/main';
}
break;
case 'PM_USERS':
if ($RBAC->userCanAccess('PM_USERS') == 1) {
return '/sys' . SYS_SYS . '/' . $sLanguage . '/' . SYS_SKIN . '/' . 'setup/main';
$url = 'setup/main';
}
break;
case 'PM_DASHBOARD':
if ($RBAC->userCanAccess('PM_DASHBOARD') == 1) {
return '/sys' . SYS_SYS . '/' . $sLanguage . '/' . SYS_SKIN . '/' . 'dashboard/dashboard';
$url = 'dashboard/dashboard';
}
break;
}
}
if (empty($url)) {
if ($RBAC->userCanAccess('PM_FACTORY') == 1) {
return '/sys' . SYS_SYS . '/' . $sLanguage . '/' . SYS_SKIN . '/' . 'processes/main';
$url = 'processes/main';
}
if ($RBAC->userCanAccess('PM_SETUP') == 1) {
return '/sys' . SYS_SYS . '/' . $sLanguage . '/' . SYS_SKIN . '/' . 'setup/main';
else if ($RBAC->userCanAccess('PM_SETUP') == 1) {
$url = 'setup/main';
}
if ($RBAC->userCanAccess('PM_CASES') == 1) {
return '/sys' . SYS_SYS . '/' . $sLanguage . '/' . SYS_SKIN . '/' . 'cases/main';
else if ($RBAC->userCanAccess('PM_CASES') == 1) {
$url = 'cases/main';
}
if ($RBAC->userCanAccess('PM_USERS') == 1) {
return '/sys' . SYS_SYS . '/' . $sLanguage . '/' . SYS_SKIN . '/' . 'setup/main';
else if ($RBAC->userCanAccess('PM_USERS') == 1) {
$url = 'setup/main';
}
if ($RBAC->userCanAccess('PM_DASHBOARD') == 1) {
return '/sys' . SYS_SYS . '/' . $sLanguage . '/' . SYS_SKIN . '/' . 'dashboard/dashboard';
else if ($RBAC->userCanAccess('PM_DASHBOARD') == 1) {
$url = 'dashboard/dashboard';
}
if ($RBAC->userCanAccess('PM_REPORTS') == 1) {
return '/sys' . SYS_SYS . '/' . $sLanguage . '/' . SYS_SKIN . '/' . 'reports/reportsList';
else {
$url = 'users/myInfo';
}
return '/sys' . SYS_SYS . '/' . $sLanguage . '/' . SYS_SKIN . '/' . 'users/myInfo';
}
return $baseUrl . $url;
}
} // UsersProperties

View File

@@ -26,7 +26,6 @@ class Admin extends Controller
foreach ($skinsList['skins'] as $skin) {
$skins[] = array($skin['SKIN_FOLDER_ID'], $skin['SKIN_NAME']);
}
$skins[] = array('uxmodern', 'uxmodern');
foreach ($timeZonesList as $tz) {
$timeZones[] = array($tz, $tz);

View File

@@ -91,9 +91,16 @@ class adminProxy extends HttpProxyController
}
G::update_php_ini($envFile, $updatedConf);
if (substr($sysConf['default_skin'], 0, 2) == 'ux') {
$urlPart = '/main/login';
}
else {
$urlPart = '/login/login';
}
$this->success = true;
$this->restart = $restart;
$this->url = '/sys' . SYS_SYS . '/' . $sysConf['default_lang'] . '/' . $sysConf['default_skin'] . $urlPart;
$this->message = 'Saved Successfully';
}

View File

@@ -76,19 +76,29 @@ class Home extends Controller
return;
}
require_once 'classes/model/UsersProperties.php';
G::LoadClass('process');
G::LoadClass('case');
$userProperty = new UsersProperties();
$process = new Process();
$case = new Cases();
G::loadClass('system');
$sysConf = System::getSystemConfiguration(PATH_CONFIG . 'env.ini');
//Get ProcessStatistics Info
$start = 0;
$limit = '';
$proData = $process->getAllProcesses($start, $limit);
$processList = $case->getStartCasesPerType ( $_SESSION ['USER_LOGGED'], 'category');
$switchLink = '../classic/cases/main'; //'../' . $this->lastSkin . '/cases/main';
$processList = $case->getStartCasesPerType($_SESSION['USER_LOGGED'], 'category');
$switchLink = $userProperty->getUserLocation($_SESSION['USER_LOGGED']);
if (substr($sysConf['default_skin'], 0, 2) == 'ux') {
$_SESSION['_defaultUserLocation'] = $switchLink;
$switchLink = '/sys' . SYS_SYS . '/' . SYS_LANG . '/' . $sysConf['default_skin'] . '/main';
}
unset($processList[0]);

View File

@@ -27,6 +27,8 @@ class Main extends Controller
global $RBAC;
$RBAC->requirePermissions('PM_LOGIN');
$meta = new stdClass;
$showSystemInfo = $RBAC->userCanAccess('PM_SETUP') == 1;
// setting variables for template
$this->setVar('logo_company', $this->getCompanyLogo());
@@ -41,24 +43,33 @@ class Main extends Controller
// setting variables on javascript env.
$this->setJSVar('meta', array('menu'=>$this->getMenu()));
$this->setJSVar('activeTab', $this->getActiveTab());
$activeTab = 0;
if (isset($_SESSION['_defaultUserLocation'])) {
$activeTab = $this->resolveUrlToTabIndex($_SESSION['_defaultUserLocation']);
}
else if (isset($_GET['st'])) {
$activeTab = $this->getActiveTab($_GET['st']);
unset($_GET['st']);
}
$this->setJSVar('activeTab', $activeTab);
$this->setJSVar('urlAddGetParams', $this->getUrlGetParams());
$showSystemInfo = $RBAC->userCanAccess('PM_SETUP') == 1;
$this->setJSVar('showSystemInfo', $showSystemInfo);
$switchInterface = isset($_SESSION['user_experience']) && $_SESSION['user_experience'] == 'SWITCHABLE';
if (($flyNotify = $this->getFlyNotify()) !== false) {
$this->setJSVar('flyNotify', $flyNotify);
}
$this->setJSVar('switchInterface', $switchInterface);
$this->includeExtJSLib('ux/ux.menu');
$this->includeExtJS('main/index');
//$this->setView('main/index');
$this->setLayout('pm-modern');
$this->afterLoad($httpData);
$this->render();
}
@@ -337,304 +348,6 @@ class Main extends Controller
$this->render();
}
public function sysLoginVerify()
{
$this->setResponseType('json');
try {
if (!defined('SYS_SYS')) {
if (!isset($_POST)) {
throw new Exception('Bad Request!', ERROR_EXCEPTION);
}
if (!isset($_POST['workspace'])) {
throw new Exception('No workspace specified!', ERROR_EXCEPTION);
}
session_start();
$_SESSION['sysLogin'] = $_POST;
$url = '/sys' . $_POST['workspace'] . '/' . SYS_LANG . '/' . SYS_SKIN . '/main/sysLoginVerify';
$result->success = true;
$result->url = $url;
$result->message = G::LoadTranslation('LOGIN_VERIFY_MSG');
} else {
$_POST = $_SESSION['sysLogin'];
$result = $this->authentication();
if ($result->success) {
G::header ( 'location: ' . $result->url);
} else {
G::SendTemporalMessage($result->message, "error", 'string');
G::header('location: /sys' . $_POST['workspace'] . '/' . SYS_LANG . '/' . SYS_SKIN . '/main/login');
}
}
} catch ( Exception $e ) {
$result->success = false;
$result->message = $e->getMessage();
$result->errorCode = $e->getCode();
}
return $result;
}
public function authentication()
{
global $RBAC;
$this->setResponseType('json');
try {
if (!$RBAC->singleSignOn) {
if (!isset($_POST['user']) ) {
throw new Exception(G::LoadTranslation('ID_USER_HAVENT_RIGHTS_SYSTEM'));
}
$frm = $_POST;
$usr = '';
$pwd = '';
$lang = '';
if (isset($frm['user'])) {
$usr = strtolower(trim($frm['user']));
$pwd = $currentPwd = trim($frm['password']);
$lang = trim($frm['lang']) != '' ? $frm['lang'] : SYS_LANG;
}
$uid = $RBAC->VerifyLogin($usr , $pwd);
switch ($uid) {
//The user doesn't exist
case -1:
throw new Exception(G::LoadTranslation('ID_USER_NOT_REGISTERED'));
break;
//The password is incorrect
case -2:
throw new Exception(G::LoadTranslation('ID_WRONG_PASS'));
if(isset($_SESSION['__AUTH_ERROR__'])){
G::SendMessageText($_SESSION['__AUTH_ERROR__'], "warning");
unset($_SESSION['__AUTH_ERROR__']);
}
break;
//The user is inactive
case -3:
require_once 'classes/model/Users.php';
$user = new Users;
$aUser = $user->loadByUsernameInArray($usr);
switch($aUser['USR_STATUS']){
case 'VACATION':
throw new Exception(G::LoadTranslation('ID_USER_ONVACATION', WARNING_EXCEPTION));
break;
case 'INACTIVE':
throw new Exception(G::LoadTranslation('ID_USER_INACTIVE', WARNING_EXCEPTION));
break;
}
break;
//The Due date is finished
case -4:
throw new Exception(G::LoadTranslation('ID_USER_INACTIVE_BY_DATE', WARNING_EXCEPTION));
break;
case -5:
throw new Exception(G::LoadTranslation('ID_AUTHENTICATION_SOURCE_INVALID', WARNING_EXCEPTION));
break;
}
//to avoid empty string in user field. This will avoid a weird message "this row doesn't exist"
if ( !isset($uid) ) {
$uid = -1;
throw new Exception(G::LoadTranslation('ID_USER_NOT_REGISTERED', WARNING_EXCEPTION));
}
if ( !isset($uid) || $uid < 0 ) {
if(isset($_SESSION['FAILED_LOGINS']))
$_SESSION['FAILED_LOGINS']++;
if (!defined('PPP_FAILED_LOGINS')) {
define('PPP_FAILED_LOGINS', 0);
}
if (PPP_FAILED_LOGINS > 0) {
if ($_SESSION['FAILED_LOGINS'] >= PPP_FAILED_LOGINS) {
$oConnection = Propel::getConnection('rbac');
$oStatement = $oConnection->prepareStatement("SELECT USR_UID FROM USERS WHERE USR_USERNAME = '" . $usr . "'");
$oDataset = $oStatement->executeQuery();
if ($oDataset->next()) {
$sUserUID = $oDataset->getString('USR_UID');
$oConnection = Propel::getConnection('rbac');
$oStatement = $oConnection->prepareStatement("UPDATE USERS SET USR_STATUS = 0 WHERE USR_UID = '" . $sUserUID . "'");
$oStatement->executeQuery();
$oConnection = Propel::getConnection('workflow');
$oStatement = $oConnection->prepareStatement("UPDATE USERS SET USR_STATUS = 'INACTIVE' WHERE USR_UID = '" . $sUserUID . "'");
$oStatement->executeQuery();
unset($_SESSION['FAILED_LOGINS']);
G::SendMessageText(G::LoadTranslation('ID_ACCOUNT') . ' "' . $usr . '" ' . G::LoadTranslation('ID_ACCOUNT_DISABLED_CONTACT_ADMIN'), 'warning');
}
else {
//Nothing
}
}
}
//TODO complete this redirection
G::header ("location: login.html");
die;
}
//Execute the SSO Script from plugin
$oPluginRegistry =& PMPluginRegistry::getSingleton();
if ( $oPluginRegistry->existsTrigger ( PM_LOGIN ) ) {
$lSession="";
$loginInfo = new loginInfo ($usr, $pwd, $lSession );
$oPluginRegistry->executeTriggers ( PM_LOGIN , $loginInfo );
}
$_SESSION['USER_LOGGED'] = $uid;
$_SESSION['USR_USERNAME'] = $usr;
}
else {
$uid = $RBAC->userObj->fields['USR_UID'];
$usr = $RBAC->userObj->fields['USR_USERNAME'];
$_SESSION['USER_LOGGED'] = $uid;
$_SESSION['USR_USERNAME'] = $usr;
}
if (!isset($_SESSION['WORKSPACE'])) {
$_SESSION['WORKSPACE'] = SYS_SYS;
}
// Assign the uid of user to userloggedobj
$RBAC->loadUserRolePermission($RBAC->sSystem, $uid);
$res = $RBAC->userCanAccess('PM_LOGIN');
if ($res != 1 ) {
if ($res == -2)
throw new Exception(G::LoadTranslation('ID_USER_HAVENT_RIGHTS_SYSTEM', ERROR_EXCEPTION));
else
throw new Exception(G::LoadTranslation('ID_USER_HAVENT_RIGHTS_PAGE', ERROR_EXCEPTION));
die;
}
//using optimization with memcache, the user data will be in memcache 8 hours
$memKey = 'rbacSession' . session_id();
$this->memcache->set( $memKey, $RBAC->aUserInfo, PMmemcached::EIGHT_HOURS );
$_SESSION['USR_FULLNAME'] = $RBAC->aUserInfo['USER_INFO']['USR_FIRSTNAME'] . ' ' . $RBAC->aUserInfo['USER_INFO']['USR_LASTNAME'];
unset($_SESSION['FAILED_LOGINS']);
//get the default language, language posted in form has preference
if ( isset($frm['USER_LANG']) && $frm['USER_LANG'] != '' ) {
$lang = $frm['USER_LANG'];
}
else {
$lang = (defined('SYS_LANG')) ? SYS_LANG : 'en';
}
/**log in table Login**/
require_once 'classes/model/LoginLog.php';
$weblog=new LoginLog();
$aLog['LOG_UID'] = G::generateUniqueID();
$aLog['LOG_STATUS'] = 'ACTIVE';
$aLog['LOG_IP'] = $_SERVER['REMOTE_ADDR'];
$aLog['LOG_SID'] = session_id();
$aLog['LOG_INIT_DATE'] = date('Y-m-d H:i:s');
$aLog['LOG_CLIENT_HOSTNAME'] = $_SERVER['HTTP_HOST'];
$aLog['USR_UID'] = $_SESSION['USER_LOGGED'];
$aLog['LOG_TYPE'] = (isset($RBAC->aUserInfo['USER_INFO']['USR_AUTH_TYPE']) ? ($RBAC->aUserInfo['USER_INFO']['USR_AUTH_TYPE'] != 'MYSQL' ? $RBAC->aUserInfo['USER_INFO']['USR_AUTH_TYPE'] : 'processmaker') : 'processmaker');
$aLog['LOG_SSO'] = (int) $RBAC->singleSignOn;
$weblog->create($aLog);
/**end log**/
// increment logins in heartbeat
G::LoadClass('serverConfiguration');
$oServerConf =& serverConf::getSingleton();
$oServerConf->sucessfulLogin();
// disabling this slow process, until revisit this issue
// //************** background processes, here we are putting some back office routines **********
// $oServerConf->setWsInfo(SYS_SYS,$oServerConf->getWorkspaceInfo(SYS_SYS) );
//
//
// //**** defining and saving server info, this file has the values of the global array $_SERVER ****
// //this file is useful for command line environment (no Browser), I mean for triggers, crons and other executed over command line
// $_CSERVER = $_SERVER;
// unset($_CSERVER['REQUEST_TIME']);
// unset($_CSERVER['REMOTE_PORT']);
// $cput = serialize($_CSERVER);
// if( !is_file(PATH_DATA_SITE . PATH_SEP . '.server_info') ){
// file_put_contents(PATH_DATA_SITE . PATH_SEP . '.server_info', $cput);
// }
// else {
// $c = file_get_contents(PATH_DATA_SITE . PATH_SEP . '.server_info');
// if(md5($c) != md5($cput)){
// file_put_contents(PATH_DATA_SITE . PATH_SEP . '.server_info', $cput);
// }
// }
//
/* Check password using policy - Start */
require_once 'classes/model/UsersProperties.php';
$oUserProperty = new UsersProperties();
if (!$RBAC->singleSignOn) {
$aUserProperty = $oUserProperty->loadOrCreateIfNotExists($_SESSION['USER_LOGGED'], array('USR_PASSWORD_HISTORY' => serialize(array(md5($currentPwd)))));
$aErrors = $oUserProperty->validatePassword($pwd, $aUserProperty['USR_LAST_UPDATE_DATE'], $aUserProperty['USR_LOGGED_NEXT_TIME']);
if (!empty($aErrors)) {
if (!defined('NO_DISPLAY_USERNAME')) {
define('NO_DISPLAY_USERNAME', 1);
}
$aFields = array();
$aFields['DESCRIPTION'] = '<span style="font-weight:normal;">';
$aFields['DESCRIPTION'] .= G::LoadTranslation('ID_POLICY_ALERT').':<br /><br />';
foreach ($aErrors as $sError) {
switch ($sError) {
case 'ID_PPP_MINIMUM_LENGTH':
$aFields['DESCRIPTION'] .= ' - ' . G::LoadTranslation($sError).': ' . PPP_MINIMUM_LENGTH . '<br />';
$aFields[substr($sError, 3)] = PPP_MINIMUM_LENGTH;
break;
case 'ID_PPP_MAXIMUM_LENGTH':
$aFields['DESCRIPTION'] .= ' - ' . G::LoadTranslation($sError).': ' . PPP_MAXIMUM_LENGTH . '<br />';
$aFields[substr($sError, 3)] = PPP_MAXIMUM_LENGTH;
break;
case 'ID_PPP_EXPIRATION_IN':
$aFields['DESCRIPTION'] .= ' - ' . G::LoadTranslation($sError).' ' . PPP_EXPIRATION_IN . ' ' . G::LoadTranslation('ID_DAYS') . '<br />';
$aFields[substr($sError, 3)] = PPP_EXPIRATION_IN;
break;
default:
$aFields['DESCRIPTION'] .= ' - ' . G::LoadTranslation($sError).'<br />';
$aFields[substr($sError, 3)] = 1;
break;
}
}
//TODO complete this policy section (need update)
$aFields['DESCRIPTION'] .= '<br />' . G::LoadTranslation('ID_PLEASE_CHANGE_PASSWORD_POLICY') . '<br /><br /></span>';
//TODO need migrate to ExtJS
// $G_PUBLISH = new Publisher;
// $G_PUBLISH->AddContent('xmlform', 'xmlform', 'login/changePassword', '', $aFields, 'changePassword');
// G::RenderPage('publish');
//die;
}
}
$sLocation = $oUserProperty->redirectTo($_SESSION['USER_LOGGED'], $lang);
$result->success = true;
$result->message = 'Logged Successfully';
$result->url = $sLocation;
}
catch ( Exception $e ) {
$result->success = false;
$result->message = $e->getMessage();
$result->errorCode = $e->getCode();
}
return $result;
}
public function forgotPassword($httpData)
{
$this->setResponseType('json');
@@ -743,6 +456,22 @@ class Main extends Controller
return $menus;
}
private function resolveUrlToTabIndex($url)
{
if (strpos($url, 'cases/main') !== false)
$activeTab = 0;
else if (strpos($url, 'processes/main') !== false)
$activeTab = 1;
else if (strpos($url, 'dashboard/main') !== false)
$activeTab = 2;
else if (strpos($url, 'setup/main') !== false)
$activeTab = 3;
else
$activeTab = 0;
return $activeTab;
}
private function getCompanyLogo()
{
$sCompanyLogo = '/images/processmaker2.logo.png';
@@ -915,17 +644,13 @@ class Main extends Controller
}
}
private function getActiveTab()
private function getActiveTab($activeTab)
{
$activeTab = '';
if (isset($_GET['st'])) {
$activeTab = $_GET['st'];
unset($_GET['st']);
if (!is_numeric($activeTab)) {
switch ($activeTab) {
case 'home' : $activeTab = 0; break;
case 'bpmn' : $activeTab = 1; break;
case 'designer': $activeTab = 2; break;
case 'designer' : $activeTab = 1; break;
case 'dashboard': $activeTab = 2; break;
case 'admin' : $activeTab = 3; break;
default: $activeTab = 0;
}
@@ -933,7 +658,6 @@ class Main extends Controller
else {
$activeTab = $activeTab > -1 && $activeTab < 3 ? (int) $activeTab : '';
}
}
return $activeTab;
}

View File

@@ -26,7 +26,6 @@
try {
if (!$RBAC->singleSignOn) {
if (!isset($_POST['form']) ) {
G::SendTemporalMessage ('ID_USER_HAVENT_RIGHTS_SYSTEM', 'error');
G::header('Location: login');
@@ -43,9 +42,7 @@ try {
}
$uid = $RBAC->VerifyLogin($usr , $pwd);
$RBAC->cleanSessionFiles(72); //cleaning session files older than 72 hours
$sPwd = 'currentPwd';
switch ($uid) {
//The user does doesn't exist
@@ -85,8 +82,6 @@ try {
break;
}
$$sPwd = $pwd;
//to avoid empty string in user field. This will avoid a weird message "this row doesn't exist"
if ( !isset($uid) ) {
$uid = -1;
@@ -231,8 +226,26 @@ try {
/* Check password using policy - Start */
require_once 'classes/model/UsersProperties.php';
$oUserProperty = new UsersProperties();
if (!$RBAC->singleSignOn) {
$aUserProperty = $oUserProperty->loadOrCreateIfNotExists($_SESSION['USER_LOGGED'], array('USR_PASSWORD_HISTORY' => serialize(array(md5($currentPwd)))));
// getting default user location
if (isset($_REQUEST['form']['URL']) && $_REQUEST['form']['URL'] != '') {
$sLocation = $_REQUEST['form']['URL'];
}
else {
if (isset($_REQUEST['u']) && $_REQUEST['u'] != '') {
$sLocation = $_REQUEST['u'];
}
else {
$sLocation = $oUserProperty->redirectTo($_SESSION['USER_LOGGED'], $lang);
}
}
if ($RBAC->singleSignOn) {
G::header('Location: ' . $sLocation);
die();
}
$aUserProperty = $oUserProperty->loadOrCreateIfNotExists($_SESSION['USER_LOGGED'], array('USR_PASSWORD_HISTORY' => serialize(array(md5($pwd)))));
$aErrors = $oUserProperty->validatePassword($_POST['form']['USR_PASSWORD'], $aUserProperty['USR_LAST_UPDATE_DATE'], $aUserProperty['USR_LOGGED_NEXT_TIME']);
if (!empty($aErrors)) {
@@ -269,44 +282,14 @@ try {
die;
}
if (isset($_REQUEST['form']['URL']) && $_REQUEST['form']['URL'] != '') {
$sLocation = $_REQUEST['form']['URL'];
}
else {
if (isset($_REQUEST['u']) && $_REQUEST['u'] != '') {
$sLocation = $_REQUEST['u'];
}
else {
$sLocation = $oUserProperty->redirectTo($_SESSION['USER_LOGGED'], $lang);
}
}
}
else {
if (isset($_REQUEST['form']['URL']) && $_REQUEST['form']['URL'] != '') {
$sLocation = $_REQUEST['form']['URL'];
}
else {
if (isset($_REQUEST['u']) && $_REQUEST['u'] != '') {
$sLocation = $_REQUEST['u'];
}
else {
$sLocation = $oUserProperty->redirectTo($_SESSION['USER_LOGGED'], $lang);
}
}
G::header('Location: ' . $sLocation);
die();
}
$oHeadPublisher =& headPublisher::getSingleton();
$oHeadPublisher = &headPublisher::getSingleton();
$oHeadPublisher->extJsInit = true;
$oHeadPublisher->addExtJsScript('login/init', false); //adding a javascript file .js
$oHeadPublisher->assign('uriReq', $sLocation);
G::RenderPage('publish', 'extJs');
//G::header('Location: ' . $sLocation);
die;
}
catch ( Exception $e ) {
$aMessage['MESSAGE'] = $e->getMessage();

View File

@@ -457,7 +457,7 @@ class SkinEngine
if (empty($this->layout)) {
$smarty->template_dir = PATH_TPL;
$tpl = $viewFile;
$tpl = $viewFile . '.html';
}
else {
$smarty->template_dir = $this->layoutFile['dirname'];

View File

@@ -1,13 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<skinConfiguration>
<information>
<id>00000000000000000000000000000001</id>
<name>Classic</name>
<description>Classic/default skin</description>
<id>00000000000000000000000000000002</id>
<name>UxModern</name>
<description>UxModern skin</description>
<author>ProcessMaker Team</author>
<version>1.0</version>
<createDate>2011-02-27</createDate>
<modifiedDate>2011-02-28</modifiedDate>
<createDate>2012-04-05</createDate>
<modifiedDate>2012-04-05</modifiedDate>
</information>
<cssFiles>
<skin>

View File

@@ -2,6 +2,7 @@ Ext.onReady(function(){
var cmbSkins = new Ext.form.ComboBox({
fieldLabel : _('ID_DEFAULT_SKIN'),
id : 'default_skin',
hiddenName : 'default_skin',
store : new Ext.data.ArrayStore({
fields: ['ID', 'NAME'],
@@ -31,6 +32,7 @@ Ext.onReady(function(){
var cmbLang = new Ext.form.ComboBox({
fieldLabel : _('ID_DEFAULT_LANGUAGE'),
id : 'default_lang',
hiddenName : 'default_lang',
store : new Ext.data.ArrayStore({
fields: ['ID', 'NAME'],
@@ -161,13 +163,12 @@ function saveSettings()
if(response.restart) {
PMExt.confirm(_('ID_CONFIRM'), _('ID_SYSTEM_REDIRECT_CONFIRM'), function(){
if (typeof window.parent.parent != 'undefined')
window.parent.parent.location.href = '/';
window.parent.parent.location.href = response.url;
if (typeof window.parent != 'undefined')
window.parent.location.href = '/';
window.parent.location.href = response.url;
else
window.location.href = '/';
window.location.href = response.url;
});
}
else

View File

@@ -98,6 +98,24 @@ Main.configureComponents = function()
this.configuration.userMenu = {}
this.configuration.userMenu.items = new Array();
if (switchInterface) {
this.configuration.userMenu.items.push({
text : _("ID_SWITCH_INTERFACE"),
iconCls: 'ss_sprite ss_arrow_switch',
handler: function() {
var url = '../uxs/home';
if (typeof parent != 'undefined') {
parent.location.href = url;
}
else {
location.href = url;
}
}
});
}
this.configuration.userMenu.items.push({
text : _("ID_VIEW_EDIT_PROFILE"),
icon: '/images/profile-picture.png',

View File

@@ -419,6 +419,7 @@ Login.submit = function()
Login.submiting = true;
document.getElementById('language').value = Ext.getCmp('language').getValue();
document.forms[0].action = '../login/authentication';
document.forms[0].submit();
return;

View File

@@ -196,10 +196,10 @@ Login.initComponents = function()
data : languages
}),
listeners : {
afterrender : function(){
afterrender : function() {
var store = languagesCmb.getStore();
var i = store.findExact('id', defaultLang, 0);
if (i > -1){
if (i > -1) {
Ext.getCmp('language').setValue(store.getAt(i).data.id);
Ext.getCmp('language').setRawValue(store.getAt(i).data.name);
}
@@ -276,11 +276,11 @@ Login.submit = function()
Login.submiting = true;
document.getElementById('language').value = Ext.getCmp('language').getValue();
document.forms[0].action = '../login/sysLoginVerify';
document.forms[0].submit();
return;
Login.form.getForm().submit({
method: 'POST',
//waitTitle: '',