mirror of
https://github.com/YunoHost/moulinette.git
synced 2024-09-03 20:06:31 +02:00
Merge pull request #340 from selfhoster1312/bypass-csrf-login
portal-api: Bypass CSRF protection for login route
This commit is contained in:
commit
0d7a143c01
1 changed files with 7 additions and 3 deletions
|
@ -269,13 +269,14 @@ class _ActionsMapPlugin:
|
|||
name="login",
|
||||
method="POST",
|
||||
callback=self.login,
|
||||
skip=["actionsmap"],
|
||||
skip=[filter_csrf, "actionsmap"],
|
||||
)
|
||||
app.route(
|
||||
"/logout",
|
||||
name="logout",
|
||||
method="GET",
|
||||
callback=self.logout,
|
||||
# No need to bypass CSRF here because filter allows GET requests
|
||||
skip=["actionsmap"],
|
||||
)
|
||||
|
||||
|
@ -359,9 +360,12 @@ class _ActionsMapPlugin:
|
|||
credentials = request.json["credentials"]
|
||||
profile = request.json.get("profile", self.actionsmap.default_authentication)
|
||||
else:
|
||||
if "credentials" not in request.params:
|
||||
if "credentials" in request.params:
|
||||
credentials = request.params["credentials"]
|
||||
elif "username" in request.params and "password" in request.params:
|
||||
credentials = request.params["username"] + ":" + request.params["password"]
|
||||
else:
|
||||
raise HTTPResponse("Missing credentials parameter", 400)
|
||||
credentials = request.params["credentials"]
|
||||
|
||||
profile = request.params.get("profile", self.actionsmap.default_authentication)
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue