Exemplo n.º 1
0
 public function testOfControllerWithRegistrationClosed()
 {
     // make sure registration is closed
     $bvalues = array('namespace' => OptionDAO::APP_OPTIONS, 'option_name' => 'is_registration_open', 'option_value' => 'false');
     $bdata = FixtureBuilder::build('options', $bvalues);
     $controller = new LoginController(true);
     $result = $controller->go();
     $v_mgr = $controller->getViewManager();
     $this->assertEqual($v_mgr->getTemplateDataItem('is_registration_open'), false);
     $this->assertNoPattern('/Register/', $result);
 }
Exemplo n.º 2
0
 public function testIncorrectPassword()
 {
     $_POST['Submit'] = 'Log In';
     $_POST['email'] = '*****@*****.**';
     $_POST['pwd'] = 'notherightpassword';
     $controller = new LoginController(true);
     $results = $controller->go();
     $v_mgr = $controller->getViewManager();
     $this->assertEqual($v_mgr->getTemplateDataItem('controller_title'), 'Log in');
     $this->assertEqual($v_mgr->getTemplateDataItem('errormsg'), 'Incorrect password');
     $this->assertPattern("/Log In/", $results);
 }
Exemplo n.º 3
0
 public function testFailedLoginLockout()
 {
     $hashed_pass = ThinkUpTestLoginHelper::hashPasswordUsingDeprecatedMethod("blah");
     $owner = array('id' => 2, 'email' => '*****@*****.**', 'pwd' => $hashed_pass, 'is_activated' => 1);
     $builder = FixtureBuilder::build('owners', $owner);
     //force login lockout by providing the wrong password more than 10 times
     $i = 1;
     while ($i <= 11) {
         $_POST['Submit'] = 'Log In';
         $_POST['email'] = '*****@*****.**';
         $_POST['pwd'] = 'blah1';
         $controller = new LoginController(true);
         $results = $controller->go();
         $v_mgr = $controller->getViewManager();
         $this->assertEqual($v_mgr->getTemplateDataItem('controller_title'), 'Log in');
         $owner = $this->DAO->getByEmail('*****@*****.**');
         if ($i < 10) {
             $this->assertPattern("/Incorrect password/", $v_mgr->getTemplateDataItem('error_msg'));
             $this->assertEqual($owner->failed_logins, $i);
         } else {
             $this->assertEqual("Inactive account. Account deactivated due to too many failed logins. " . '<a href="forgot.php">Reset your password.</a>', $v_mgr->getTemplateDataItem('error_msg'));
             $this->assertEqual($owner->account_status, "Account deactivated due to too many failed logins");
         }
         $i = $i + 1;
     }
 }