forked from SelfPrivacy/selfprivacy-rest-api
Fix date formats
parent
401dff23fb
commit
c30e062210
|
@ -68,7 +68,7 @@ def create_app(test_config=None):
|
||||||
def spec():
|
def spec():
|
||||||
if app.config["ENABLE_SWAGGER"] == "1":
|
if app.config["ENABLE_SWAGGER"] == "1":
|
||||||
swag = swagger(app)
|
swag = swagger(app)
|
||||||
swag["info"]["version"] = "1.2.6"
|
swag["info"]["version"] = "1.2.7"
|
||||||
swag["info"]["title"] = "SelfPrivacy API"
|
swag["info"]["title"] = "SelfPrivacy API"
|
||||||
swag["info"]["description"] = "SelfPrivacy API"
|
swag["info"]["description"] = "SelfPrivacy API"
|
||||||
swag["securityDefinitions"] = {
|
swag["securityDefinitions"] = {
|
||||||
|
|
|
@ -23,4 +23,4 @@ class ApiVersion(Resource):
|
||||||
401:
|
401:
|
||||||
description: Unauthorized
|
description: Unauthorized
|
||||||
"""
|
"""
|
||||||
return {"version": "1.2.6"}
|
return {"version": "1.2.7"}
|
||||||
|
|
|
@ -120,7 +120,7 @@ def create_token(name):
|
||||||
{
|
{
|
||||||
"token": token,
|
"token": token,
|
||||||
"name": name,
|
"name": name,
|
||||||
"date": str(datetime.now()),
|
"date": str(datetime.now().strftime("%Y-%m-%dT%H:%M:%S.%fZ")),
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
return token
|
return token
|
||||||
|
@ -282,9 +282,15 @@ def _get_new_device_auth_token():
|
||||||
new_device = tokens["new_device"]
|
new_device = tokens["new_device"]
|
||||||
if "expiration" not in new_device:
|
if "expiration" not in new_device:
|
||||||
return None
|
return None
|
||||||
if datetime.now() > datetime.strptime(
|
if new_device["expiration"].endswith("Z"):
|
||||||
new_device["expiration"], "%Y-%m-%d %H:%M:%S.%f"
|
expiration = datetime.strptime(
|
||||||
):
|
new_device["expiration"], "%Y-%m-%dT%H:%M:%S.%fZ"
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
expiration = datetime.strptime(
|
||||||
|
new_device["expiration"], "%Y-%m-%d %H:%M:%S.%f"
|
||||||
|
)
|
||||||
|
if datetime.now() > expiration:
|
||||||
return None
|
return None
|
||||||
return new_device["token"]
|
return new_device["token"]
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue