feat: reset password

This commit is contained in:
2026-05-21 21:21:03 +02:00
parent 7f60bc756f
commit 19e65e36f3
9 changed files with 330 additions and 32 deletions
+11 -6
View File
@@ -3,6 +3,7 @@
namespace App\Providers;
use App\Broadcasting\ExpoPushChannel;
use App\Mail\ResetPasswordMail;
use App\Mail\VerifyAccount;
use App\Models\User;
use Illuminate\Auth\Notifications\ResetPassword;
@@ -62,15 +63,19 @@ class AppServiceProvider extends ServiceProvider
->to($notifiable->getEmailForVerification())
);
ResetPassword::createUrlUsing(function (User $notifiable, string $token): string {
$passwordResetUrl = rtrim((string) config('services.mobile.password_reset_url'), '?&');
$query = http_build_query([
$passwordResetUrl = function (User $notifiable, string $token): string {
return route('password.reset', [
'email' => $notifiable->getEmailForPasswordReset(),
'token' => $token,
], '', '&', PHP_QUERY_RFC3986);
]);
};
return "{$passwordResetUrl}?{$query}";
});
ResetPassword::createUrlUsing($passwordResetUrl);
ResetPassword::toMailUsing(
fn (User $notifiable, string $token): ResetPasswordMail => (new ResetPasswordMail($notifiable, $passwordResetUrl($notifiable, $token)))
->to($notifiable->getEmailForPasswordReset())
);
Gate::define('viewApiDocs', function ($user = null) {
// Option A : Autoriser tout le monde (Attention : la doc sera publique hors local)