[ZPatterns] LoginManager: programmatically logging someone in

Jean Jordaan [email protected]
Mon, 20 Jan 2003 17:48:01 +0200


Hi all

I'm having a hard time getting my head around letting users join
a site.

The setup is as follows:

  - User arrives at .../register?key=secret
    They get the key by email, and it allows them to join.

  - The 'register' method validates the key, and does
    'return registerForm(REQUEST)', which allows the user
    to fill in username/password/etc.

  - It submits back to 'register', which sees that it was
    reached from the form, and now validates the
    username/password/etc. It returns the form again if there
    are errors, with notes ("username exists"/"passwords don't
    match");

  - otherwise, it should update the user record with their
    username/password/etc, *and log the user in*.

For the life of me, I can't figure out how to make LoginManager
let me do that.

I've tried stuff like:

   user = context.acl_users.getItem(username)
   context.acl_users.credentialsChanged(user, username, password)

and

   user.authenticate(password, REQUEST)

but no joy so far. Is there a Right Way I'm missing completely?

-- 
Jean Jordaan
http://www.upfrontsystems.co.za