In the standard web2py authentication is triggered by @auth.requires_login decorator if the user is not authenticated already.
in model after defining a class FacebookAccount() extended from gluon.contrib.oauth20_account.OAuthAccount auth.settings.login_form = FacebookAccount() # change default login action # default is auth.settings.login_url = URL('user', args='login') auth.settings.login_url = URL(c='mycontroller', f='my_login_action', args=['login']) in mycontroller.py: def my_login_action(): """same as default/login action""" return dict(form=auth()) @auth.requires_login(): def f(): ... 2016-04-11 7:21 GMT+02:00 killzane <killz...@gmail.com>: > I see all settings but I don't know what attribute I should change. > the *redirect_uri* args I mean is when log with facebook will goto > > https://www.facebook.com/dialog/oauth? > client_id=568390199919780& > scope=email,user_birthday& > *redirect_uri*=https://my_domain/[app]/default/user/login > > because if the rediect_uri don't have the *FaceBookAccount()* instance it > will show error and can't login success. > > So I just use a "_blank" link to open my *fbLogin *page? > > mcm於 2016年4月11日星期一 UTC+8上午3時48分18秒寫道: >> >> You should be able to change redirect url using the standard settings of >> auth. >> >> >> http://www.web2py.com/books/default/chapter/29/09/access-control#Auth-Settings-and-messages >> >> You do not need ajax, just a window.open() or a <a href=".." >> target="_blank"> or an iframe >> >> >> >> 2016-04-10 9:38 GMT+02:00 killzane <kill...@gmail.com>: >> >>> I followed the web2py book >>> http://web2py.com/books/default/chapter/29/09/access-control#Other-login-methods-and-login-forms >>> and >>> put the example code in my model >>> >>> and I use this in my controllers named *default.py* >>> def fbLogin(): >>> auth.settings.login_form=FaceBookAccount() >>> form = auth() >>> >>> return dict(form=form) >>> >>> When I visit this page, I can see facebook Oauth. >>> there are some problem I want to solve. >>> 1. why the *redirect_uri* set to [app]/default/user/login but not >>> [app]/default/fbLogin? >>> may I set it manual? >>> >>> 2. facebook suggest me to show a window to show the Oauth page, but I'm >>> not really know how to do it in web2py. >>> I should use ajax to do it? or some other way? >>> >>> -- >>> 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 web2py+un...@googlegroups.com. >>> For more options, visit https://groups.google.com/d/optout. >>> >> >> -- > 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 web2py+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. > -- 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 web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.