当前位置: 首页>>代码示例>>PHP>>正文


PHP UserInfo::getByValidationHash方法代码示例

本文整理汇总了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.'));
     }
 }
开发者ID:ricardomccerqueira,项目名称:rcerqueira.portfolio,代码行数:44,代码来源:login.php

示例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');
 }
开发者ID:hdk0016,项目名称:concrete5-1,代码行数:12,代码来源:controller.php


注:本文中的UserInfo::getByValidationHash方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。