turtle-wow-source-kinda/Dumps/Source Code/8 - Development_website/develop/app/Rules/CurrentPassword.php
Brian Oost a1d5bb70b2 Init
2024-08-06 18:06:40 +02:00

25 lines
610 B
PHP

<?php
namespace App\Rules;
use Closure;
use Illuminate\Contracts\Validation\ValidationRule;
use Illuminate\Support\Facades\Auth;
class CurrentPassword implements ValidationRule
{
/**
* Run the validation rule.
*
* @param \Closure(string): \Illuminate\Translation\PotentiallyTranslatedString $fail
*/
public function validate(string $attribute, mixed $value, Closure $fail): void
{
$user = Auth::guard('account')->user();
if (!$user->attemptLogin($value)) {
$fail(__('change_password_modal')['exception']['current_password']);
}
}
}