Skip to content

Commit

Permalink
fix(public login): fix public login in GeoNature
Browse files Browse the repository at this point in the history
  • Loading branch information
jacquesfize committed Nov 26, 2024
1 parent e27573a commit 9b4aff4
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions src/pypnusershub/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,18 +182,11 @@ def public_login():
.where(models.User.filter_by_app(code_app="GN"))
).scalar_one()

user_dict = user.as_dict()
login_user(user)
# Génération d'un token
token = encode_token(user_dict)
token_exp = datetime.datetime.now(datetime.timezone.utc)
token_exp += datetime.timedelta(
seconds=current_app.config["REMEMBER_COOKIE_DURATION"]
)

return jsonify(
{"user": user_dict, "expires": token_exp.isoformat(), "token": token.decode()}
)
return UserSchema(
exclude=["remarques"], only=["+max_level_profil", "+providers"]
).dump_with_token(user)


@routes.route("/logout", methods=["GET", "POST"])
Expand Down

0 comments on commit 9b4aff4

Please sign in to comment.