[Zope] FSSession atomicity?

Curtis Maloney curtis@umd.com.au
Wed, 12 Apr 2000 12:51:33 +1000


On Wed, 12 Apr 2000, Andrew Kenneth Milton wrote:
> +----[ Curtis Maloney ]---------------------------------------------
> |
> | <dtml-var standard_html_header>
> | <dtml-in "sqlPasswordCheck(user=username, company=company)">
> |   <dtml-if "passwd == Password">
> |     <dtml-call "FSSession.set('UserName',username)">
> |     <dtml-call "FSSession.set('ID',company)">
> |     <dtml-call "FSSession.set('Permissions', Permissions)">
> |     <dtml-var "RESPONSE.redirect(HTTP_REFERER)">
> |   </dtml-if>
> | </dtml-in>
> | <h2>Incorrect Login Attempt</h2>
> | <p>
> | <a href="<dtml-var HTTP_REFERER>">Try Again.</a>
> | </p>
> | <dtml-var standard_html_footer>
> 
> try this 
> 
> <dtml-if "sqlPasswordCheck(user=username, company=company)">
>     <dtml-in "sqlPasswordCheck(user=username, company=company)">
>       <dtml-if "passwd == Password">
>         <dtml-call "FSSession.set('UserName',username)">
>         <dtml-call "FSSession.set('ID',company)">
>         <dtml-call "FSSession.set('Permissions', Permissions)">
>         <dtml-var "RESPONSE.redirect(HTTP_REFERER)">
>       </dtml-if>
>     </dtml-in>
> <dtml-else>
>     <dtml-var standard_html_header>
>     <h2>Incorrect Login Attempt</h2>
>     <p>
>     <a href="<dtml-var HTTP_REFERER>">Try Again.</a>
>     </p>
>     <dtml-var standard_html_footer>
> </dtml-if>
> 
Ok... I think I may have been a little unclear here.  It is NOT reporting the
login attempt failing.  So, this code determins that the user is valid, and
sets the FSSession data.

However, the next page it sends to _sometimes_ doesn't think UserName exists,
using the following code, which is from the standard_html_header:

        <dtml-if "FSSession.has_key('UserName')">
          <form action="<dtml-var "PARENTS[_.len(PARENTS)-2].id">/logout_html">
            <h3>User Name:</h3> <dtml-var "FSSession['UserName']"><br>
            <h3>Company:</h3> <dtml-var "sqlGetCompanyName(company=FSSession['ID'])[0].CompanyName"><P>
            <input type="submit" value="Logout">
          </form>
        <dtml-else>
          <form action="verify_html">
            <h3>User Name:</h3><input type="text" name="username" size="8"><br>
            <h3>Company ID:</h3><input type="text" name="company" size="8"><br>
            <h3>Password:</h3><input type="password" name="passwd" size="8"><P>
            <input type="submit" value="Login">
          </form>
        </dtml-if>


-- 
Have a better one,
	Curtis.

<dtml-var standard_work_disclaimer>