From 059e0d95d0c28bc5060e87e146eaf7411f51bf90 Mon Sep 17 00:00:00 2001 From: George Halkiadakis Date: Thu, 27 Apr 2023 03:47:30 +0300 Subject: skeleton commit; based on an anom project --- core/classes/authentication/Core/PasswordTrait.php | 38 ++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 core/classes/authentication/Core/PasswordTrait.php (limited to 'core/classes/authentication/Core/PasswordTrait.php') diff --git a/core/classes/authentication/Core/PasswordTrait.php b/core/classes/authentication/Core/PasswordTrait.php new file mode 100644 index 0000000..40a7381 --- /dev/null +++ b/core/classes/authentication/Core/PasswordTrait.php @@ -0,0 +1,38 @@ + $this->cost]); + } + + + public function isPasswordValid(UserInterface $user, string $plainPassword): bool + { + return password_verify($plainPassword, $user->getPassword()); + } + + + public function setCost(int $cost): void + { + if ($cost < 4 || $cost > 31) { + throw new \InvalidArgumentException('Cost must be in the range of 4-31.'); + } + $this->cost = $cost; + } +} -- cgit v1.2.3