[Jaws-commits] r13349 - in branches/0.8/html: gadgets/Users gadgets/Users/actions/AdminHTML include/Jaws

afz at jaws-project.com afz at jaws-project.com
Thu Aug 9 19:44:06 UTC 2012


Author: afz
Date: 2012-08-09 19:44:05 +0000 (Thu, 09 Aug 2012)
New Revision: 13349

Modified:
   branches/0.8/html/gadgets/Users/AdminAjax.php
   branches/0.8/html/gadgets/Users/actions/AdminHTML/Users.php
   branches/0.8/html/include/Jaws/User.php
Log:
Check expiry date when user try login to system

Modified: branches/0.8/html/gadgets/Users/AdminAjax.php
===================================================================
--- branches/0.8/html/gadgets/Users/AdminAjax.php	2012-08-09 19:41:43 UTC (rev 13348)
+++ branches/0.8/html/gadgets/Users/AdminAjax.php	2012-08-09 19:44:05 UTC (rev 13349)
@@ -49,7 +49,7 @@
             require_once JAWS_PATH . 'include/Jaws/Gravatar.php';
             $profile['image'] = Jaws_Gravatar::GetGravatar($profile['email'], 48);
             if (!empty($profile['expiry_date'])) {
-                $profile['expiry_date'] = $objDate->Format($profile['expiry_date'], 'Y-m-d');
+                $profile['expiry_date'] = $objDate->Format($profile['expiry_date'], 'Y-m-d H:i:s');
             } else {
                 $profile['expiry_date'] = '';
             }

Modified: branches/0.8/html/gadgets/Users/actions/AdminHTML/Users.php
===================================================================
--- branches/0.8/html/gadgets/Users/actions/AdminHTML/Users.php	2012-08-09 19:41:43 UTC (rev 13348)
+++ branches/0.8/html/gadgets/Users/actions/AdminHTML/Users.php	2012-08-09 19:44:05 UTC (rev 13349)
@@ -317,7 +317,7 @@
         $dExpiry->showTimePicker(true);
         $dExpiry->setLanguageCode($GLOBALS['app']->Registry->Get('/config/calendar_language'));
         $dExpiry->setCalType($GLOBALS['app']->Registry->Get('/config/calendar_type'));
-        $dExpiry->setDateFormat('%Y-%m-%d');
+        $dExpiry->setDateFormat('%Y-%m-%d %H:%M:%S');
         $tpl->SetVariable('lbl_expiry_date', _t('USERS_USERS_EXPIRY_DATE'));
         $tpl->SetVariable('expiry_date', $dExpiry->Get());
 

Modified: branches/0.8/html/include/Jaws/User.php
===================================================================
--- branches/0.8/html/include/Jaws/User.php	2012-08-09 19:41:43 UTC (rev 13348)
+++ branches/0.8/html/include/Jaws/User.php	2012-08-09 19:44:05 UTC (rev 13349)
@@ -51,12 +51,12 @@
 
         $sql = "
             SELECT [id], [passwd], [superadmin], [bad_passwd_count], [concurrent_logins],
-                   [last_access], [status]
+                   [logon_hours], [expiry_date], [last_access], [status]
             FROM [[users]]
             WHERE $username = {user}";
 
         $types = array('integer', 'text', 'boolean', 'integer', 'integer',
-                       'integer', 'integer');
+                       'text', 'integer', 'integer', 'integer');
         $result = $GLOBALS['db']->queryRow($sql, $params, $types);
         if (Jaws_Error::IsError($result)) {
             return $result;
@@ -87,6 +87,12 @@
                                                   JAWS_ERROR_NOTICE);
                 }
 
+                if (!empty($result['expiry_date']) && $result['expiry_date'] <= time()) {
+                    return Jaws_Error::raiseError(_t('GLOBAL_ERROR_LOGIN_EXPIRED'),
+                                                  __FUNCTION__,
+                                                  JAWS_ERROR_NOTICE);
+                }
+
                 return array('id' => $result['id'],
                             'superadmin' => $result['superadmin'],
                             'concurrent_logins' => $result['concurrent_logins']);



More information about the Jaws-commits mailing list