@@ -41,12 +41,12 @@ |
||
| 41 | 41 | |
| 42 | 42 | global $mod_strings; |
| 43 | 43 | $popupMeta = array('moduleMain' => 'ACLRole', |
| 44 | - 'varName' => 'ROLE', |
|
| 45 | - 'listTitle' => $mod_strings['LBL_ROLE'], |
|
| 46 | - 'orderBy' => 'name', |
|
| 47 | - 'whereClauses' => array('name' => 'acl_roles.name'), |
|
| 48 | - 'searchInputs' => array('name'), |
|
| 49 | - 'searchdefs' => array('name' => array('name' => 'name', 'label' => 'LBL_NAME',),) |
|
| 44 | + 'varName' => 'ROLE', |
|
| 45 | + 'listTitle' => $mod_strings['LBL_ROLE'], |
|
| 46 | + 'orderBy' => 'name', |
|
| 47 | + 'whereClauses' => array('name' => 'acl_roles.name'), |
|
| 48 | + 'searchInputs' => array('name'), |
|
| 49 | + 'searchdefs' => array('name' => array('name' => 'name', 'label' => 'LBL_NAME',),) |
|
| 50 | 50 | ); |
| 51 | 51 | ?> |
| 52 | 52 | |
@@ -43,17 +43,17 @@ |
||
| 43 | 43 | * To change the template for this generated file go to |
| 44 | 44 | * Window - Preferences - PHPeclipse - PHP - Code Templates |
| 45 | 45 | */ |
| 46 | - $searchdefs['ACLRoles'] = array( |
|
| 47 | - 'templateMeta' => array( |
|
| 48 | - 'maxColumns' => '3', |
|
| 49 | - 'maxColumnsBasic' => '4', |
|
| 46 | + $searchdefs['ACLRoles'] = array( |
|
| 47 | + 'templateMeta' => array( |
|
| 48 | + 'maxColumns' => '3', |
|
| 49 | + 'maxColumnsBasic' => '4', |
|
| 50 | 50 | 'widths' => array('label' => '10', 'field' => '30'), |
| 51 | - ), |
|
| 51 | + ), |
|
| 52 | 52 | 'layout' => array( |
| 53 | - 'basic_search' => array( |
|
| 54 | - 'name' => array('name' => 'name', 'label' => 'LBL_NAME',), |
|
| 55 | - ), |
|
| 56 | - 'advanced_search' => array(), |
|
| 57 | - ), |
|
| 58 | - ); |
|
| 53 | + 'basic_search' => array( |
|
| 54 | + 'name' => array('name' => 'name', 'label' => 'LBL_NAME',), |
|
| 55 | + ), |
|
| 56 | + 'advanced_search' => array(), |
|
| 57 | + ), |
|
| 58 | + ); |
|
| 59 | 59 | ?> |
@@ -39,7 +39,7 @@ |
||
| 39 | 39 | ********************************************************************************/ |
| 40 | 40 | |
| 41 | 41 | $searchFields['ACLRoles'] = |
| 42 | - array ( |
|
| 43 | - 'name' => array( 'query_type'=>'default'), |
|
| 44 | - ); |
|
| 42 | + array ( |
|
| 43 | + 'name' => array( 'query_type'=>'default'), |
|
| 44 | + ); |
|
| 45 | 45 | ?> |
@@ -5,11 +5,11 @@ |
||
| 5 | 5 | 'widths' => array( |
| 6 | 6 | ), |
| 7 | 7 | 'includes'=> array( |
| 8 | - ), |
|
| 9 | - ), |
|
| 8 | + ), |
|
| 9 | + ), |
|
| 10 | 10 | 'panels' => array( |
| 11 | 11 | |
| 12 | - ), |
|
| 12 | + ), |
|
| 13 | 13 | |
| 14 | 14 | |
| 15 | 15 | ); |
@@ -41,38 +41,38 @@ |
||
| 41 | 41 | |
| 42 | 42 | |
| 43 | 43 | $subpanel_layout = array( |
| 44 | - 'top_buttons' => array( |
|
| 45 | - array('widget_class' => 'SubPanelTopCreateButton'), |
|
| 46 | - array('widget_class' => 'SubPanelTopSelectButton'), |
|
| 47 | - ), |
|
| 44 | + 'top_buttons' => array( |
|
| 45 | + array('widget_class' => 'SubPanelTopCreateButton'), |
|
| 46 | + array('widget_class' => 'SubPanelTopSelectButton'), |
|
| 47 | + ), |
|
| 48 | 48 | |
| 49 | - 'where' => '', |
|
| 50 | - 'default_order_by' => '', |
|
| 49 | + 'where' => '', |
|
| 50 | + 'default_order_by' => '', |
|
| 51 | 51 | |
| 52 | - 'list_fields' => array( |
|
| 52 | + 'list_fields' => array( |
|
| 53 | 53 | 'name'=>array( |
| 54 | - 'vname' => 'LBL_NAME', |
|
| 55 | - 'widget_class' => 'SubPanelDetailViewLink', |
|
| 56 | - 'width' => '25%', |
|
| 57 | - ), |
|
| 58 | - 'description'=>array( |
|
| 59 | - 'vname' => 'LBL_DESCRIPTION', |
|
| 60 | - 'width' => '60%', |
|
| 61 | - 'sortable'=>false, |
|
| 62 | - ), |
|
| 63 | - 'edit_button'=>array( |
|
| 64 | - 'vname' => 'LBL_EDIT_BUTTON', |
|
| 65 | - 'widget_class' => 'SubPanelEditButton', |
|
| 66 | - 'module' => 'Contacts', |
|
| 67 | - 'width' => '5%', |
|
| 68 | - ), |
|
| 69 | - 'remove_button'=>array( |
|
| 70 | - 'vname' => 'LBL_REMOVE', |
|
| 71 | - 'widget_class' => 'SubPanelRemoveButton', |
|
| 72 | - 'module' => 'Contacts', |
|
| 73 | - 'width' => '5%', |
|
| 74 | - 'refresh_page'=>true, |
|
| 75 | - ), |
|
| 76 | - ), |
|
| 54 | + 'vname' => 'LBL_NAME', |
|
| 55 | + 'widget_class' => 'SubPanelDetailViewLink', |
|
| 56 | + 'width' => '25%', |
|
| 57 | + ), |
|
| 58 | + 'description'=>array( |
|
| 59 | + 'vname' => 'LBL_DESCRIPTION', |
|
| 60 | + 'width' => '60%', |
|
| 61 | + 'sortable'=>false, |
|
| 62 | + ), |
|
| 63 | + 'edit_button'=>array( |
|
| 64 | + 'vname' => 'LBL_EDIT_BUTTON', |
|
| 65 | + 'widget_class' => 'SubPanelEditButton', |
|
| 66 | + 'module' => 'Contacts', |
|
| 67 | + 'width' => '5%', |
|
| 68 | + ), |
|
| 69 | + 'remove_button'=>array( |
|
| 70 | + 'vname' => 'LBL_REMOVE', |
|
| 71 | + 'widget_class' => 'SubPanelRemoveButton', |
|
| 72 | + 'module' => 'Contacts', |
|
| 73 | + 'width' => '5%', |
|
| 74 | + 'refresh_page'=>true, |
|
| 75 | + ), |
|
| 76 | + ), |
|
| 77 | 77 | ); |
| 78 | 78 | ?> |
| 79 | 79 | \ No newline at end of file |
@@ -41,24 +41,24 @@ discard block |
||
| 41 | 41 | |
| 42 | 42 | |
| 43 | 43 | $subpanel_layout = array( |
| 44 | - 'top_buttons' => array( |
|
| 45 | - array('widget_class' => 'SubPanelTopCreateButton'), |
|
| 46 | - array('widget_class' => 'SubPanelTopSelectButton'), |
|
| 47 | - ), |
|
| 44 | + 'top_buttons' => array( |
|
| 45 | + array('widget_class' => 'SubPanelTopCreateButton'), |
|
| 46 | + array('widget_class' => 'SubPanelTopSelectButton'), |
|
| 47 | + ), |
|
| 48 | 48 | |
| 49 | - 'where' => '', |
|
| 49 | + 'where' => '', |
|
| 50 | 50 | |
| 51 | 51 | |
| 52 | - 'list_fields' => array( |
|
| 52 | + 'list_fields' => array( |
|
| 53 | 53 | 'name'=>array( |
| 54 | - 'vname' => 'LBL_NAME', |
|
| 55 | - 'width' => '25%', |
|
| 56 | - ), |
|
| 57 | - 'description'=>array( |
|
| 58 | - 'vname' => 'LBL_DESCRIPTION', |
|
| 59 | - 'width' => '70%', |
|
| 60 | - 'sortable'=>false, |
|
| 61 | - ), |
|
| 54 | + 'vname' => 'LBL_NAME', |
|
| 55 | + 'width' => '25%', |
|
| 56 | + ), |
|
| 57 | + 'description'=>array( |
|
| 58 | + 'vname' => 'LBL_DESCRIPTION', |
|
| 59 | + 'width' => '70%', |
|
| 60 | + 'sortable'=>false, |
|
| 61 | + ), |
|
| 62 | 62 | /* |
| 63 | 63 | 'edit_button'=>array( |
| 64 | 64 | 'vname' => 'LBL_EDIT_BUTTON', |
@@ -75,6 +75,6 @@ discard block |
||
| 75 | 75 | ), |
| 76 | 76 | */ |
| 77 | 77 | |
| 78 | - ), |
|
| 78 | + ), |
|
| 79 | 79 | ); |
| 80 | 80 | ?> |
| 81 | 81 | \ No newline at end of file |
@@ -44,30 +44,30 @@ |
||
| 44 | 44 | $role = new ACLRole(); |
| 45 | 45 | if(isset($_REQUEST['record']))$role->id = $_POST['record']; |
| 46 | 46 | if(!empty($_REQUEST['name'])){ |
| 47 | - $role->name = $_POST['name']; |
|
| 48 | - $role->description = $_POST['description']; |
|
| 49 | - $role->save(); |
|
| 50 | - //if duplicate |
|
| 51 | - if(isset($_REQUEST['isduplicate']) && !empty($_REQUEST['isduplicate'])){ |
|
| 52 | - //duplicate actions |
|
| 53 | - $role_actions=$role->getRoleActions($_REQUEST['isduplicate']); |
|
| 54 | - foreach($role_actions as $module){ |
|
| 55 | - foreach($module as $type){ |
|
| 56 | - foreach($type as $act){ |
|
| 57 | - $role->setAction($role->id, $act['id'], $act['aclaccess']); |
|
| 58 | - } |
|
| 59 | - } |
|
| 60 | - } |
|
| 61 | - } |
|
| 47 | + $role->name = $_POST['name']; |
|
| 48 | + $role->description = $_POST['description']; |
|
| 49 | + $role->save(); |
|
| 50 | + //if duplicate |
|
| 51 | + if(isset($_REQUEST['isduplicate']) && !empty($_REQUEST['isduplicate'])){ |
|
| 52 | + //duplicate actions |
|
| 53 | + $role_actions=$role->getRoleActions($_REQUEST['isduplicate']); |
|
| 54 | + foreach($role_actions as $module){ |
|
| 55 | + foreach($module as $type){ |
|
| 56 | + foreach($type as $act){ |
|
| 57 | + $role->setAction($role->id, $act['id'], $act['aclaccess']); |
|
| 58 | + } |
|
| 59 | + } |
|
| 60 | + } |
|
| 61 | + } |
|
| 62 | 62 | }else{ |
| 63 | 63 | ob_clean(); |
| 64 | 64 | $flc_module = 'All'; |
| 65 | 65 | foreach($_POST as $name=>$value){ |
| 66 | - if(substr_count($name, 'act_guid') > 0){ |
|
| 67 | - $name = str_replace('act_guid', '', $name); |
|
| 66 | + if(substr_count($name, 'act_guid') > 0){ |
|
| 67 | + $name = str_replace('act_guid', '', $name); |
|
| 68 | 68 | |
| 69 | - $role->setAction($role->id,$name, $value); |
|
| 70 | - } |
|
| 69 | + $role->setAction($role->id,$name, $value); |
|
| 70 | + } |
|
| 71 | 71 | |
| 72 | 72 | } |
| 73 | 73 | echo "result = {role_id:'$role->id', module:'$flc_module'}"; |
@@ -41,7 +41,7 @@ |
||
| 41 | 41 | |
| 42 | 42 | $role = new ACLRole(); |
| 43 | 43 | if(isset($_REQUEST['record'])){ |
| 44 | - $role->mark_deleted($_REQUEST['record']); |
|
| 44 | + $role->mark_deleted($_REQUEST['record']); |
|
| 45 | 45 | } |
| 46 | 46 | require_once('include/formbase.php'); |
| 47 | 47 | handleRedirect(); |
@@ -42,27 +42,27 @@ discard block |
||
| 42 | 42 | |
| 43 | 43 | class AuthenticationController |
| 44 | 44 | { |
| 45 | - public $loggedIn = false; //if a user has attempted to login |
|
| 46 | - public $authenticated = false; |
|
| 47 | - public $loginSuccess = false;// if a user has successfully logged in |
|
| 45 | + public $loggedIn = false; //if a user has attempted to login |
|
| 46 | + public $authenticated = false; |
|
| 47 | + public $loginSuccess = false;// if a user has successfully logged in |
|
| 48 | 48 | |
| 49 | - protected static $authcontrollerinstance = null; |
|
| 49 | + protected static $authcontrollerinstance = null; |
|
| 50 | 50 | |
| 51 | 51 | /** |
| 52 | 52 | * @var SugarAuthenticate |
| 53 | 53 | */ |
| 54 | 54 | public $authController; |
| 55 | 55 | |
| 56 | - /** |
|
| 57 | - * Creates an instance of the authentication controller and loads it |
|
| 58 | - * |
|
| 59 | - * @param STRING $type - the authentication Controller |
|
| 60 | - * @return AuthenticationController - |
|
| 61 | - */ |
|
| 62 | - public function __construct($type = null) |
|
| 63 | - { |
|
| 56 | + /** |
|
| 57 | + * Creates an instance of the authentication controller and loads it |
|
| 58 | + * |
|
| 59 | + * @param STRING $type - the authentication Controller |
|
| 60 | + * @return AuthenticationController - |
|
| 61 | + */ |
|
| 62 | + public function __construct($type = null) |
|
| 63 | + { |
|
| 64 | 64 | $this->authController = $this->getAuthController($type); |
| 65 | - } |
|
| 65 | + } |
|
| 66 | 66 | |
| 67 | 67 | /** |
| 68 | 68 | * Get auth controller object |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | } |
| 82 | 82 | |
| 83 | 83 | // check in custom dir first, in case someone want's to override an auth controller |
| 84 | - if (file_exists('custom/modules/Users/authentication/'.$type.'/' . $type . '.php')) { |
|
| 84 | + if (file_exists('custom/modules/Users/authentication/'.$type.'/' . $type . '.php')) { |
|
| 85 | 85 | require_once('custom/modules/Users/authentication/'.$type.'/' . $type . '.php'); |
| 86 | 86 | } elseif (file_exists('modules/Users/authentication/'.$type.'/' . $type . '.php')) { |
| 87 | 87 | require_once('modules/Users/authentication/'.$type.'/' . $type . '.php'); |
@@ -98,123 +98,123 @@ discard block |
||
| 98 | 98 | return new $type(); |
| 99 | 99 | } |
| 100 | 100 | |
| 101 | - /** |
|
| 102 | - * Returns an instance of the authentication controller |
|
| 103 | - * |
|
| 104 | - * @param string $type this is the type of authetnication you want to use default is SugarAuthenticate |
|
| 105 | - * @return an instance of the authetnciation controller |
|
| 106 | - */ |
|
| 107 | - public static function getInstance($type = null) |
|
| 108 | - { |
|
| 109 | - if (empty(self::$authcontrollerinstance)) { |
|
| 110 | - self::$authcontrollerinstance = new AuthenticationController($type); |
|
| 111 | - } |
|
| 112 | - |
|
| 113 | - return self::$authcontrollerinstance; |
|
| 114 | - } |
|
| 115 | - |
|
| 116 | - /** |
|
| 117 | - * This function is called when a user initially tries to login. |
|
| 118 | - * |
|
| 119 | - * @param string $username |
|
| 120 | - * @param string $password |
|
| 121 | - * @param array $PARAMS |
|
| 122 | - * @return boolean true if the user successfully logs in or false otherwise. |
|
| 123 | - */ |
|
| 124 | - public function login($username, $password, $PARAMS = array()) |
|
| 125 | - { |
|
| 126 | - //kbrill bug #13225 |
|
| 127 | - $_SESSION['loginAttempts'] = (isset($_SESSION['loginAttempts']))? $_SESSION['loginAttempts'] + 1: 1; |
|
| 128 | - unset($GLOBALS['login_error']); |
|
| 129 | - |
|
| 130 | - if($this->loggedIn)return $this->loginSuccess; |
|
| 131 | - LogicHook::initialize()->call_custom_logic('Users', 'before_login'); |
|
| 132 | - |
|
| 133 | - $this->loginSuccess = $this->authController->loginAuthenticate($username, $password, false, $PARAMS); |
|
| 134 | - $this->loggedIn = true; |
|
| 135 | - |
|
| 136 | - if($this->loginSuccess){ |
|
| 137 | - //Ensure the user is authorized |
|
| 138 | - checkAuthUserStatus(); |
|
| 139 | - |
|
| 140 | - //loginLicense(); |
|
| 141 | - if(!empty($GLOBALS['login_error'])){ |
|
| 142 | - unset($_SESSION['authenticated_user_id']); |
|
| 143 | - $GLOBALS['log']->fatal('FAILED LOGIN: potential hack attempt:'.$GLOBALS['login_error']); |
|
| 144 | - $this->loginSuccess = false; |
|
| 145 | - return false; |
|
| 146 | - } |
|
| 147 | - |
|
| 148 | - //call business logic hook |
|
| 149 | - if(isset($GLOBALS['current_user'])) |
|
| 150 | - $GLOBALS['current_user']->call_custom_logic('after_login'); |
|
| 151 | - |
|
| 152 | - // Check for running Admin Wizard |
|
| 153 | - $config = new Administration(); |
|
| 154 | - $config->retrieveSettings(); |
|
| 155 | - if ( is_admin($GLOBALS['current_user']) && empty($config->settings['system_adminwizard']) && $_REQUEST['action'] != 'AdminWizard' ) { |
|
| 156 | - $GLOBALS['module'] = 'Configurator'; |
|
| 157 | - $GLOBALS['action'] = 'AdminWizard'; |
|
| 158 | - ob_clean(); |
|
| 159 | - header("Location: index.php?module=Configurator&action=AdminWizard"); |
|
| 160 | - sugar_cleanup(true); |
|
| 161 | - } |
|
| 162 | - |
|
| 163 | - $ut = $GLOBALS['current_user']->getPreference('ut'); |
|
| 164 | - $checkTimeZone = true; |
|
| 165 | - if (is_array($PARAMS) && !empty($PARAMS) && isset($PARAMS['passwordEncrypted'])) { |
|
| 166 | - $checkTimeZone = false; |
|
| 167 | - } // if |
|
| 168 | - if(empty($ut) && $checkTimeZone && $_REQUEST['action'] != 'SetTimezone' && $_REQUEST['action'] != 'SaveTimezone' ) { |
|
| 169 | - $GLOBALS['module'] = 'Users'; |
|
| 170 | - $GLOBALS['action'] = 'Wizard'; |
|
| 171 | - ob_clean(); |
|
| 172 | - header("Location: index.php?module=Users&action=Wizard"); |
|
| 173 | - sugar_cleanup(true); |
|
| 174 | - } |
|
| 175 | - }else{ |
|
| 176 | - //kbrill bug #13225 |
|
| 177 | - LogicHook::initialize(); |
|
| 178 | - $GLOBALS['logic_hook']->call_custom_logic('Users', 'login_failed'); |
|
| 179 | - $GLOBALS['log']->fatal('FAILED LOGIN:attempts[' .$_SESSION['loginAttempts'] .'] - '. $username); |
|
| 180 | - } |
|
| 181 | - // if password has expired, set a session variable |
|
| 182 | - |
|
| 183 | - return $this->loginSuccess; |
|
| 184 | - } |
|
| 185 | - |
|
| 186 | - /** |
|
| 187 | - * This is called on every page hit. |
|
| 188 | - * It returns true if the current session is authenticated or false otherwise |
|
| 189 | - * |
|
| 190 | - * @return booelan |
|
| 191 | - */ |
|
| 192 | - public function sessionAuthenticate() |
|
| 193 | - { |
|
| 194 | - if(!$this->authenticated){ |
|
| 195 | - $this->authenticated = $this->authController->sessionAuthenticate(); |
|
| 196 | - } |
|
| 197 | - if($this->authenticated){ |
|
| 198 | - if(!isset($_SESSION['userStats']['pages'])){ |
|
| 199 | - $_SESSION['userStats']['loginTime'] = time(); |
|
| 200 | - $_SESSION['userStats']['pages'] = 0; |
|
| 201 | - } |
|
| 202 | - $_SESSION['userStats']['lastTime'] = time(); |
|
| 203 | - $_SESSION['userStats']['pages']++; |
|
| 204 | - |
|
| 205 | - } |
|
| 206 | - return $this->authenticated; |
|
| 207 | - } |
|
| 208 | - |
|
| 209 | - /** |
|
| 210 | - * Called when a user requests to logout. Should invalidate the session and redirect |
|
| 211 | - * to the login page. |
|
| 212 | - */ |
|
| 213 | - public function logout() |
|
| 214 | - { |
|
| 215 | - $GLOBALS['current_user']->call_custom_logic('before_logout'); |
|
| 216 | - $this->authController->logout(); |
|
| 217 | - LogicHook::initialize(); |
|
| 218 | - $GLOBALS['logic_hook']->call_custom_logic('Users', 'after_logout'); |
|
| 219 | - } |
|
| 101 | + /** |
|
| 102 | + * Returns an instance of the authentication controller |
|
| 103 | + * |
|
| 104 | + * @param string $type this is the type of authetnication you want to use default is SugarAuthenticate |
|
| 105 | + * @return an instance of the authetnciation controller |
|
| 106 | + */ |
|
| 107 | + public static function getInstance($type = null) |
|
| 108 | + { |
|
| 109 | + if (empty(self::$authcontrollerinstance)) { |
|
| 110 | + self::$authcontrollerinstance = new AuthenticationController($type); |
|
| 111 | + } |
|
| 112 | + |
|
| 113 | + return self::$authcontrollerinstance; |
|
| 114 | + } |
|
| 115 | + |
|
| 116 | + /** |
|
| 117 | + * This function is called when a user initially tries to login. |
|
| 118 | + * |
|
| 119 | + * @param string $username |
|
| 120 | + * @param string $password |
|
| 121 | + * @param array $PARAMS |
|
| 122 | + * @return boolean true if the user successfully logs in or false otherwise. |
|
| 123 | + */ |
|
| 124 | + public function login($username, $password, $PARAMS = array()) |
|
| 125 | + { |
|
| 126 | + //kbrill bug #13225 |
|
| 127 | + $_SESSION['loginAttempts'] = (isset($_SESSION['loginAttempts']))? $_SESSION['loginAttempts'] + 1: 1; |
|
| 128 | + unset($GLOBALS['login_error']); |
|
| 129 | + |
|
| 130 | + if($this->loggedIn)return $this->loginSuccess; |
|
| 131 | + LogicHook::initialize()->call_custom_logic('Users', 'before_login'); |
|
| 132 | + |
|
| 133 | + $this->loginSuccess = $this->authController->loginAuthenticate($username, $password, false, $PARAMS); |
|
| 134 | + $this->loggedIn = true; |
|
| 135 | + |
|
| 136 | + if($this->loginSuccess){ |
|
| 137 | + //Ensure the user is authorized |
|
| 138 | + checkAuthUserStatus(); |
|
| 139 | + |
|
| 140 | + //loginLicense(); |
|
| 141 | + if(!empty($GLOBALS['login_error'])){ |
|
| 142 | + unset($_SESSION['authenticated_user_id']); |
|
| 143 | + $GLOBALS['log']->fatal('FAILED LOGIN: potential hack attempt:'.$GLOBALS['login_error']); |
|
| 144 | + $this->loginSuccess = false; |
|
| 145 | + return false; |
|
| 146 | + } |
|
| 147 | + |
|
| 148 | + //call business logic hook |
|
| 149 | + if(isset($GLOBALS['current_user'])) |
|
| 150 | + $GLOBALS['current_user']->call_custom_logic('after_login'); |
|
| 151 | + |
|
| 152 | + // Check for running Admin Wizard |
|
| 153 | + $config = new Administration(); |
|
| 154 | + $config->retrieveSettings(); |
|
| 155 | + if ( is_admin($GLOBALS['current_user']) && empty($config->settings['system_adminwizard']) && $_REQUEST['action'] != 'AdminWizard' ) { |
|
| 156 | + $GLOBALS['module'] = 'Configurator'; |
|
| 157 | + $GLOBALS['action'] = 'AdminWizard'; |
|
| 158 | + ob_clean(); |
|
| 159 | + header("Location: index.php?module=Configurator&action=AdminWizard"); |
|
| 160 | + sugar_cleanup(true); |
|
| 161 | + } |
|
| 162 | + |
|
| 163 | + $ut = $GLOBALS['current_user']->getPreference('ut'); |
|
| 164 | + $checkTimeZone = true; |
|
| 165 | + if (is_array($PARAMS) && !empty($PARAMS) && isset($PARAMS['passwordEncrypted'])) { |
|
| 166 | + $checkTimeZone = false; |
|
| 167 | + } // if |
|
| 168 | + if(empty($ut) && $checkTimeZone && $_REQUEST['action'] != 'SetTimezone' && $_REQUEST['action'] != 'SaveTimezone' ) { |
|
| 169 | + $GLOBALS['module'] = 'Users'; |
|
| 170 | + $GLOBALS['action'] = 'Wizard'; |
|
| 171 | + ob_clean(); |
|
| 172 | + header("Location: index.php?module=Users&action=Wizard"); |
|
| 173 | + sugar_cleanup(true); |
|
| 174 | + } |
|
| 175 | + }else{ |
|
| 176 | + //kbrill bug #13225 |
|
| 177 | + LogicHook::initialize(); |
|
| 178 | + $GLOBALS['logic_hook']->call_custom_logic('Users', 'login_failed'); |
|
| 179 | + $GLOBALS['log']->fatal('FAILED LOGIN:attempts[' .$_SESSION['loginAttempts'] .'] - '. $username); |
|
| 180 | + } |
|
| 181 | + // if password has expired, set a session variable |
|
| 182 | + |
|
| 183 | + return $this->loginSuccess; |
|
| 184 | + } |
|
| 185 | + |
|
| 186 | + /** |
|
| 187 | + * This is called on every page hit. |
|
| 188 | + * It returns true if the current session is authenticated or false otherwise |
|
| 189 | + * |
|
| 190 | + * @return booelan |
|
| 191 | + */ |
|
| 192 | + public function sessionAuthenticate() |
|
| 193 | + { |
|
| 194 | + if(!$this->authenticated){ |
|
| 195 | + $this->authenticated = $this->authController->sessionAuthenticate(); |
|
| 196 | + } |
|
| 197 | + if($this->authenticated){ |
|
| 198 | + if(!isset($_SESSION['userStats']['pages'])){ |
|
| 199 | + $_SESSION['userStats']['loginTime'] = time(); |
|
| 200 | + $_SESSION['userStats']['pages'] = 0; |
|
| 201 | + } |
|
| 202 | + $_SESSION['userStats']['lastTime'] = time(); |
|
| 203 | + $_SESSION['userStats']['pages']++; |
|
| 204 | + |
|
| 205 | + } |
|
| 206 | + return $this->authenticated; |
|
| 207 | + } |
|
| 208 | + |
|
| 209 | + /** |
|
| 210 | + * Called when a user requests to logout. Should invalidate the session and redirect |
|
| 211 | + * to the login page. |
|
| 212 | + */ |
|
| 213 | + public function logout() |
|
| 214 | + { |
|
| 215 | + $GLOBALS['current_user']->call_custom_logic('before_logout'); |
|
| 216 | + $this->authController->logout(); |
|
| 217 | + LogicHook::initialize(); |
|
| 218 | + $GLOBALS['logic_hook']->call_custom_logic('Users', 'after_logout'); |
|
| 219 | + } |
|
| 220 | 220 | } |