Corcel\Password\PasswordService::makeHash PHP Method

makeHash() public method

For integration with other applications, this function can be overwritten to instead use the other package password checking algorithm.
Since: 2.5.0
public makeHash ( string $password ) : string
$password string Plain text user password to hash
return string The hash string of the password
    public function makeHash($password)
    {
        return $this->hasher->HashPassword(trim($password));
    }

Usage Example

Beispiel #1
0
 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`']));
 }
All Usage Examples Of Corcel\Password\PasswordService::makeHash