Changeset View
Changeset View
Standalone View
Standalone View
src/app/Http/Controllers/API/PasswordPolicyController.php
Show All 39 Lines | class PasswordPolicyController extends Controller | ||||
*/ | */ | ||||
public function check(Request $request) | public function check(Request $request) | ||||
{ | { | ||||
$userId = $request->input('user'); | $userId = $request->input('user'); | ||||
$user = !empty($userId) ? \App\User::find($userId) : null; | $user = !empty($userId) ? \App\User::find($userId) : null; | ||||
// Get the policy | // Get the policy | ||||
$policy = new Password($user ? $user->walletOwner() : null); | $policy = new Password($user ? $user->walletOwner() : null, $user); | ||||
// Check the password | // Check the password | ||||
$status = $policy->check($request->input('password')); | $status = $policy->check($request->input('password')); | ||||
$passed = array_filter( | $passed = array_filter( | ||||
$status, | $status, | ||||
function ($rule) { | function ($rule) { | ||||
return !empty($rule['status']); | return !empty($rule['status']); | ||||
Show All 10 Lines |