If this is going to be required one-time-only as soon as "someone" verifies 
the registration, why don't you do this when that "someone" verifies the 
registration ? However, if trial_expires is not "checkable" (as Derek 
suggested) you can also hook into the on_login and check if auth_event 
holds a record of the user "logged in".

On Thursday, August 30, 2012 6:41:27 PM UTC+2, Yarin wrote:
>
> 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?
>
>
>
>
>

-- 



Reply via email to