Files
Atomcms-edit/app/Rules/CurrentPasswordRule.php
T
2026-05-09 17:32:17 +02:00

22 lines
505 B
PHP
Executable File

<?php
namespace App\Rules;
use Closure;
use Illuminate\Contracts\Validation\InvokableRule;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Hash;
class CurrentPasswordRule implements InvokableRule
{
/**
* Run the validation rule.
*/
public function __invoke(string $attribute, mixed $value, Closure $fail): void
{
if (! Hash::check($value, Auth::user()->password)) {
$fail('It seems like your current password is wrong.');
}
}
}