-
Notifications
You must be signed in to change notification settings - Fork 5
Knowsletter branding #147
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
base: master
Are you sure you want to change the base?
Knowsletter branding #147
Conversation
Deploying mxtoai-backend with
|
| Latest commit: |
a027d21
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://b149c6bb.mxtoai-backend.pages.dev |
| Branch Preview URL: | https://knowsletter-branding.mxtoai-backend.pages.dev |
| logger.info(f"User {user_email} is not whitelisted. Triggering verification.") | ||
| try: | ||
| await whitelist.trigger_automatic_verification(user_email) | ||
| await whitelist.trigger_newsletter_verification(user_email) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why are we revoking the usage of trigger_automatic_verification we do need that functionality as well, this codebase is shared b/w normal MXGo and Knowsletter
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see. So we want a way to difference between a request that's coming from the mxgo and one that's coming from knowsletter and trigger the relevant verification?
| if not supabase: | ||
| init_supabase() | ||
|
|
||
| verification_token = str(uuid.uuid4()) | ||
| current_time = datetime.now(timezone.utc).isoformat() | ||
|
|
||
| existing_response = supabase.table("whitelisted_emails").select("*").eq("email", email).execute() | ||
|
|
||
| if hasattr(existing_response, "data") and len(existing_response.data) > 0: | ||
| update_response = ( | ||
| supabase.table("whitelisted_emails") | ||
| .update({"verification_token": verification_token, "verified": False, "updated_at": current_time}) | ||
| .eq("email", email) | ||
| .execute() | ||
| ) | ||
| if not (hasattr(update_response, "data") and len(update_response.data) > 0): | ||
| logger.error(f"Failed to update verification token for {email}") | ||
| return False | ||
| else: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there are commonalities in this method with trigger_automatic_verification, we should reuse the code. Let's extract common logic to functions and not duplicate the code.
| return False | ||
|
|
||
|
|
||
| async def send_newsletter_verification_email(email: str, verification_token: str) -> bool: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same comment as https://github.com/mxgoai/mxgo-core/pull/147/changes#r2698369388, commonalities with send_verification_email
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also can move these methods to a separate module called knowsletter.py to keep the changes bit isolated
Checklist