I am assuming you are not using Janraion Oauth, etc.

1) make sure the db.auth_user has a
Field('registration_completed','boolean',default=True,writable=False,readable=False)
(default must be True if regular use go thought normal registration
process)
and a Field('parent_user','reference
auth_user',writable=False,readable=False)

2) in model make sure everybody has a completed registration

if auth.user and not auth.user.registration_completed and not
request.function=='user':
    redirect(URL('default','user/profile'))

3) create an action to allows parents to register children:

@auth.requires_login()
def register_child()
    auth.settings.registration_requires_verification=True
    # show only the email!
    for field in db.auth_user:
        if field.name!='email':
            field.writable=field
    # defaul parent to registrar
    db.auth_user.parent_user=auth.user_id
    # copy current user info and restore it after form processed
    parent = auth.user
    form=auth.register(next=None) # do not redirect inside
    auth.user=session.auth.user=parent
    # redirect if form accepted
    if form.vars and not form.errors: redirect(URL('index'))
    return dict(form=form)

This should work. Let us know if it does or does not.

On Nov 17, 3:26 pm, mattynoce <[email protected]> wrote:
> hi, i hope this is an easy question, but i didn't find answers
> elsewhere in the forum.
>
> here's what i'm looking to do:
>
> 1) a parent registers with the site
> 2) the parent registers her child using just an email address
> 3) the child receives the verification email, and clicks on the link
> 4) the child then finishes the rest of the registration
>
> the part i'm having trouble with is the transition from (3) to (4). in
> (2) i was able to do a custom form to create the user and populate the
> registration_key field, no problem. but what i would like to do is
> have clicking on the verification link actually log in the user, and
> then use updates to set the rest of the variables.
>
> this isn't a security risk because it's just registration and there's
> no data about the child in the system. basically, i want the child to
> be logged in BEFORE having to set a password, then change it inside.
> is there a command i can use that will log a user in, or a way to set
> verification to automatically log in a user?
>
> thanks,
>
> matt

Reply via email to