language models and set defaults are updated
This commit is contained in:
@@ -50,6 +50,7 @@ class UserLoginModule:
|
||||
def login_user_via_credentials(self, access_data: "Login") -> None:
|
||||
from ApiLayers.ApiServices.Token.token_handler import TokenService
|
||||
from ApiLayers.Schemas import Users
|
||||
|
||||
"""
|
||||
Login the user via the credentials.
|
||||
"""
|
||||
@@ -65,12 +66,17 @@ class UserLoginModule:
|
||||
)
|
||||
# Check if the password is correct
|
||||
if PasswordModule.check_password(
|
||||
domain=access_data.domain, id_=found_user.uu_id,
|
||||
password=access_data.password, password_hashed=found_user.hash_password,
|
||||
domain=access_data.domain,
|
||||
id_=found_user.uu_id,
|
||||
password=access_data.password,
|
||||
password_hashed=found_user.hash_password,
|
||||
):
|
||||
# Set the access token to the redis
|
||||
token_response = TokenService.set_access_token_to_redis(
|
||||
request=self.request, user=found_user, domain=access_data.domain, remember=access_data.remember_me,
|
||||
request=self.request,
|
||||
user=found_user,
|
||||
domain=access_data.domain,
|
||||
remember=access_data.remember_me,
|
||||
)
|
||||
# Set the user and token information to the instance
|
||||
self.user = found_user.get_dict()
|
||||
@@ -78,7 +84,7 @@ class UserLoginModule:
|
||||
self.refresh_token = token_response.get("refresh_token")
|
||||
self.access_object = {
|
||||
"user_type": token_response.get("user_type", None),
|
||||
"selection_list": token_response.get("selection_list", {})
|
||||
"selection_list": token_response.get("selection_list", {}),
|
||||
}
|
||||
return None
|
||||
raise HTTPExceptionApi(
|
||||
|
||||
@@ -285,10 +285,14 @@ class TokenService:
|
||||
cls.remove_token_with_domain(user=user, domain=domain)
|
||||
Users.client_arrow = DateTimeLocal(is_client=True, timezone=user.local_timezone)
|
||||
login_dict, db_session = {}, UsersTokens.new_session()
|
||||
if user.is_occupant: # Handle login based on user type
|
||||
login_dict = cls.do_occupant_login(request=request, user=user, domain=domain)
|
||||
if user.is_occupant: # Handle login based on user type
|
||||
login_dict = cls.do_occupant_login(
|
||||
request=request, user=user, domain=domain
|
||||
)
|
||||
elif user.is_employee:
|
||||
login_dict = cls.do_employee_login(request=request, user=user, domain=domain)
|
||||
login_dict = cls.do_employee_login(
|
||||
request=request, user=user, domain=domain
|
||||
)
|
||||
|
||||
# Handle remember me functionality
|
||||
if remember:
|
||||
|
||||
Reference in New Issue
Block a user