|
From: <men...@us...> - 2011-09-09 12:43:25
|
Revision: 6
http://gemstracker.svn.sourceforge.net/gemstracker/?rev=6&view=rev
Author: mennodekker
Date: 2011-09-09 12:43:19 +0000 (Fri, 09 Sep 2011)
Log Message:
-----------
Removing the view, had to change the validator too as it is used in change password. This needs to be changed when alternative auth backends are added
Modified Paths:
--------------
trunk/library/classes/Gems/Validate/GemsPasswordUsername.php
Removed Paths:
-------------
trunk/library/configs/db/views/
trunk/library/configs/db_multi_layout/views/
Modified: trunk/library/classes/Gems/Validate/GemsPasswordUsername.php
===================================================================
--- trunk/library/classes/Gems/Validate/GemsPasswordUsername.php 2011-09-09 12:30:13 UTC (rev 5)
+++ trunk/library/classes/Gems/Validate/GemsPasswordUsername.php 2011-09-09 12:43:19 UTC (rev 6)
@@ -1,39 +1,39 @@
<?php
-
-/**
- * Copyright (c) 2011, Erasmus MC
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name of Erasmus MC nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+/**
+ * Copyright (c) 2011, Erasmus MC
+ * All rights reserved.
*
- * @version $Id: GemsPasswordUsername.php 345 2011-07-28 08:39:24Z 175780 $
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of Erasmus MC nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * @version $Id: GemsPasswordUsername.php 345 2011-07-28 08:39:24Z 175780 $
* @package Gems
* @subpackage Validate
* @copyright Copyright (c) 2011 Erasmus MC
* @license New BSD License
*/
-
-/**
+
+/**
* OBSOLETE, we now use Gems_Auth with a Zend_Auth_Adapter_DbTable
*
* @deprecated
@@ -66,7 +66,7 @@
protected $_passwordField;
protected $_usernameField;
-
+
/**
* Exponent to use when calculating delay
* @var int
@@ -86,11 +86,11 @@
*/
public function __construct($usernameField, $passwordField, Zend_Db_Adapter_Abstract $adapter = null, $delayFactor = null)
{
- parent::__construct('gems__login_info', 'user_login', null, $adapter);
+ parent::__construct('gems__staff', 'gsf_login', null, $adapter);
$this->_usernameField = $usernameField;
$this->_passwordField = $passwordField;
-
+
if (isset($delayFactor)) {
$this->_delayFactor = $delayFactor;
}
@@ -136,8 +136,8 @@
throw new Zend_Validate_Exception('No database adapter present');
}
}
-
- $condition = $this->_adapter->quoteIdentifier('user_password') . ' = ?';
+
+ $condition = $this->_adapter->quoteIdentifier('gsf_password') . ' = ?';
$this->_exclude = $this->_adapter->quoteInto($condition, md5($password));
try {
@@ -145,24 +145,24 @@
* Lookup last failed login and number of failed logins
*/
try {
- $sql = "SELECT user_failed_logins, UNIX_TIMESTAMP(user_last_failed)
- AS user_last_failed FROM {$this->_table} WHERE user_login = ?";
+ $sql = "SELECT gsf_failed_logins, UNIX_TIMESTAMP(gsf_last_failed)
+ AS gsf_last_failed FROM {$this->_table} WHERE gsf_login = ?";
$results = $this->_adapter->fetchRow($sql, array($username));
} catch (Zend_Db_Exception $zde) {
//If we need to apply a db patch, just use a default value
$results = 0;
MUtil_Echo::r(GemsEscort::getInstance()->translate->_('Please update the database'));
}
-
- $delay = pow($results['user_failed_logins'], $this->_delayFactor);
- $remaining = ($results['user_last_failed'] + $delay) - time();
-
- if ($results['user_failed_logins'] > 0 && $remaining > 0) {
+
+ $delay = pow($results['gsf_failed_logins'], $this->_delayFactor);
+ $remaining = ($results['gsf_last_failed'] + $delay) - time();
+
+ if ($results['gsf_failed_logins'] > 0 && $remaining > 0) {
$this->_obscureValue = false;
$this->_error(self::ERROR_PASSWORD_DELAY, ceil($remaining / 60));
return false;
}
-
+
if ($this->_query($username)) {
return true;
} else {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|