How about adding this at the bottom of your model: def do_something(form): .... auth.settings.login_onaccept = do_something
On Feb 24, 3:47 am, Sanjeet Kumar <sanjeet....@gmail.com> wrote: > I want to insert the data in database when the user will log-in first time > . if the user refresh the index page after login it will again insert the > date and time I have the following sample code i know this code is wrong > but i want to insert the data only first time when the user will log-in. > > @auth.requires_login() > def index(): > #response.flash = c > if auth.is_logged_in(): > response.flash='You are logged in' > else: > import datetime > c=datetime.datetime.now() > for row in db(db.auth_user.email == > auth.user.email).select(db.auth_user.first_name): > firstname=row.first_name > db.employee_detail.insert(employee_id = auth.user.email, > employee_name=firstname, employee_login_time=c) > return dict(message=T('Hello World'))