| Server IP : 104.21.26.206 / Your IP : 216.73.216.227 [ Web Server : Apache System : Linux frog 6.1.0-49-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.174-1 (2026-05-26) x86_64 User : web13 ( 5017) PHP Version : 8.3.31 Disable Function : NONE Domains : 41 Domains MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /var/www/clients/client12/web13/web/ahelos/app/Http/Controllers/Auth/ |
Upload File : |
<?php
namespace App\Http\Controllers\Auth;
use Illuminate\Auth\Events\PasswordReset;
use App\Http\Controllers\Controller;
use App\Providers\RouteServiceProvider;
use Illuminate\Foundation\Auth\ResetsPasswords;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Validator;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Facades\Password;
use Illuminate\Support\Str;
use App\Notifications\CustomResetPasswordNotification;
class ResetPasswordController extends Controller
{
/*
|--------------------------------------------------------------------------
| Password Reset Controller
|--------------------------------------------------------------------------
|
| This controller is responsible for handling password reset requests
| and uses a simple trait to include this behavior. You're free to
| explore this trait and override any methods you wish to tweak.
|
*/
use ResetsPasswords;
/**
* Where to redirect users after resetting their password.
*
* @var string
*/
// protected $redirectTo = RouteServiceProvider::HOME;
public function reset(Request $request){
$request->validate([
'token' => 'required',
'email' => 'required|email',
'password' => 'required|min:3|confirmed',
],
[
'required' => 'Задължително поле!',
'email' => 'Моля въведете валиден имейл!',
'min' => 'Паролата трябва да бъде поне :min символа!',
'confirmed' => 'Паролите не съвпадат!',
]);
$status = Password::reset(
$request->only('email', 'password', 'password_confirmation', 'token'),
function ($user, $password) {
$user->forceFill([
'password' => Hash::make($password)
])->setRememberToken(Str::random(60));
$user->save();
event(new CustomResetPasswordNotification($user));
}
);
return $status === Password::PASSWORD_RESET
? redirect()->route('login')->with('status', __($status))
: back()->withErrors(['email' => [__($status)]]);
}
}