Пример #1
0
 /**
  * Create User Entity from adUser
  *
  * @param Models\User $adUser
  *
  * @return null|user
  */
 protected function createUserFromAd(Models\User $adUser)
 {
     $user = new User();
     $user->fullName = $adUser->getDisplayName();
     $user->userName = $adUser->getAccountName();
     $user->email = $adUser->getEmail();
     $user->phone = $adUser->getTelephoneNumber();
     $user->title = $adUser->getTitle();
     $user->thumbnail = $adUser->getThumbnailEncoded();
     // save user
     if ($this->userRepository->save($user)) {
         $userActivity = new UserActivity();
         $userActivity->userId = $user->id;
         $userActivity->type = "createFromAuthDriver";
         $userActivity->description = "Auto create from " . $this->getName();
         $this->userActivityRepository->save($userActivity);
     } else {
         $user = null;
     }
     return $user;
 }
Пример #2
0
 /**
  * Change password and reset tokens.
  *
  * @param integer $userId
  * @param string  $newPassword
  *
  * @return boolean
  */
 public function changePassword($userId, $newPassword)
 {
     return $this->userRepository->changePassword($userId, Nette\Security\Passwords::hash($newPassword));
 }