Remove cookie name from configuration

This commit is contained in:
Nicolas Le Manchet 2014-07-23 15:30:19 +02:00
parent b2a34caa66
commit bf5fc622ba

View File

@ -57,9 +57,8 @@ def auth(func):
if not self.conf.getboolean("auth", "enabled"):
return func(self, env, req, *args, **kwargs)
cookie_name = self.conf.get("auth", "cookie")
try:
self.load(req.cookies.get(cookie_name, ""))
self.load(req.cookies.get("auth", ""))
except (SignatureExpired, BadSignature):
raise Forbidden
return func(self, env, req, *args, **kwargs)
@ -118,13 +117,11 @@ class API(object):
"""Update the received data with the information from cookie."""
if self.conf.getboolean("auth", "enabled"):
cookie_name = self.conf.get("auth", "cookie")
auth_data = self.load(request.cookies.get(cookie_name, ""))
auth_data = self.load(request.cookies.get("auth", ""))
data["author"] = auth_data.get("username")
data["email"] = auth_data.get("email")
data["website"] = auth_data.get("website")
@xhr
@auth
@requires(str, 'uri')