The signal receiver component ‚FbLogin‘ is not found

Upozornění: Tohle vlákno je hodně staré a informace nemusí být platné pro současné Nette.
Duch.Veliky
Člen | 68
+
0
-

Zdravím,

potřeboval bych poradit. Snažím se zprovoznit Kdyby/facebook a nedaří se mi to. V podstatě teď jsem ve fázi, že mám v šabloně:

<a n:href="FbLogin-open!">Login using facebook</a>

a vrací mi to:
The signal receiver component ‚FbLogin‘ is not found.

ale v BasePresenteru ho mám:

namespace App\Presenters;

use Nette,
    App\Model,
    Nette\Application\UI\Form,
    Nette\DateTime,
    Kdyby\Facebook\Facebook,
    Kdyby\Facebook\Dialog\LoginDialog,
    Kdyby\Facebook\FacebookApiException,
    Nette\Diagnostics\Debugger;


/**
 * Base presenter for all application presenters.
 */
abstract class BasePresenter extends Nette\Application\UI\Presenter
{

    /** @var database */
    public $database;

    /** @var Facebook */
    private $facebook;

    public function __construct(Nette\Database\Context $database, Facebook $facebook)
    {
        parent::__construct();
        $this->database = $database;
        $this->facebook = $facebook;
    }

    /** @return LoginDialog */
    protected function createComponentFbLogin()
    {
        $dialog = $this->facebook->createDialog('login');
        /** @var LoginDialog $dialog */

        $dialog->onResponse[] = function (LoginDialog $dialog) {
            $fb = $dialog->getFacebook();

            if ( ! $fb->getUser()) {
                $this->flashMessage("Sorry bro, facebook authentication failed.");
                return;
            }

            /**
             * If we get here, it means that the user was recognized
             * and we can call the Facebook API
             */

            try {
                $me = $fb->api('/me');

                if (!$existing = $this->usersModel->findByFacebookId($fb->getUser())) {
                    /**
                     * Variable $me contains all the public information about the user
                     * including facebook id, name and email, if he allowed you to see it.
                     */
                    $existing = $this->usersModel->registerFromFacebook($fb->getUser(), $me);
                }

                /**
                 * You should save the access token to database for later usage.
                 *
                 * You will need it when you'll want to call Facebook API,
                 * when the user is not logged in to your website,
                 * with the access token in his session.
                 */
                $this->usersModel->updateFacebookAccessToken($fb->getUser(), $fb->getAccessToken());

                /**
                 * Nette\Security\User accepts not only textual credentials,
                 * but even an identity instance!
                 */
                $this->user->login(new \Nette\Security\Identity($existing->id, $existing->roles, $existing));

                /**
                 * You can celebrate now! The user is authenticated :)
                 */

            } catch (FacebookApiException $e) {
                /**
                 * You might wanna know what happened, so let's log the exception.
                 *
                 * Rendering entire bluescreen is kind of slow task,
                 * so might wanna log only $e->getMessage(), it's up to you
                 */
                Debugger::log($e, 'facebook');
                $this->flashMessage("Sorry bro, facebook authentication failed hard.");
            }

            $this->redirect('this');
        };

        return $dialog;
    }

}

Poradí mi prosím někdo, co dělám blbě? Už jsem prohledal i diskuse co to byly a pár lidí to řešilo, ale odpověď jsem podle toho nenašel.

David Matějka
Moderator | 6445
+
+2
-

zkus FbLogin-open!fbLogin-open! (male pismeno na zacatku)

Duch.Veliky
Člen | 68
+
0
-

No jo, už to jde :-) ch jo, díky moc