Skip to content

Commit

Permalink
fix: black formatter
Browse files Browse the repository at this point in the history
  • Loading branch information
mathieu-roudaut-crea committed Dec 1, 2023
1 parent 4afa31d commit 0f15624
Showing 1 changed file with 9 additions and 25 deletions.
34 changes: 9 additions & 25 deletions backend/geonature/core/users/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,7 @@ def get_roles_by_menu_id(id_menu):
parameters = request.args
if parameters.get("nom_complet"):
q = q.filter(
VUserslistForallMenu.nom_complet.ilike(
"{}%".format(parameters.get("nom_complet"))
)
VUserslistForallMenu.nom_complet.ilike("{}%".format(parameters.get("nom_complet")))
)
data = q.order_by(VUserslistForallMenu.nom_complet.asc()).all()
return [n.as_dict() for n in data]
Expand Down Expand Up @@ -112,9 +110,7 @@ def get_roles_by_menu_code(code_liste):
parameters = request.args
if parameters.get("nom_complet"):
q = q.filter(
VUserslistForallMenu.nom_complet.ilike(
"{}%".format(parameters.get("nom_complet"))
)
VUserslistForallMenu.nom_complet.ilike("{}%".format(parameters.get("nom_complet")))
)
data = q.order_by(VUserslistForallMenu.nom_complet.asc()).all()
return [n.as_dict() for n in data]
Expand Down Expand Up @@ -237,9 +233,7 @@ def inscription():
data = request.get_json()
# ajout des valeurs non présentes dans le form
data["id_application"] = (
Application.query.filter_by(
code_application=current_app.config["CODE_APPLICATION"]
)
Application.query.filter_by(code_application=current_app.config["CODE_APPLICATION"])
.one()
.id_application
)
Expand All @@ -263,16 +257,13 @@ def login_recovery():
Work only if 'ENABLE_SIGN_UP' is set to True
"""
# test des droits
if not current_app.config.get("ACCOUNT_MANAGEMENT").get(
"ENABLE_USER_MANAGEMENT", False
):
if not current_app.config.get("ACCOUNT_MANAGEMENT").get("ENABLE_USER_MANAGEMENT", False):
return {"msg": "Page introuvable"}, 404

data = request.get_json()

r = s.post(
url=config["API_ENDPOINT"]
+ "/pypn/register/post_usershub/create_cor_role_token",
url=config["API_ENDPOINT"] + "/pypn/register/post_usershub/create_cor_role_token",
json=data,
)

Expand Down Expand Up @@ -339,9 +330,7 @@ def update_role():
"""
Modifie le role de l'utilisateur du token en cours
"""
if not current_app.config["ACCOUNT_MANAGEMENT"].get(
"ENABLE_USER_MANAGEMENT", False
):
if not current_app.config["ACCOUNT_MANAGEMENT"].get("ENABLE_USER_MANAGEMENT", False):
return {"message": "Page introuvable"}, 404

data = dict(request.get_json())
Expand Down Expand Up @@ -387,9 +376,7 @@ def change_password():
Modifie le mot de passe de l'utilisateur connecté et de son ancien mdp
Fait appel à l'API UsersHub
"""
if not current_app.config["ACCOUNT_MANAGEMENT"].get(
"ENABLE_USER_MANAGEMENT", False
):
if not current_app.config["ACCOUNT_MANAGEMENT"].get("ENABLE_USER_MANAGEMENT", False):
return {"message": "Page introuvable"}, 404

user = g.current_user
Expand All @@ -407,8 +394,7 @@ def change_password():
# recuperation du token usershub API
# send request to get the token (enable_post_action = False to NOT sent email)
resp = s.post(
url=config["API_ENDPOINT"]
+ "/pypn/register/post_usershub/create_cor_role_token",
url=config["API_ENDPOINT"] + "/pypn/register/post_usershub/create_cor_role_token",
json={"email": user.email, "enable_post_action": False},
)
if resp.status_code != 200:
Expand Down Expand Up @@ -441,9 +427,7 @@ def new_password():
Modifie le mdp d'un utilisateur apres que celui-ci ai demander un renouvelement
Necessite un token envoyer par mail a l'utilisateur
"""
if not current_app.config["ACCOUNT_MANAGEMENT"].get(
"ENABLE_USER_MANAGEMENT", False
):
if not current_app.config["ACCOUNT_MANAGEMENT"].get("ENABLE_USER_MANAGEMENT", False):
return {"message": "Page introuvable"}, 404

data = dict(request.get_json())
Expand Down

0 comments on commit 0f15624

Please sign in to comment.