public function Validate($username, $password) { try { if ($_GET["doCAS"] == 1) { phpCAS::forceAuthentication(); } else { return parent::Validate($username, $password); } } catch (Exception $ex) { Log::Error('CAS exception: %s', $ex); return false; } return true; }
function testMigratesPasswordNewPasswordHasNotBeenSet() { $id = 1; $password = '******'; $username = '******'; $oldPassword = md5($password); $rows = array(array(ColumnNames::USER_ID => $id, ColumnNames::PASSWORD => null, ColumnNames::SALT => null, ColumnNames::OLD_PASSWORD => $oldPassword)); $this->db->SetRows($rows); $this->fakePassword->_ValidateResult = true; $this->auth->Validate($username, $password); $this->assertTrue($this->fakeMigration->_CreateCalled); $this->assertEquals($password, $this->fakeMigration->_LastPlainText); $this->assertEquals($oldPassword, $this->fakeMigration->_LastOldPassword); $this->assertEquals(null, $this->fakeMigration->_LastNewPassword); $this->assertTrue($this->fakePassword->_ValidateCalled); $this->assertTrue($this->fakePassword->_MigrateCalled); $this->assertEquals(null, $this->fakePassword->_LastSalt); $this->assertEquals($id, $this->fakePassword->_LastUserId); }