We have to perform a series of checks and updates on an auth_user record as
soon as their registration has been verified.
Previously, we had not required verification and had done everything
in register_onaccept:
def first_thing(form):
""" Performs a series of checks for newly registered users."""
# Send welcome email:
notify(subject= "Welcome",message="Welcome to our app",email=auth.user.
email)
# Set trial expiration:
today = datehelper.get_utc_midnight() # Midnight of current UTC day
trial_expires_date = today+relativedelta.relativedelta(days=+15)
db(db.auth_user.id==auth.user_id).update(trial_expires=
trial_expires_date)
auth.settings.register_onaccept = first_thing
But now that we require verification on registration, we changed the
function to be called on verify_email_onaccept:
auth.settings.verify_email_onaccept = first_thing
The problem is that now we get an error because Auth is None, as the user
still needs to log in.
So what would be the best way to update an auth_user record the first time
a user actually logs in?
--