예제 #1
0
 /**
  * @return string
  */
 public function getId()
 {
     if ($this->profileId === 'me') {
         return $this->facebook->getUser();
     }
     return $this->profileId;
 }
예제 #2
0
 public function facebookRegistrationFormSucceeded($form, $values)
 {
     $fbUserId = $values->id;
     unset($values->id);
     try {
         if ($this->facebookUserModel->exists($fbUserId)) {
             $this->flashMessage("Uživatel s tímto FacebookID již je v systému zaregistrován.", "danger");
             $this->redirect("in");
         } else {
             $id = $this->model->insert($values);
             $this->model->update($id, array("enabled" => 1, "active" => 1));
             $this->flashMessage("Uživatel byl úspěšně zaregistrován.", "success");
             $this->facebookUserModel->add(array("user_id" => $id, "facebook_id" => $fbUserId, "username" => $values->firstname . " " . $values->lastname, "email" => $values->email));
             $this->facebookUserModel->authenticate(array($this->facebook->getUser()));
             $this->facebookUserModel->updateToken($this->facebook->getUser(), $this->facebook->getAccessToken());
         }
     } catch (Exception $e) {
         $this->flashMessage("Registrace uživatele se nepodařila.", "danger");
     }
     $this->redirect(":Front:Homepage:default");
 }
예제 #3
0
 /**
  * Synchronize user state with facebook.
  */
 public function syncFacebookSession()
 {
     if ($this->facebook->getUser() && $this->isUserChangeState()) {
         $this->facebook->destroySession();
     }
 }