public function testUserProvider() { $userProvider = new AuthUserProvider(null); $passwordService = new PasswordService(); $user = new User(); $user->user_pass = $passwordService->makeHash('admin'); $this->assertTrue($userProvider->validateCredentials($user, ['password' => 'admin'])); $this->assertFalse($userProvider->validateCredentials($user, ['password' => 'admin`'])); $user->user_pass = $passwordService->makeHash('(V-._p@q8sK=TK1QYHIi'); $this->assertTrue($userProvider->validateCredentials($user, ['password' => '(V-._p@q8sK=TK1QYHIi'])); $this->assertFalse($userProvider->validateCredentials($user, ['password' => '(V-._p@q8sK=TK1QYHIi)`'])); $user->user_pass = $passwordService->makeHash(')_)E~O79}?w+5"4&6{!;ct>656Lx~5'); $this->assertTrue($userProvider->validateCredentials($user, ['password' => ')_)E~O79}?w+5"4&6{!;ct>656Lx~5'])); $this->assertFalse($userProvider->validateCredentials($user, ['password' => ') )E~O79}?w+5"4&6{!;ct>656Lx~5`'])); }
/** * Reset the given user's password. * * @param \Illuminate\Contracts\Auth\CanResetPassword $user * @param string $password * @return void */ protected function resetPassword($user, $password) { $passwordService = new PasswordService(); $user->user_pass = $passwordService->makeHash($password); $user->save(); Auth::guard($this->getGuard())->login($user); }