Moin,
I wrote an app with help of play framework. Now I have a main template which should be used for every request. In this template I have links routing to login form and logout method. Of course only users that are logged out should see the login form and so on. Does anybody know how to implement that without writing every action two times?
Thanks from northern Germany!
I put a gist up on securing actions, which could be of use to you.
Controllers extending the SecureableController trait have:
which allows you to get the user via implicit parameters in views you route to from that controller by specifying:
on each of your views. (Haven’t got a way around that particular boilerplate yet.)
I then have something like this in my menu:
It gives a bootstrap dropdown linking to the Profile page and Logout for a logged in user, and a Login link in place if there is no logged in user.