File tree Expand file tree Collapse file tree 1 file changed +2
-16
lines changed Expand file tree Collapse file tree 1 file changed +2
-16
lines changed Original file line number Diff line number Diff line change @@ -67,34 +67,20 @@ def create_or_update_user(idp_id: str, user_info: Dict) -> User:
6767
6868 user = Session .query (User ).filter_by (idp_id = idp_id ).one_or_none ()
6969
70- # If not found, try by email as fallback
7170 if not user :
7271 user = Session .query (User ).filter_by (email = email ).one_or_none ()
7372 if user :
74- # If found by email, update idp_id
7573 user .idp_id = idp_id
7674 else :
77- # Create new user if not found by idp_id or email
7875 user_parameters = {
7976 "email" : email ,
8077 "idp_id" : idp_id ,
8178 "full_name" : user_info .get ("name" , email ),
8279 "username" : user_info .get ("preferred_username" , email ),
8380 }
8481 user = User (** user_parameters )
85-
86- # Only update user info if it has changed
87- if (
88- user .email != email
89- or user .full_name != user_info .get ("name" , email )
90- or user .username != user_info .get ("preferred_username" , email )
91- ):
92- user .email = email
93- user .full_name = user_info .get ("name" , email )
94- user .username = user_info .get ("preferred_username" , email )
95-
96- Session .add (user )
97- Session .commit ()
82+ Session .add (user )
83+ Session .commit ()
9884
9985 return user
10086 except SQLAlchemyError as e :
You can’t perform that action at this time.
0 commit comments