mirror of
https://github.com/YunoHost/moulinette.git
synced 2024-09-03 20:06:31 +02:00
use default profile by default
This commit is contained in:
parent
d51bb55573
commit
6f7f870d3d
1 changed files with 8 additions and 12 deletions
|
@ -256,10 +256,8 @@ class _ActionsMapPlugin(object):
|
||||||
kwargs["password"] = request.POST["password"]
|
kwargs["password"] = request.POST["password"]
|
||||||
except KeyError:
|
except KeyError:
|
||||||
raise HTTPBadRequestResponse("Missing password parameter")
|
raise HTTPBadRequestResponse("Missing password parameter")
|
||||||
try:
|
|
||||||
kwargs["profile"] = request.POST["profile"]
|
kwargs["profile"] = request.POST.get("profile", "default")
|
||||||
except KeyError:
|
|
||||||
pass
|
|
||||||
return callback(**kwargs)
|
return callback(**kwargs)
|
||||||
|
|
||||||
return wrapper
|
return wrapper
|
||||||
|
@ -351,7 +349,7 @@ class _ActionsMapPlugin(object):
|
||||||
|
|
||||||
# Routes callbacks
|
# Routes callbacks
|
||||||
|
|
||||||
def login(self, password, profile="default"):
|
def login(self, password, profile):
|
||||||
"""Log in to an authenticator profile
|
"""Log in to an authenticator profile
|
||||||
|
|
||||||
Attempt to authenticate to a given authenticator profile and
|
Attempt to authenticate to a given authenticator profile and
|
||||||
|
@ -406,13 +404,11 @@ class _ActionsMapPlugin(object):
|
||||||
|
|
||||||
"""
|
"""
|
||||||
s_id = request.get_cookie("session.id")
|
s_id = request.get_cookie("session.id")
|
||||||
try:
|
# We check that there's a (signed) session.hash available
|
||||||
# We check that there's a (signed) session.hash available
|
# for additional security ?
|
||||||
# for additional security ?
|
# (An attacker could not craft such signed hashed ? (FIXME : need to make sure of this))
|
||||||
# (An attacker could not craft such signed hashed ? (FIXME : need to make sure of this))
|
s_secret = self.secrets[s_id]
|
||||||
s_secret = self.secrets[s_id]
|
if profile not in request.get_cookie("session.tokens", secret=s_secret, default={}):
|
||||||
request.get_cookie("session.tokens", secret=s_secret, default={})[profile]
|
|
||||||
except KeyError:
|
|
||||||
raise HTTPUnauthorizedResponse(m18n.g("not_logged_in"))
|
raise HTTPUnauthorizedResponse(m18n.g("not_logged_in"))
|
||||||
else:
|
else:
|
||||||
del self.secrets[s_id]
|
del self.secrets[s_id]
|
||||||
|
|
Loading…
Add table
Reference in a new issue