[Zope-CMF] Users can't authenticate themselves...

Josef Meile jmeile@hotmail.com
Sat, 26 Oct 2002 14:01:05 -0000


>  > <dtml-if "not portal_membership.isAnonymousUser()">
>  >   <dtml-call "RESPONSE.redirect('login_form?
>  > afterAction=http://www.mysite.com/foo')">
> The logic is wrong:
> 
>   You want to redirect to the login form, when the user is anonymous
>   and not when it is not.
> 
>   Be careful, not to get into an infinite redirect loop.


>   You want to redirect to the login form, when the user is anonymous
>   and not when it is not.
> 
>   Be careful, not to get into an infinite redirect loop.
Thank for your reply Dieter. Actually you're right it's a typo. My 
real code, which doesn't work either, is:

<dtml-if "not portal_membership.isAnonymousUser()">
<dtml-let user="portal_membership.getAuthenticatedMember().getUserName
()">
<dtml-if expr="('Team' in AUTHENTICATED_USER.getRolesInContext(this
())) or ('Manager' in AUTHENTICATED_USER.getRolesInContext(this()))">
<dtml-var Create_News_Form>
<dtml-else>
As &dtml-user;, you don't have any privilege to access this feature.
</dtml-if>
</dtml-let>
<dtml-else>
<dtml-call "RESPONSE.redirect('login_form?
putHeader=1&afterAction=http://www.myDomain.com/Create_News_Object')">

<dtml-comment>
<dtml-var "login_form
(_.None,_,putHeader=1,afterAction='http://myDomain.com/Create_News_Obj
ect')">
</dtml-comment>

</dtml-if>

I'm redirected to the login_form, but not authenticated. I get the 
following error message which is in the logged_in form:

Login failure

You are not currently logged in. Your username and or password may be 
incorrect. Your browser may also not be configured to accept HTTP 
cookies. If you need help please contact postmaster@localhost.

I don't have any idea why it doesn't work.