Corcel\Password\PasswordService::makeHash PHP 메소드

makeHash() 공개 메소드

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

Usage Example

예제 #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