mirror of
https://github.com/spiral-project/ihatemoney.git
synced 2025-05-05 20:51:49 +02:00
simplify the token
Keep it in a list, for forward compatibillity
This commit is contained in:
parent
e25d5dbfd2
commit
6c0d0e22b0
1 changed files with 3 additions and 3 deletions
|
@ -350,12 +350,12 @@ class Project(db.Model):
|
|||
serializer = URLSafeTimedSerializer(
|
||||
current_app.config["SECRET_KEY"], salt=token_type
|
||||
)
|
||||
token = serializer.dumps({"project_id": self.id})
|
||||
token = serializer.dumps([self.id])
|
||||
else:
|
||||
serializer = URLSafeSerializer(
|
||||
current_app.config["SECRET_KEY"] + self.password, salt=token_type
|
||||
)
|
||||
token = serializer.dumps({"project_id": self.id})
|
||||
token = serializer.dumps([self.id])
|
||||
|
||||
return token
|
||||
|
||||
|
@ -390,7 +390,7 @@ class Project(db.Model):
|
|||
except BadSignature:
|
||||
return None
|
||||
|
||||
data_project = data.get("project_id")
|
||||
data_project = data[0] if isinstance(data, list) else None
|
||||
return (
|
||||
data_project if project_id is None or data_project == project_id else None
|
||||
)
|
||||
|
|
Loading…
Reference in a new issue