fix
This commit is contained in:
parent
6067e5118f
commit
66af4d98ce
@ -17,6 +17,7 @@ public function run(): void
|
||||
'id' => 0,
|
||||
'is_registration_enabled' => true,
|
||||
'extra_attributes' => [
|
||||
'smtp_active' => true,
|
||||
'smtp_test_recipients' => 'test@example.com,test2@example.com',
|
||||
'smtp_host' => 'coolify-mail',
|
||||
'smtp_port' => 1025,
|
||||
|
@ -4,7 +4,6 @@
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Controllers\MagicController;
|
||||
use App\Http\Controllers\ProjectController;
|
||||
use App\Http\Controllers\ServerController;
|
||||
use App\Models\InstanceSettings;
|
||||
use App\Models\PrivateKey;
|
||||
use App\Models\StandaloneDocker;
|
||||
@ -12,10 +11,7 @@
|
||||
use App\Models\GithubApp;
|
||||
use App\Models\GitlabApp;
|
||||
use App\Models\Server;
|
||||
use App\Models\User;
|
||||
use App\Notifications\TransactionalEmails\ResetPasswordEmail;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Password;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
use Illuminate\Support\Str;
|
||||
@ -26,15 +22,19 @@
|
||||
|
||||
|
||||
Route::post('/forgot-password', function (Request $request) {
|
||||
if (!is_transactional_emails_active()) {
|
||||
if (is_transactional_emails_active()) {
|
||||
set_transanctional_email_settings();
|
||||
$request->validate([Fortify::email() => 'required|email']);
|
||||
$status = Password::broker(config('fortify.passwords'))->sendResetLink(
|
||||
$request->only(Fortify::email())
|
||||
);
|
||||
return $status == Password::RESET_LINK_SENT
|
||||
? app(SuccessfulPasswordResetLinkRequestResponse::class, ['status' => $status])
|
||||
: app(FailedPasswordResetLinkRequestResponse::class, ['status' => $status]);
|
||||
if ($status == Password::RESET_LINK_SENT) {
|
||||
return app(SuccessfulPasswordResetLinkRequestResponse::class, ['status' => $status]);
|
||||
}
|
||||
if ($status == Password::RESET_THROTTLED) {
|
||||
return response('Already requested a password reset in the past minutes.', 400);
|
||||
}
|
||||
return app(FailedPasswordResetLinkRequestResponse::class, ['status' => $status]);
|
||||
}
|
||||
return response()->json(['message' => 'Transactional emails are not active'], 400);
|
||||
})->name('password.forgot');
|
||||
|
Loading…
Reference in New Issue
Block a user