[Zope] acl_users.manage_users and RESPONSE.redirect

Chris Jenson CJenson@criadvantage.com
Wed, 20 Sep 2000 09:11:46 -0600


I am using the following code (adding to acl_users folder with manage_users)
to do user self registration after some initial authentication using Zope
authentication and a common login/passwd.  It works fine if things are as
they should be, but when things go south, password and confirm not equal,
login already exists, etc., it isn't so great.  I would like to get ahold of
the output of manage_users to display on a redirected RESPONSE back to the
original vendorRegistration DTML Document.  How can I do this?  

Also, is there a better way to check for a successful user add?  Right now I
am using,
"  <dtml-if expr="acl_users.getUser(login)">  ", and that works, but
wondered if there was a better way.

Help would be much appreciated.  I am new to Zope and still trying to get my
head around it.

thanks,
Chris

***** DTML Document - vendorRegistration ******
<dtml-var standard_html_header>
<h2><dtml-var title></h2>
<p>Register for Vendor Manual distribution</p>
<form action="registerAction" method="post"
enctype="multipart/form-data">
<table>
<tr>
  <td>
     Login(e-mail address): 
  </td>
  <td>
     <input type="text" name="login">
  </td>
</tr>
<tr>
  <td>
     Password:
  </td>
  <td>
     <input type="text" name="password">
  </td>
</tr>
<tr>
  <td>
     Confirm Password:
  </td>
  <td>
     <input type="text" name="confirm">
  </td>
</tr>
</table>
<input type="submit" value=" Register " >
</form>
<dtml-var standard_html_footer>


***** DTML Document - registerAction ******
<dtml-var standard_html_header>
<h2><dtml-var title></h2>

<dtml-call "REQUEST.set('name', login)">
<dtml-call "REQUEST.set('password', password)">
<dtml-call "REQUEST.set('confirm', confirm)">
<dtml-call "REQUEST.set('roles', ['cwcVendor'])">
<dtml-call "REQUEST.set('submit', 'Add')">
<dtml-var expr="acl_users.manage_users(submit='Add', REQUEST=REQUEST )">

<dtml-if expr="acl_users.getUser(login)">
  <dtml-var expr="RESPONSE.redirect('Registered')">
<dtml-else>
  <dtml-var expr="RESPONSE.redirect('vendorRegistration')">
</dtml-if>

<dtml-var standard_html_footer>