Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

api.user_manager: add username in log messages #408

Merged
merged 1 commit into from
Nov 16, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions api/user_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def __init__(self, user_db: BaseUserDatabase[User, PydanticObjectId],
async def on_after_register(self, user: User,
request: Optional[Request] = None):
"""Handler to execute after successful user registration"""
print(f"User {user.id} has registered.")
print(f"User {user.id} {user.username} has registered.")

async def on_after_request_verify(self, user: User, token: str,
request: Optional[Request] = None):
Expand All @@ -55,7 +55,7 @@ async def on_after_request_verify(self, user: User, token: str,
async def on_after_verify(self, user: User,
request: Optional[Request] = None):
"""Handler to execute after successful user verification"""
print(f"Verification successful for user {user.id}")
print(f"Verification successful for user {user.id} {user.username}")
template = self._template_env.get_template(
"email-verification-successful.jinja2")
subject = "Email verification successful for KernelCI API account"
Expand All @@ -67,7 +67,7 @@ async def on_after_verify(self, user: User,
async def on_after_login(self, user: User,
request: Optional[Request] = None):
"""Handler to execute after successful user login"""
print(f"User {user.id} logged in.")
print(f"User {user.id} {user.username} logged in.")

async def on_after_forgot_password(self, user: User, token: str,
request: Optional[Request] = None):
Expand All @@ -82,7 +82,7 @@ async def on_after_forgot_password(self, user: User, token: str,
async def on_after_reset_password(self, user: User,
request: Optional[Request] = None):
"""Handler to execute after successful password reset"""
print(f"User {user.id} has reset their password.")
print(f"User {user.id} {user.username} has reset their password.")
template = self._template_env.get_template(
"reset-password-successful.jinja2")
subject = "Password reset successful for KernelCI API account"
Expand All @@ -94,17 +94,17 @@ async def on_after_reset_password(self, user: User,
async def on_after_update(self, user: User, update_dict: Dict[str, Any],
request: Optional[Request] = None):
"""Handler to execute after successful user update"""
print(f"User {user.id} has been updated.")
print(f"User {user.id} {user.username} has been updated.")

async def on_before_delete(self, user: User,
request: Optional[Request] = None):
"""Handler to execute before user delete."""
print(f"User {user.id} is going to be deleted.")
print(f"User {user.id} {user.username} is going to be deleted.")

async def on_after_delete(self, user: User,
request: Optional[Request] = None):
"""Handler to execute after user delete."""
print(f"User {user.id} is successfully deleted.")
print(f"User {user.id} {user.username} was successfully deleted.")

async def authenticate(
self, credentials: OAuth2PasswordRequestForm
Expand Down
Loading