OD STYLE Formating workflow/engine/methods/login/

Change format files in workflow/engine/methods/login/
This commit is contained in:
norahmollo
2012-10-16 18:08:45 +00:00
parent c95a3f00b7
commit 8ebd27a064
9 changed files with 219 additions and 257 deletions

View File

@@ -24,36 +24,39 @@ require_once 'classes/model/UsersProperties.php';
$oUserProperty = new UsersProperties(); $oUserProperty = new UsersProperties();
$aUserProperty = $oUserProperty->load($_SESSION['USER_LOGGED']); $aUserProperty = $oUserProperty->load($_SESSION['USER_LOGGED']);
$aHistory = unserialize($aUserProperty['USR_PASSWORD_HISTORY']); $aHistory = unserialize($aUserProperty['USR_PASSWORD_HISTORY']);
if (!is_array($aHistory)) { if (!is_array($aHistory)) {
$aHistory = array(); $aHistory = array();
} }
if (!defined('PPP_PASSWORD_HISTORY')) { if (!defined('PPP_PASSWORD_HISTORY')) {
define('PPP_PASSWORD_HISTORY', 0); define('PPP_PASSWORD_HISTORY', 0);
} }
if (PPP_PASSWORD_HISTORY > 0) { if (PPP_PASSWORD_HISTORY > 0) {
if (count($aHistory) >= PPP_PASSWORD_HISTORY) { if (count($aHistory) >= PPP_PASSWORD_HISTORY) {
array_shift($aHistory); array_shift($aHistory);
} }
$aHistory[] = $_POST['form']['USR_PASSWORD']; $aHistory[] = $_POST['form']['USR_PASSWORD'];
} }
$aUserProperty['USR_LAST_UPDATE_DATE'] = date('Y-m-d H:i:s'); $aUserProperty['USR_LAST_UPDATE_DATE'] = date('Y-m-d H:i:s');
$aUserProperty['USR_LOGGED_NEXT_TIME'] = 0; $aUserProperty['USR_LOGGED_NEXT_TIME'] = 0;
$aUserProperty['USR_PASSWORD_HISTORY'] = serialize($aHistory); $aUserProperty['USR_PASSWORD_HISTORY'] = serialize($aHistory);
$oUserProperty->update($aUserProperty); $oUserProperty->update($aUserProperty);
if (class_exists('redirectDetail')) { if (class_exists('redirectDetail')) {
//falta validar... //falta validar...
if(isset($RBAC->aUserInfo['PROCESSMAKER']['ROLE']['ROL_CODE'])) if (isset($RBAC->aUserInfo['PROCESSMAKER']['ROLE']['ROL_CODE'])) {
$userRole = $RBAC->aUserInfo['PROCESSMAKER']['ROLE']['ROL_CODE']; $userRole = $RBAC->aUserInfo['PROCESSMAKER']['ROLE']['ROL_CODE'];
}
$oPluginRegistry = &PMPluginRegistry::getSingleton(); $oPluginRegistry = &PMPluginRegistry::getSingleton();
//$oPluginRegistry->showArrays(); //$oPluginRegistry->showArrays();
$aRedirectLogin = $oPluginRegistry->getRedirectLogins(); $aRedirectLogin = $oPluginRegistry->getRedirectLogins();
if(isset($aRedirectLogin)) if (isset($aRedirectLogin)) {
{ if(is_array($aRedirectLogin)) if (is_array($aRedirectLogin)) {
{
foreach ($aRedirectLogin as $key => $detail) { foreach ($aRedirectLogin as $key => $detail) {
if(isset($detail->sPathMethod)) if (isset($detail->sPathMethod)) {
{
if ($detail->sRoleCode == $userRole) { if ($detail->sRoleCode == $userRole) {
G::header('location: /sys' . SYS_TEMP . '/' . SYS_LANG . '/' . SYS_SKIN . '/' . $detail->sPathMethod ); G::header('location: /sys' . SYS_TEMP . '/' . SYS_LANG . '/' . SYS_SKIN . '/' . $detail->sPathMethod );
die; die;
@@ -65,17 +68,14 @@ if ( class_exists('redirectDetail')) {
} }
//end plugin //end plugin
if (isset($frm['USER_LANG'])) { if (isset($frm['USER_LANG'])) {
if ($frm['USER_LANG'] != '') { if ($frm['USER_LANG'] != '') {
$lang = $frm['USER_LANG']; $lang = $frm['USER_LANG'];
} }
} } else {
else {
if (defined('SYS_LANG')) { if (defined('SYS_LANG')) {
$lang = SYS_LANG; $lang = SYS_LANG;
} } else {
else {
$lang = 'en'; $lang = 'en';
} }
} }
@@ -83,4 +83,3 @@ if ( class_exists('redirectDetail')) {
G::header('Location: ' . $sLocation); G::header('Location: ' . $sLocation);
die; die;
?>

View File

@@ -24,14 +24,17 @@
* *
*/ */
function lookup( $target ) { function lookup ($target)
{
global $ntarget; global $ntarget;
$msg = $target . ' => '; $msg = $target . ' => ';
//if (eregi ( '[a-zA-Z]', $target )) //if (eregi ( '[a-zA-Z]', $target ))
if (preg_match( '[a-zA-Z]', $target )) //Made compatible to PHP 5.3 if (preg_match( '[a-zA-Z]', $target )) {
//Made compatible to PHP 5.3
$ntarget = gethostbyname ( $target ); $ntarget = gethostbyname ( $target );
else } else {
$ntarget = gethostbyaddr ( $target ); $ntarget = gethostbyaddr ( $target );
}
$msg .= $ntarget; $msg .= $ntarget;
return ($msg); return ($msg);
} }
@@ -40,12 +43,10 @@ G::LoadClass("system");
if (getenv ( 'HTTP_CLIENT_IP' )) { if (getenv ( 'HTTP_CLIENT_IP' )) {
$ip = getenv ( 'HTTP_CLIENT_IP' ); $ip = getenv ( 'HTTP_CLIENT_IP' );
} } else {
else {
if (getenv ( 'HTTP_X_FORWARDED_FOR' )) { if (getenv ( 'HTTP_X_FORWARDED_FOR' )) {
$ip = getenv ( 'HTTP_X_FORWARDED_FOR' ); $ip = getenv ( 'HTTP_X_FORWARDED_FOR' );
} } else {
else {
$ip = getenv ( 'REMOTE_ADDR' ); $ip = getenv ( 'REMOTE_ADDR' );
} }
} }
@@ -64,21 +65,17 @@ if (defined ( "DB_HOST" )) {
G::LoadClass ( 'dbConnections' ); G::LoadClass ( 'dbConnections' );
$dbNetView = new NET ( DB_HOST ); $dbNetView = new NET ( DB_HOST );
$dbNetView->loginDbServer ( DB_USER, DB_PASS ); $dbNetView->loginDbServer ( DB_USER, DB_PASS );
$dbConns = new dbConnections ( '' ); $dbConns = new dbConnections ( '' );
$availdb = ''; $availdb = '';
foreach ($dbConns->getDbServicesAvailables () as $key => $val) { foreach ($dbConns->getDbServicesAvailables () as $key => $val) {
if ($availdb != '') if ($availdb != '') {
$availdb .= ', '; $availdb .= ', ';
}
$availdb .= $val ['name']; $availdb .= $val ['name'];
} }
try { try {
$sMySQLVersion = $dbNetView->getDbServerVersion ( DB_ADAPTER ); $sMySQLVersion = $dbNetView->getDbServerVersion ( DB_ADAPTER );
} catch (Exception $oException) {
}
catch ( Exception $oException ) {
$sMySQLVersion = '?????'; $sMySQLVersion = '?????';
} }
} }
@@ -89,8 +86,7 @@ if (defined ( "DB_HOST" )) {
$Fields ['DATABASE_SERVER'] = DB_HOST; $Fields ['DATABASE_SERVER'] = DB_HOST;
$Fields ['DATABASE_NAME'] = DB_NAME; $Fields ['DATABASE_NAME'] = DB_NAME;
$Fields ['AVAILABLE_DB'] = $availdb; $Fields ['AVAILABLE_DB'] = $availdb;
} } else {
else {
$Fields ['DATABASE'] = "Not defined"; $Fields ['DATABASE'] = "Not defined";
$Fields ['DATABASE_SERVER'] = "Not defined"; $Fields ['DATABASE_SERVER'] = "Not defined";
$Fields ['DATABASE_NAME'] = "Not defined"; $Fields ['DATABASE_NAME'] = "Not defined";
@@ -118,3 +114,4 @@ if (! defined ( 'SKIP_RENDER_SYSTEM_INFORMATION' )) {
$G_PUBLISH->AddContent ( 'xmlform', 'xmlform', 'login/dbInfo', '', $Fields, 'appNew2' ); $G_PUBLISH->AddContent ( 'xmlform', 'xmlform', 'login/dbInfo', '', $Fields, 'appNew2' );
G::RenderPage ( 'publish', 'raw' ); G::RenderPage ( 'publish', 'raw' );
} }

View File

@@ -23,7 +23,6 @@
* *
*/ */
try { try {
G::LoadInclude ( 'ajax' ); G::LoadInclude ( 'ajax' );
if (isset ( $_POST ['form'] )) { if (isset ( $_POST ['form'] )) {
$_POST = $_POST ['form']; $_POST = $_POST ['form'];
@@ -38,13 +37,11 @@ try {
$aData ['PRO_UID'] = ''; $aData ['PRO_UID'] = '';
$aData ['USR_UID'] = ''; $aData ['USR_UID'] = '';
$aData ['APP_UID'] = ''; $aData ['APP_UID'] = '';
$oConfig = new Configuration ( ); $oConfig = new Configuration ( );
$oConfig->create ( $aData ); $oConfig->create ( $aData );
break; break;
} }
} } catch ( Exception $oException ) {
catch ( Exception $oException ) {
die ( $oException->getMessage () ); die ( $oException->getMessage () );
} }

View File

@@ -30,7 +30,7 @@ $G_SUB_MENU = "empty";
$referer = $_SERVER ['HTTP_REFERER']; $referer = $_SERVER ['HTTP_REFERER'];
$dbc = new DBConnection ( ); $dbc = new DBConnection ( );
$G_PUBLISH = new Publisher ( ); $G_PUBLISH = new Publisher ( );
$G_PUBLISH->AddContent ( "xmlform", "xmlform", "login/noViewPage", "", NULL ); $G_PUBLISH->AddContent ( "xmlform", "xmlform", "login/noViewPage", "", null );
G::RenderPage ( "publish" ); G::RenderPage ( "publish" );
?>

View File

@@ -77,6 +77,7 @@ if($userData['USR_EMAIL'] != '' && $userData['USR_EMAIL'] === $data['USR_EMAIL']
$passwd = implode('', $auxPass); $passwd = implode('', $auxPass);
} }
} }
$oSpool->config['MESS_PASSWORD'] = $passwd; $oSpool->config['MESS_PASSWORD'] = $passwd;
$oSpool->create(array( $oSpool->create(array(
@@ -97,55 +98,21 @@ if($userData['USR_EMAIL'] != '' && $userData['USR_EMAIL'] === $data['USR_EMAIL']
)); ));
try { try {
$oSpool->sendMail(); $oSpool->sendMail();
$rbacUser->update($aData); $rbacUser->update($aData);
$user->update($aData); $user->update($aData);
G::header ("location: login.html"); G::header ("location: login.html");
G::SendTemporalMessage ('ID_NEW_PASSWORD_SENT', "info"); G::SendTemporalMessage ('ID_NEW_PASSWORD_SENT', "info");
} } catch (phpmailerException $e) {
catch (phpmailerException $e) {
G::header ("location: login.html"); G::header ("location: login.html");
G::SendTemporalMessage (G::LoadTranslation('MISSING_OR_NOT_CONFIGURED_SMTP'), "warning", 'string'); G::SendTemporalMessage (G::LoadTranslation('MISSING_OR_NOT_CONFIGURED_SMTP'), "warning", 'string');
} } catch (Exception $e) {
catch (Exception $e) {
G::header ("location: login.html"); G::header ("location: login.html");
G::SendTemporalMessage ($e->getMessage(), "warning", 'string'); G::SendTemporalMessage ($e->getMessage(), "warning", 'string');
} }
} else { } else {
$msg = G::LoadTranslation('ID_USER') . ' ' . $data['USR_USERNAME'] . ' '. G::LoadTranslation('ID_IS_NOT_REGISTERED'); $msg = G::LoadTranslation('ID_USER') . ' ' . $data['USR_USERNAME'] . ' '. G::LoadTranslation('ID_IS_NOT_REGISTERED');
G::SendTemporalMessage ($msg, "warning", 'string'); G::SendTemporalMessage ($msg, "warning", 'string');
G::header('location: forgotPassword'); G::header('location: forgotPassword');
} }

View File

@@ -23,9 +23,11 @@
* *
*/ */
if (! isset ( $_POST )) if (! isset ( $_POST )) {
G::header ( 'location: /sys/' . $lang . '/' . SYS_SKIN . '/' . 'login/login' ); G::header ( 'location: /sys/' . $lang . '/' . SYS_SKIN . '/' . 'login/login' );
}
if (isset ( $_SESSION ['sysLogin'] )) if (isset ( $_SESSION ['sysLogin'] )) {
$_POST ['form'] = $_SESSION ['sysLogin']; $_POST ['form'] = $_SESSION ['sysLogin'];
}
require_once ('authentication.php'); require_once ('authentication.php');