Files
kulakpos_web/walkthroughs/2026-05-09_48779001_Walkthrough__Fixed_Registration_OTP_Issue.md
eko54r 05fd3230b8
All checks were successful
Build, Push and Deploy / build-and-push (push) Successful in 5m14s
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 17s
Build, Push and Deploy / deploy-staging (push) Successful in 41s
Build, Push and Deploy / deploy-production (push) Has been skipped
update marketing
2026-05-14 11:55:22 +07:00

1.5 KiB

Walkthrough - Fixed Registration OTP Issue

I have fixed the issue where the OTP (token) screen was not showing after registration in the Docker environment.

Changes Made

Configuration Improvements

  • config/mail.php: Added queue_mail and otp_visibility_time to the configuration file. This allows these settings to be accessed reliably via the config() helper.

Controller Refactoring

  • RegisteredUserController.php: Replaced direct env() calls with config() calls.
    • env('MAIL_USERNAME') is now config('mail.mailers.smtp.username').
    • env('QUEUE_MAIL') is now config('mail.queue_mail').
    • env('OTP_VISIBILITY_TIME') is now config('mail.otp_visibility_time').

Rationale

In Laravel, the env() function should only be used in configuration files. If the configuration is cached (which is common in production or Docker deployments), env() calls in controllers will return null. This was causing the registration process to think that the mail service was not configured, leading to a 406 Not Acceptable error instead of showing the OTP modal.

How to Verify

  1. Clear the configuration cache in your Docker container:
    php artisan config:clear
    
  2. Test the registration flow again. The OTP screen should now appear as expected.