events imports are checked
This commit is contained in:
@@ -44,11 +44,11 @@ from api_services import (
|
||||
redis_cli,
|
||||
send_email,
|
||||
)
|
||||
from api_validations.core_response import return_json_response_from_alchemy
|
||||
from api_configs import ApiStatic, Auth
|
||||
from api_events.events.abstract_class import MethodToEvent, ActionsSchema
|
||||
from api_objects.auth.token_objects import EmployeeTokenObject, OccupantTokenObject
|
||||
from api_library.date_time_actions.date_functions import DateTimeLocal
|
||||
from api_library.date_time_actions.date_functions import system_arrow, client_arrow
|
||||
from api_validations.core_response import return_json_response_from_alchemy
|
||||
|
||||
|
||||
class AuthenticationLoginEventMethods(MethodToEvent):
|
||||
@@ -511,7 +511,7 @@ class AuthenticationRefreshTokenEventMethods(MethodToEvent):
|
||||
found_user.last_remote_addr = getattr(
|
||||
request, "remote_addr", None
|
||||
) or request.headers.get("X-Forwarded-For", None)
|
||||
found_user.last_seen = str(DateTimeLocal.now())
|
||||
found_user.last_seen = str(system_arrow.now())
|
||||
# UserLogger.log_error(
|
||||
# str(
|
||||
# dict(
|
||||
@@ -593,7 +593,7 @@ class AuthenticationForgotPasswordEventMethods(MethodToEvent):
|
||||
)
|
||||
|
||||
found_user.password_token = forgot_key
|
||||
found_user.password_token_is_valid = str(DateTimeLocal.shift(days=1))
|
||||
found_user.password_token_is_valid = str(system_arrow.shift(days=1))
|
||||
found_user.save()
|
||||
|
||||
return JSONResponse(
|
||||
@@ -620,6 +620,13 @@ class AuthenticationDownloadAvatarEventMethods(MethodToEvent):
|
||||
found_user = Users.check_user_exits(
|
||||
access_key=data.access_key, domain=data.domain
|
||||
)
|
||||
expired_str = str(system_arrow.now() - system_arrow.get(str(found_user.expiry_ends)))
|
||||
expired_int = int(
|
||||
client_arrow.get(
|
||||
system_arrow.now() - system_arrow.get(str(found_user.expiry_ends))
|
||||
).days
|
||||
)
|
||||
expiry_ends = system_arrow.get(str(found_user.expiry_ends))
|
||||
return JSONResponse(
|
||||
content={
|
||||
"completed": True,
|
||||
@@ -628,17 +635,9 @@ class AuthenticationDownloadAvatarEventMethods(MethodToEvent):
|
||||
"last_seen": str(found_user.last_seen),
|
||||
"avatar": found_user.avatar,
|
||||
"remember_me": found_user.remember_me,
|
||||
"expiry_ends": str(found_user.expiry_ends),
|
||||
"expired_str": str(
|
||||
DateTimeLocal.now()
|
||||
- DateTimeLocal.get(str(found_user.expiry_ends))
|
||||
),
|
||||
"expired_int": int(
|
||||
(
|
||||
DateTimeLocal.now()
|
||||
- DateTimeLocal.get(str(found_user.expiry_ends))
|
||||
).days
|
||||
),
|
||||
"expiry_ends": client_arrow.get(expiry_ends),
|
||||
"expired_str": client_arrow.get(expired_str),
|
||||
"expired_int": expired_int,
|
||||
},
|
||||
},
|
||||
status_code=status.HTTP_200_OK,
|
||||
|
||||
Reference in New Issue
Block a user