public function executeAction($parameters) { // user could not be logged out if (strlen(FacebookSdk::getInstance($this->_websoccer)->getUserEmail())) { $this->_websoccer->addFrontMessage(new FrontMessage(MESSAGE_TYPE_ERROR, $this->_i18n->getMessage("facebooklogout_failure"), "")); return null; } $this->_websoccer->addFrontMessage(new FrontMessage(MESSAGE_TYPE_SUCCESS, $this->_i18n->getMessage("facebooklogout_success"), $this->_i18n->getMessage("facebooklogout_success_details"))); return "home"; }
public function executeAction($parameters) { // authenticate $userEmail = FacebookSdk::getInstance($this->_websoccer)->getUserEmail(); // not authenticated if (!strlen($userEmail)) { $this->_websoccer->addFrontMessage(new FrontMessage(MESSAGE_TYPE_WARNING, $this->_i18n->getMessage("facebooklogin_failure"), "")); return "home"; } // authenticated. Check if user exists. $userEmail = strtolower($userEmail); $userId = UsersDataService::getUserIdByEmail($this->_websoccer, $this->_db, $userEmail); // if does not exist, then create new user if ($userId < 1) { $userId = UsersDataService::createLocalUser($this->_websoccer, $this->_db, null, $userEmail); } // log in user SecurityUtil::loginFrontUserUsingApplicationSession($this->_websoccer, $userId); $this->_websoccer->addFrontMessage(new FrontMessage(MESSAGE_TYPE_SUCCESS, $this->_i18n->getMessage("facebooklogin_success"), "")); return strlen($this->_websoccer->getUser()->username) ? "office" : "enter-username"; }
public function getTemplateParameters() { return array("loginurl" => FacebookSdk::getInstance($this->_websoccer)->getLoginUrl()); }