From 098fa52022eee1472894cdf60828d1d1018a05ef Mon Sep 17 00:00:00 2001 From: Alexis Saettler Date: Mon, 28 Nov 2022 11:03:57 +0100 Subject: [PATCH] fix: fix verification mail (monicahq/chandler#316) --- app/Models/User.php | 16 ++++++++++++++++ package.json | 2 +- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/app/Models/User.php b/app/Models/User.php index 61a04ca27ea..91c01c595c5 100644 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -87,6 +87,22 @@ class User extends Authenticatable implements MustVerifyEmail 'help_shown' => 'boolean', ]; + /** + * Send the email verification notification. + * + * @return void + */ + public function sendEmailVerificationNotification(): void + { + if (config('mail.default') !== 'smtp' || ( + config('mail.mailers.smtp.username') !== null && config('mail.mailers.smtp.password') !== null + )) { + parent::sendEmailVerificationNotification(); + } else { + $this->markEmailAsVerified(); + } + } + /** * Get the account record associated with the user. * diff --git a/package.json b/package.json index 32d233c8e12..34c52166128 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,7 @@ "posttest": "vendor/bin/phpstan analyse && vendor/bin/psalm", "test": "vendor/bin/phpunit", "docker:build": "docker build --cache-from monica-next -t monica-next -f scripts/docker/Dockerfile . && docker image prune -f", - "docker:run": "docker run --name monica -p 8080:80 -e MAIL_MAILER=log monica-next" + "docker:run": "docker run --name monica -p 8080:80 monica-next" }, "devDependencies": { "@inertiajs/inertia": "^0.11.0",