Skip to content

Conversation

@dkhalife
Copy link
Owner

@dkhalife dkhalife commented Mar 2, 2025

  • rework email util
  • switch packages
  • activation email
  • email sending should be async
  • add a registration toggle
  • url encode the codes
  • activation api

Copilot AI review requested due to automatic review settings March 2, 2025 20:09
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Overview

This PR implements a new account activation flow by reworking the email utility, adding an activation API, and switching related packages. It also introduces a registration toggle and updates configuration files to support activation links and asynchronous email sending.

  • Updated backend endpoints to handle account activation.
  • Modified repository methods to support new activation logic.
  • Reworked email utilities and configuration to support async email sending and token encoding.

Reviewed Changes

File Description
backend/handler.go Added endpoint for account activation with token decoding.
internal/repos/user/user.go Added activation logic and registration toggle to user methods.
internal/apis/user.go Updated sign-up and password reset flows to support activation.
internal/utils/email/email.go Reworked email sender to use a new mail package and config changes.
config/*.yaml & config/config.go Updated configuration for server and email settings.
internal/utils/auth/auth.go Added/updated functions for encoding and decoding email tokens.
README.md Documented new configuration keys and changes in behavior.
main.go Integrated backend activation routes into the application startup.
internal/apis/label.go Minor cleanup with formatting adjustments.

Copilot reviewed 13 out of 13 changed files in this pull request and generated no comments.

Comments suppressed due to low confidence (2)

backend/handler.go:29

  • [nitpick] Consider renaming the local variable 'code' returned from auth.DecodeEmailAndCode to avoid shadowing the query parameter 'code' for better clarity.
email, code, err := auth.DecodeEmailAndCode(code)

internal/utils/email/email.go:60

  • Using log.Fatalf in sendEmail can crash the server when an error occurs. Consider returning the error instead for graceful error handling, and review similar log.Fatalf calls in this function.
if err := message.From(es.Email); err != nil { log.Fatalf("failed to set From address: %s", err) }

@dkhalife dkhalife merged commit d0cd0ca into main Mar 2, 2025
4 checks passed
@dkhalife dkhalife deleted the email branch March 2, 2025 20:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants