added current password to the password changing form

This commit is contained in:
Čarodej
2022-01-21 07:41:26 +01:00
parent 6b71eabfa2
commit 4fc61afc11
8 changed files with 131 additions and 67 deletions
@@ -0,0 +1,25 @@
<?php
namespace App\Users\Rules;
use Auth;
use Hash;
use Illuminate\Contracts\Validation\Rule;
class PasswordMatchWithCurrent implements Rule
{
/**
* Determine if the validation rule passes.
*/
public function passes($attribute, $value): bool
{
return Hash::check($value, Auth::user()->password);
}
/**
* Get the validation error message.
*/
public function message(): string
{
return "Your current password doesn't match.";
}
}