I added Janrain to my site by using RPX. I pretty much used similar code as in the docs. I have callback functions being called after registering and logging in using login_onaccept and register_onaccept. Everything works great. However, I have noticed that my function attached to register_onaccept is not being called. login_onaccept is being called instead. I can't figure out why. Below is my code. I just need to make sure register_onaccept is called when a new user registers through Janrain.
def fire_ga_event_user_registered(form):
session.ga_category = "User Action"
session.ga_action = "Register"
session.ga_label = "User successfully registered"
session.user_id = auth.user["id"]
session.ti_version_name = auth.user["version_name"]
print 'in the register callback'
def fire_ga_event_user_authenticated(form):
session.ga_category = "User Action"
session.ga_action = "Login"
session.ga_label = "User logged in"
session.user_id = auth.user["id"]
session.ti_version_name = auth.user["version_name"]
print 'in the login callback'
auth.settings.register_onaccept = fire_ga_event_user_registered
auth.settings.login_onaccept = fire_ga_event_user_authenticated
crud, service, plugins = Crud(db), Service(), PluginManager()
## create all tables needed by auth if not custom tables
auth.define_tables(username=False, signature=False)
db.auth_user.first_name.readable = db.auth_user.first_name.writable = False
db.auth_user.last_name.readable = db.auth_user.last_name.writable = False
from gluon.contrib.login_methods.rpx_account import RPXAccount
from gluon.contrib.login_methods.extended_login_form import ExtendedLoginForm
if session.is_production == False:
rpx_url = "dev-url"
else:
rpx_url = "production-url"
other_form = RPXAccount(request,
api_key='my-api-key',
domain='my-site',
url=rpx_url)
auth.settings.login_form = ExtendedLoginForm(auth, other_form, signals=['token'])
request.janrain_form = other_form
When I register a new user with the above code, it prints "in the login callback." It should say it's in the register callback.