Why are you writing your own login function? What is wrong with the one in Auth (http://web2py.com/books/default/chapter/29/09/access-control#)?
When I have used the Auth facilities, and I want to restrict access to a page, I use the decorater @auth.requires_login() before my controller function (say index()). When a user tries to visit index, they are routed to a login page, after login they are routed to index(), the controller they were trying to visit in the first place. Sorry if you already know all this which is documented in the link above. On Saturday, 11 July 2020 at 07:44:58 UTC+1 [email protected] wrote: > > *By default, after a successful login the page directs to "default/index". > I want it to redirect to some other page.* > > This my controller code "user.py" > > def login(): > form=auth.login() > if form.process().accepted: > redirect(URL('page_1')) > return dict(form=form) > > This is the view code for "user/login": > > <!DOCTYPE html><html lang="en"><head> > <meta charset="UTF-8"> > <meta name="viewport" content="width=device-width, initial-scale=1.0"> > <title>Document</title></head><body> > <div class="container"> > > <div class="form-container"> > {{=form.custom.begin}} > > > <input type="text" name="email" placeholder="email id" > class="string" id="auth_user_email" value="" /> > > <input placeholder="Password" name="password" class="password" > id="auth_user_password" type="password" class="field" value="" /> > <div class="wrap"> > <input name="submit" type="submit" class="btn" > value="{{=T('Login')}}" /> > <input name="sign_up" class="btn" type="submit" > formaction='/{{=request.application}}/default/user/register' > value="{{=T('Sign Up')}}"/> > </div> > <input name="Forgot Password" type="submit" class="btn" > value="{{=T('Forgot Password')}}" > formaction='/{{=request.application}}/default/user/retrieve_password' /> > {{=form.custom.end}} > </div> > </div> > </body></html> > > *The thing is, when the form is getting processed, it is still redirecting to > the page "default/index". I don't know where to change this default setting > in the application. The code of my controller is not working properly.* > > -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/web2py/8dc8020d-ac90-4dbe-a5dd-84985bb837a4n%40googlegroups.com.

