mirror of
https://github.com/YunoHost/moulinette.git
synced 2024-09-03 20:06:31 +02:00
Fix boring login API expecting a weird form/multiparam thing instead of classic JSON for credentials ...
This commit is contained in:
parent
e5fa7ab734
commit
34a2a66027
1 changed files with 12 additions and 5 deletions
|
@ -353,11 +353,18 @@ class _ActionsMapPlugin:
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
if "credentials" not in request.params:
|
if request.get_header("Content-Type") == "application/json":
|
||||||
raise HTTPResponse("Missing credentials parameter", 400)
|
if "credentials" not in request.json:
|
||||||
credentials = request.params["credentials"]
|
raise HTTPResponse("Missing credentials parameter", 400)
|
||||||
|
credentials = request.json["credentials"]
|
||||||
|
profile = request.json.get("profile", self.actionsmap.default_authentication)
|
||||||
|
else:
|
||||||
|
if "credentials" not in request.params:
|
||||||
|
raise HTTPResponse("Missing credentials parameter", 400)
|
||||||
|
credentials = request.params["credentials"]
|
||||||
|
|
||||||
|
profile = request.params.get("profile", self.actionsmap.default_authentication)
|
||||||
|
|
||||||
profile = request.params.get("profile", self.actionsmap.default_authentication)
|
|
||||||
authenticator = self.actionsmap.get_authenticator(profile)
|
authenticator = self.actionsmap.get_authenticator(profile)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
@ -732,7 +739,7 @@ class Interface:
|
||||||
def wrapper(*args, **kwargs):
|
def wrapper(*args, **kwargs):
|
||||||
try:
|
try:
|
||||||
locale = request.params.pop("locale")
|
locale = request.params.pop("locale")
|
||||||
except KeyError:
|
except (KeyError, ValueError):
|
||||||
locale = m18n.default_locale
|
locale = m18n.default_locale
|
||||||
m18n.set_locale(locale)
|
m18n.set_locale(locale)
|
||||||
return callback(*args, **kwargs)
|
return callback(*args, **kwargs)
|
||||||
|
|
Loading…
Add table
Reference in a new issue