Exemplo n.º 1
0
 /**
  * Converts a guest user to a registered user.
  *
  * @param Models\User $user
  * @param array $credentials
  * @param bool $activate
  * @return Models\User
  */
 public function convertGuestToUser($user, $credentials, $activate = false)
 {
     $user->fill($credentials);
     $user->convertToRegistered(false);
     // Remove user from guest group
     if ($group = UserGroupModel::getGuestGroup()) {
         $user->groups()->remove($group);
     }
     if ($activate) {
         $user->attemptActivation($user->getActivationCode());
     }
     // Prevents revalidation of the password field
     // on subsequent saves to this model object
     $user->password = null;
     return $this->user = $user;
 }