Address code review: fix imports, salt hashing, conditional delivery message
- Move asyncio import to module level in gmail_service.py - Move datetime import to module level in providers.py - Use hashlib.sha256 for per-user salt generation (no truncation risk) - Make delivery method message conditional in AddMailAccountModal Co-authored-by: christianlouis <361235+christianlouis@users.noreply.github.com> Agent-Logs-Url: https://github.com/christianlouis/pop_puller_to_gmail/sessions/de3ef930-a980-4958-8a9d-a2c802918e81
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
"""Provider presets and Gmail credential management endpoints"""
|
||||
from datetime import datetime
|
||||
from typing import List
|
||||
from fastapi import APIRouter, Depends, HTTPException, status
|
||||
from sqlalchemy.ext.asyncio import AsyncSession
|
||||
@@ -197,14 +198,12 @@ async def save_gmail_credential(
|
||||
existing.encrypted_access_token = encrypted_access
|
||||
existing.encrypted_refresh_token = encrypted_refresh
|
||||
existing.is_valid = True
|
||||
from datetime import datetime
|
||||
existing.last_verified_at = datetime.utcnow()
|
||||
await db.commit()
|
||||
await db.refresh(existing)
|
||||
return existing
|
||||
else:
|
||||
# Create new
|
||||
from datetime import datetime
|
||||
credential = GmailCredential(
|
||||
user_id=current_user.id,
|
||||
gmail_email=credential_in.gmail_email,
|
||||
|
||||
Reference in New Issue
Block a user