I use this @auth.requires_login()
in my controller before DEF but with that option I get login, form but my menu is visible, it not redirect my page to my login page, just put login form in place of my conteten. after that I tray tu put if statement in layout.html and in if that is checked login, if login exist than can see content but if is not login that it is redirected to login page. And I reed before then ask questions, I see some examples, but my site now I making from zero (after creating project I was delete all files in project folder and now manually adding files to project - from web framework) My login form work, but now I tray to include login detail in some page, like if I have admin/index if somebody tray to access to admin/index and it is not loged in it should be first sent to login page and than redirected to admin/index if provide correct login data thanks - - Miroslav Gojic - - On Wed, Oct 12, 2011 at 13:17, Anthony <abasta...@gmail.com> wrote: > > Have you read the chapter on access > control: http://web2py.com/book/default/chapter/08? The Auth system should be > able to handle this kind of thing for you. You can use @auth decorators on > your actions to require login, group membership, or other arbitrary > conditions. If the user is not logged in, they will be redirected to the > login page automatically, and redirected back to the originally requested > page after login. > Anthony > > On Wednesday, October 12, 2011 2:32:43 AM UTC-4, miroslavgojic wrote: >> >> I have login form (I can regiser, or log in, ...) but how to apply this >> login to some site page. >> >> from login.form I can get user.name or user.id >> >> I need something like if to check this >> >> {{ if user.name == 'user':}} >> go to some page or some content >> {{else:}} >> open login form >> {{pass}} >> >> this is what is on my mind but is this only options or already is something >> implemented by default. >> >> - - Miroslav Gojic - - >> >> >> On Tue, Oct 11, 2011 at 00:10, Massimo Di Pierro <massimo....@gmail.com> >> wrote: >>> >>> In fact this >>> {{if {{=request.function}} == index:}} >>> is wrong because web2py would look for the first {{ and the first }} >>> and try interpret the code in between as python. By >>> >>> "if {{=request.function" is not valid python. >>> >>> You want: >>> >>> {{if request.function == 'index':}} >>> >>> >>> On Oct 10, 4:28 pm, Anthony <abas...@gmail.com> wrote: >>> > > {{if {{=request.function}} == index:}} >>> > >>> > Yes, once you're inside a {{}}, you can write any Python and refer to any >>> > global (or local) variables -- so no need to nest another {{=}} in there.