Created
August 1, 2014 20:35
-
-
Save hissy/784b283032b3d3367b93 to your computer and use it in GitHub Desktop.
[concrete5] add expiry time to user registration validation hash (~5.6.x)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
defined('C5_EXECUTE') or die("Access Denied."); | |
class UserInfo extends Concrete5_Model_UserInfo { | |
public static function getByValidationHash($uHash, $unredeemedHashesOnly = true, $passtimestamp = 604800) { | |
$uDateGenerated = time() - $passtimestamp; | |
$db = Loader::db(); | |
if ($unredeemedHashesOnly) { | |
$uID = $db->GetOne("select uID from UserValidationHashes where uHash = ? and uDateRedeemed = 0 and uDateGenerated > ?", array($uHash,$uDateGenerated)); | |
} else { | |
$uID = $db->GetOne("select uID from UserValidationHashes where uHash = ? and uDateGenerated > ?", array($uHash,$uDateGenerated)); | |
} | |
if ($uID) { | |
$ui = UserInfo::getByID($uID); | |
return $ui; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment