## if you need to use OpenID, Facebook, MySpace, Twitter, Linkedin, etc. ## register with janrain.com, write your domain:api_key in private/janrain.key #from gluon.contrib.login_methods.rpx_account import use_janrain #use_janrain(auth,filename='private/janrain.key') try: from gluon.contrib.login_methods.janrain_account import RPXAccount except: print "Warning you should upgrade to a newer web2py for better janrain support" from gluon.contrib.login_methods.rpx_account import RPXAccount from gluon.contrib.login_methods.extended_login_form import ExtendedLoginForm janrain_url = 'http://%s/%s/default/user/login' % (request.env.http_host, request.application) janrain_form = RPXAccount(request, api_key=settings.janrain_api_key, # set in 1.py domain=settings.janrain_domain, # set in 1.py url=janrain_url) auth.settings.login_form = ExtendedLoginForm(auth, janrain_form) # uncomment this to use both Janrain and web2py auth #auth.settings.login_form = auth # uncomment this to just use web2py integrated authentication request.janrain_form = janrain_form # save the form so that it can be added to the user/register controller ######################################################################### ## Define your tables below (or better in another model file) for example ## ## >>> db.define_table('mytable',Field('myfield','string')) ## ## Fields can be 'string','text','password','integer','double','boolean' ## 'date','time','datetime','blob','upload', 'reference TABLENAME' ## There is an implicit 'id integer autoincrement' field ## Consult manual for more options, validators, etc.
# >>> db.mytable.insert(myfield='value') # >>> rows = db(db.mytable.myfield == 'value').select(db.mytable.ALL) # >>> for row in rows: print row.id, row.myfield # ------------------------------------------------------------------------- # ------------------------------------------------------------------------- # after defining tables, uncomment below to enable auditing # ------------------------------------------------------------------------- auth.enable_record_versioning(db) from gluon.contrib.login_methods.janrain_account import RPXAccount from gluon.contrib.login_methods.extended_login_form import ExtendedLoginForm RPXAccount_form = RPXAccount(request, api_key=settings.janrain_secret_key, domain=settings.janrain_app_name, language="ja", url="http://%s/%s/default/user/login" % (request.env.http_host, request.application)) auth.settings.login_form = ExtendedLoginForm(auth, RPXAccount_form, signals=['token']) auth.settings.formstyle = 'table2cols' auth.settings.registration_requires_verification = False auth.settings.login_after_registration = False auth.settings.register_fields = ['first_name', 'email', 'password'] auth.settings.profile_fields = ['first_name', 'email'] auth.settings.update_fields = [] RPXAccount_form.mappings.Twitter = lambda profile:\ dict(registration_id = profile["identifier"],