Skip to content

Instantly share code, notes, and snippets.

@hissy
Created August 1, 2014 20:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hissy/784b283032b3d3367b93 to your computer and use it in GitHub Desktop.
Save hissy/784b283032b3d3367b93 to your computer and use it in GitHub Desktop.
[concrete5] add expiry time to user registration validation hash (~5.6.x)
<?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