Thanks, pbreit, for the link! Long thread!!!
I read it all, but am still unclear how to force registration with a
pre-defined name and email
(I'll have DB entries such that each unique invite token is associated with
a pre-defined name and email).
I was hoping to do something like this:
def user():
if request.args(0)=='invite':
# person has clicked on their invite which takes them to
....default/user/invite?token=aalsfjlkajflasjflkasjdfl
# use the token to look up name and email
invite_info = db( db.invite.token == request.vars.token ).select().first()
form = auth() # ??? how to make it a registration form ???
# ? Somehow, insert predefined name and email into registration form,
# and make them READONLY
? form.first_name = invite_info.first_name
? how to make the field READONLY ? (I think I should change the db.auth
definition in db.py !)
? form.last_name = ...
? form.email = ....
return dict(form=form)
However (aside from not knowing how to set the fields), this does not work:
- a simple test case with dummy code returns 404 Not Found unless I
comment out the call to form=auth()
the test case:
if
request.args(0)=='invite':
form =
auth()
response.view =
'default/invite.html'
return dict(msg='hello', magic='banana', results='tada')
(commenting out form=auth() makes it fine, otherwise 404 Not Found)
I suppose auth() was not designed to be manipulated this way?
Ultimately, what I don't know how to do is to create a registration form
with predefined name and email, so the user just has to pick a password.
Thanks!!!
Luis.