Logout method don't work, help needed

2 years ago

ms31864
Member | 6
+
0
-

What is the best way to deal with logout?

Can anyone help me with this, I tried to add into my latte file but it doesn't work <?php <a n:href=“Login:actionOut”>Sign Out</a> ?>.

Thank you

2 years ago

CZechBoY
Member | 3207
+
0
-

You have to implement actionActionOut method in LoginPresenter.
You can take code from sandbox
https://github.com/…resenter.php#L46

2 years ago

ms31864
Member | 6
+
0
-

Yes but how to call that method in my latte file or how is the best way to do that in my latte file?

Thanks for support

2 years ago

ms31864
Member | 6
+
0
-

I forgot to tell you I had that method implemented with that code like in the sandbox but it doesn't work just calling it so in the latte file.

2 years ago

CZechBoY
Member | 3207
+
0
-

What mean “call in latte file”?
You create link to that action and click in web browser. Then you are logged out.

2 years ago

ms31864
Member | 6
+
0
-

Here is how ti looks into my latte file <li><a n:href="Login:actionOut">Sign Out</a></li> and my LoginPresent has this method that does this

<?php
    public function actionOut()
    {
        $this->getUser()->logout();
        $this->redirect('in');
    }
?>

2 years ago

petr.jirous
Member | 135
+
+2
-

<a n:href="Login:out">Sign out</a>

2 years ago

ms31864
Member | 6
+
0
-

Sorry I'm young in Nette but this method does not exist in my Presenter so how will that work, and also I have another question is there any good resource for English tutorial.

Thanks

2 years ago

CZechBoY
Member | 3207
+
+1
-

You can read english documentation.
Href to out means that actionOut and renderOut will be called in presenter (if they exists of course).

2 years ago

ms31864
Member | 6
+
0
-

Thanks man that worked for me