From be80d02df5e540c7e1a61232d0c2fd66d41422c3 Mon Sep 17 00:00:00 2001 From: phuongntt Date: Mon, 5 Feb 2024 15:02:21 +0700 Subject: [PATCH 1/2] chore: Update default user create data --- locker_server/api_orm/repositories/user_repository.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/locker_server/api_orm/repositories/user_repository.py b/locker_server/api_orm/repositories/user_repository.py index cce0a2a..678fd6e 100644 --- a/locker_server/api_orm/repositories/user_repository.py +++ b/locker_server/api_orm/repositories/user_repository.py @@ -569,7 +569,8 @@ def retrieve_or_create_by_id(self, user_id, creation_date=None) -> Tuple[User, b creation_date = now() if not creation_date else float(creation_date) user_orm, is_created = UserORM.objects.get_or_create(user_id=user_id, defaults={ "user_id": user_id, - "creation_date": creation_date + "creation_date": creation_date, + "is_password_changed": False }) return ModelParser.user_parser().parse_user(user_orm=user_orm), is_created @@ -578,7 +579,8 @@ def retrieve_or_create_by_email(self, email: str, creation_date=None) -> Tuple[U user_orm, is_created = UserORM.objects.get_or_create(email=email, defaults={ "email": email, "full_name": email, - "creation_date": creation_date + "creation_date": creation_date, + "is_password_changed": False }) return ModelParser.user_parser().parse_user(user_orm=user_orm), is_created From 96aa6bbc2b44afec45f80fca9ccf4d08dccd2973 Mon Sep 17 00:00:00 2001 From: phuongntt Date: Tue, 6 Feb 2024 16:07:31 +0700 Subject: [PATCH 2/2] chore: Fix bug create new session by otp --- locker_server/core/services/user_service.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/locker_server/core/services/user_service.py b/locker_server/core/services/user_service.py index d6aa990..441eb2d 100644 --- a/locker_server/core/services/user_service.py +++ b/locker_server/core/services/user_service.py @@ -935,7 +935,7 @@ def user_session_by_otp(self, user: User, password: str, method: str, otp_code: if save_device: # Save device to device factor2 white list device_factor2_create_data = { - "device_id": device_existed.device_id, + "device_id": device_obj.device_id, "factor2_method_id": factor2_method.factor2_method_id } self.device_factor2_repository.create_device_factor2(