This should do it: def user(): if request.args(0)=='register': registrant = db(db.registrant.token == request.vars.token).select().first() or redirect(URL('error')) db.auth_user.email.writable=False # gives error db.auth_user.email.default=registrant.email return dict(form=form)
On Jul 6, 1:04 pm, Luis Goncalves <lgoncal...@gmail.com> wrote: > Good point! > > Unfortunately, I am not expert enough to understand how to do this in my > case, because I am using the form=auth.register(). > > Wouldn't I have to do what you suggest inside Auth.register ? > > (for an explanation of why I am doing this, see: > https://groups.google.com/forum/#!topic/web2py/O3O6J5FgXjU) > > def user(): > > if request.args(0)=='register': > > db.table_user.email.writable=False # gives error > form=auth.register() > > registrant = db( db.registrant.token == request.vars.token > ).select().first() > > form.element(_name='email').update(_value=registrant.email) > > form.element(_name='email')['_readonly']=True > > return dict(form=form) > > Thanks!! > Luis.