當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。