Don't redirect good but unauthorized users (fixes #571)

This commit is contained in:
Guillaume Ayoub 2011-08-21 14:59:43 +02:00
parent 4c85e730b3
commit 5137709801

View File

@ -219,17 +219,18 @@ class Application(object):
last_allowed = False last_allowed = False
if calendars: if calendars:
# Calendars found
status, headers, answer = function( status, headers, answer = function(
environ, calendars, content, user) environ, calendars, content, user)
elif user and self.acl.has_right(user, user, password): elif user and last_allowed:
# Check if the user/password couple matches, # Good user and no calendars found, redirect user to home
# redirect user to his principal home in this case
location = "/%s/" % str(quote(user)) location = "/%s/" % str(quote(user))
log.LOGGER.info("redirecting to %s" % location) log.LOGGER.info("redirecting to %s" % location)
status = client.FOUND status = client.FOUND
headers = {"Location": location} headers = {"Location": location}
answer = "Redirecting to %s" % location answer = "Redirecting to %s" % location
else: else:
# Unknown or unauthorized user
status = client.UNAUTHORIZED status = client.UNAUTHORIZED
headers = { headers = {
"WWW-Authenticate": "WWW-Authenticate":