コード例 #1
0
ファイル: UserInfo.php プロジェクト: ngreimel/kovent
 public function changePassword($newPassword)
 {
     $db = Loader::db();
     if ($this->uID) {
         $dh = Loader::helper('date');
         $dateTime = $dh->getOverridableNow();
         $v = array($this->getUserObject()->getUserPasswordHasher()->HashPassword($newPassword), $dateTime, $this->uID);
         $q = "update Users set uPassword = ?, uLastPasswordChange = ?  where uID = ?";
         $r = $db->prepare($q);
         $res = $db->execute($r, $v);
         $ue = new \Concrete\Core\User\Event\UserInfoWithPassword($this);
         $ue->setUserPassword($newPassword);
         $currentUser = new User();
         $session = Core::make('session');
         if ($currentUser->isLoggedIn() && $currentUser->getUserID() == $session->get('uID')) {
             $session->set('uLastPasswordChange', $dateTime);
         }
         Events::dispatch('on_user_change_password', $ue);
         return $res;
     }
 }
コード例 #2
0
 /**
  * Test user authentication status.
  *
  * @param \User $u
  *
  * @return bool Returns true if user is authenticated, false if not
  */
 public function isAuthenticated(User $u)
 {
     return $u->isLoggedIn();
 }