You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
urlhub/app/Rules/PwdCurrent.php

38 lines
768 B

<?php
namespace App\Rules;
use Illuminate\Contracts\Validation\Rule;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Hash;
class PwdCurrent implements Rule
{
/**
* Determine if the validation rule passes.
*
* @param string $attribute
* @param mixed $value
* @return bool
*/
public function passes($attribute, $value)
{
/** @var \App\Models\User */
$user = Auth::user();
return Hash::check($value, $user->password);
}
/**
* Get the validation error message.
*
* @codeCoverageIgnore
*
* @return string
*/
public function message()
{
return 'The password you entered does not match your password. Please try again.';
}
}