本文整理汇总了PHP中UserInfo::getByValidationHash方法的典型用法代码示例。如果您正苦于以下问题:PHP UserInfo::getByValidationHash方法的具体用法?PHP UserInfo::getByValidationHash怎么用?PHP UserInfo::getByValidationHash使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UserInfo
的用法示例。
在下文中一共展示了UserInfo::getByValidationHash方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: change_password
public function change_password($uHash = '')
{
$db = Loader::db();
$h = Loader::helper('validation/identifier');
$e = Loader::helper('validation/error');
$ui = UserInfo::getByValidationHash($uHash);
if (is_object($ui)) {
$hashCreated = $db->GetOne("select uDateGenerated FROM UserValidationHashes where uHash=?", array($uHash));
if ($hashCreated < time() - USER_CHANGE_PASSWORD_URL_LIFETIME) {
$h->deleteKey('UserValidationHashes', 'uHash', $uHash);
throw new Exception(t('Key Expired. Please visit the forgot password page again to have a new key generated.'));
} else {
if (strlen($_POST['uPassword'])) {
$userHelper = Loader::helper('concrete/user');
$userHelper->validNewPassword($_POST['uPassword'], $e);
if (strlen($_POST['uPassword']) && $_POST['uPasswordConfirm'] != $_POST['uPassword']) {
$e->add(t('The two passwords provided do not match.'));
}
if (!$e->has()) {
$ui->changePassword($_POST['uPassword']);
$h->deleteKey('UserValidationHashes', 'uHash', $uHash);
$this->set('passwordChanged', true);
$u = $ui->getUserObject();
if (USER_REGISTRATION_WITH_EMAIL_ADDRESS) {
$_POST['uName'] = $ui->getUserEmail();
} else {
$_POST['uName'] = $u->getUserName();
}
$this->do_login();
return;
} else {
$this->set('uHash', $uHash);
$this->set('changePasswordForm', true);
$this->set('errorMsg', join('<br>', $e->getList()));
}
} else {
$this->set('uHash', $uHash);
$this->set('changePasswordForm', true);
}
}
} else {
throw new Exception(t('Invalid Key. Please visit the forgot password page again to have a new key generated.'));
}
}
示例2: v
public function v($hash = '')
{
$ui = \UserInfo::getByValidationHash($hash);
if (is_object($ui)) {
$ui->markValidated();
$this->set('uEmail', $ui->getUserEmail());
$this->set('validated', true);
$this->redirect('/login/callback/concrete', 'email_validated');
exit;
}
$this->redirect('/login/callback/concrete', 'invalid_token');
}