Exemplo n.º 1
0
 public function testHashing()
 {
     $password = '******';
     $hashed = Hash::hashPass($password);
     $this->assertNotEquals($password, $hashed);
     $checked = crypt($password, $hashed);
     $this->assertEquals($hashed, $checked);
 }
Exemplo n.º 2
0
 public function testAuth()
 {
     Conf::set('auth_config_users', array('foo' => 'hashed', 'foobar' => Hash::hashPass('secret')));
     $user = \photon\auth\Auth::authenticate(array('login' => 'foobar', 'password' => 'secret'));
     $this->assertEquals('foobar', $user->login);
     $req = \photon\test\HTTP::baseRequest();
     $req->session = array();
     $this->assertEquals(true, \photon\auth\Auth::login($req, $user));
     $this->assertEquals(false, \photon\auth\Auth::login($req, false));
     $user->is_anonymous = true;
     $this->assertEquals(false, \photon\auth\Auth::login($req, $user));
 }