PHP Method User::getErrorCount, codiad Code Examples

This page contains top rated real world PHP examples of method User::getErrorCount from package codiad extracted from open source projects. You can rate examples to help us improve the quality of examples
Example #1
Show file File: UserTest.php Project: mr-augustine/sensor-data-repo
0
 public function testInvalidPassword()
 {
     $invalidTest = array('user_id' => 1, 'username' => 'mwatney', 'password' => 'in`v4l1dP@ssW0rd!');
     $invalidUser = new User($invalidTest);
     $this->assertEquals(1, $invalidUser->getErrorCount(), 'The User object should have exactly 1 error');
     $this->assertTrue(!empty($invalidUser->getError('password')), 'The User should have a password error');
 }
Example #2
Show file File: LoginController.class.php Project: mr-augustine/sensor-data-repo
0
 public static function run()
 {
     $user = null;
     $userIsLegit = false;
     if ($_SERVER['REQUEST_METHOD'] == 'POST') {
         $user = new User($_POST);
         if ($user->getErrorCount() == 0) {
             $checkUserArray = UsersDB::getUsersBy('username', $user->getUserName());
             if (count($checkUserArray) > 0) {
                 $checkUser = $checkUserArray[0];
                 $user->setUserId($checkUser->getUserId());
                 $userIsLegit = password_verify($_POST['password'], $checkUser->getPassword());
             }
         }
     } else {
         LoginView::show();
         return;
     }
     if ($userIsLegit) {
         $_SESSION['authenticatedUser'] = $user;
         $_SESSION['authenticated'] = true;
         HomeView::show();
     } else {
         $user->setError('username', 'USERNAME_PASSWORD_COMBO_INVALID');
         $_SESSION['user'] = $user;
         LoginView::show();
     }
 }
Example #3
Show file File: LoginController.class.php Project: raroseman/cs4413-Hoodflix
0
 public static function run()
 {
     if ($_SERVER["REQUEST_METHOD"] == "POST") {
         $user = new User($_POST);
         if ($user->getErrorCount() == 0) {
             ProfileView::show($user);
         } else {
             LoginView::show($user);
         }
     } else {
         LoginView::show(null);
     }
 }
Example #4
Show file File: LoginController.class.php Project: mikeschap/WithTheClothesOnYourBack
0
 public static function run()
 {
     if ($_SERVER["REQUEST_METHOD"] == "POST") {
         $user = new User($_POST, True);
         if ($user->getErrorCount() == 0) {
             LogController::run("In");
         } else {
             LoginView::show($user);
         }
     } else {
         LoginView::show(null);
     }
 }
Example #5
Show file File: SignupController.class.php Project: raroseman/cs4413-Hoodflix
0
 public static function run()
 {
     if ($_SERVER["REQUEST_METHOD"] == "POST") {
         $user = new User($_POST);
         $userData = new UserData($_POST);
         if ($user->getErrorCount() == 0 && $userData->getErrorCount() == 0) {
             HomeView::show();
         } else {
             SignupView::show($user, $userData);
         }
     } else {
         SignupView::show(null, null);
     }
 }
Example #6
Show file File: LoginController.class.php Project: bennilyn/examples
0
 public static function run()
 {
     if ($_SERVER["REQUEST_METHOD"] == "POST") {
         $user = new User($_POST);
         // What if already logged in?
         if ($user->getErrorCount() == 0) {
             UserView::show($user);
         } else {
             LoginView::show($user);
         }
     } else {
         // Initial link
         LoginView::show(null);
     }
 }
Example #7
Show file File: SignupController.class.php Project: mr-augustine/sensor-data-repo
0
 public static function run()
 {
     if ($_SERVER["REQUEST_METHOD"] == "POST") {
         //simpleEcho.php;
         $user = new User($_POST);
         $userData = new UserData($_POST);
         //print_r($_FILES); echo '<br>';
         if ($user->getErrorCount() == 0 && $userData->getErrorCount() == 0) {
             ProfileView::show($userData);
         } else {
             SignupView::show($user, $userData);
         }
     } else {
         // Initial link
         SignupView::show(null, null);
     }
 }
Example #8
Show file File: SignupController.class.php Project: raroseman/cs4413-Hoodflix
0
 public static function run()
 {
     $user = null;
     $userData = null;
     if ($_SERVER["REQUEST_METHOD"] == "POST") {
         $user = new User($_POST);
         //$dbUser = UsersDB::addUser($user);
         $userData = new UserData($_POST);
         //$_POST["userId"] = $user->getUserId();
         if ($user->getErrorCount() == 0 && $userData->getErrorCount() == 0) {
             $dbUserData = UsersDB::addUser($user, $userData);
             ProfileView::show($user, $userData);
         } else {
             SignupView::show($user, $userData);
         }
     } else {
         SignupView::show(null, null);
     }
 }
Example #9
Show file File: LoginController.class.php Project: bennilyn/examples
0
 public static function run()
 {
     if ($_SERVER["REQUEST_METHOD"] == "POST") {
         $user = new User($_POST);
         if ($user->getErrorCount() != 0) {
             LoginView::show($user);
         } else {
             $users = UsersDB::getUsersBy('userName', $user->getUserName());
             if (!empty($users)) {
                 HomeView::show($users[0]);
             } else {
                 $user->setError('userName', 'USER_NAME_DOES_NOT_EXIST');
                 LoginView::show($user);
             }
         }
     } else {
         // Initial link
         LoginView::show(null);
     }
 }
Example #10
Show file File: LoginController.class.php Project: Trivette/cs4413
0
 public static function run()
 {
     $webuser = NULL;
     $hockuser = NULL;
     $user = NULL;
     if ($_SERVER["REQUEST_METHOD"] == "POST") {
         $user = new User($_POST);
         $webusers = WebUserDB::getUsersBy('userName', $user->getUserName());
         if (empty($webusers)) {
             $user->setError('userName', 'USER_NAME_DOES_NOT_EXIST');
         } else {
             $webuser = $webusers[0];
         }
     }
     if (!is_null($webuser)) {
         if (strcmp($webuser->getPassword(), $user->getPassword()) == 0) {
             //passwords match.
             //get associated hockuser
             echo "<p>" . $webuser . "</p>";
             $hockusers = HockUserDB::getUsersBy('name', $webuser->getHockName());
             if (empty($hockusers)) {
                 $user->setError('userName', 'HOCK_NAME_UNASSOCIATED_WITH_ACCOUNT');
             } else {
                 $hockuser = $hockusers[0];
             }
         } else {
             //Invalid password
             $user->setError('password', 'PASSWORD_INVALID');
         }
     }
     $_SESSION['user'] = $webuser;
     if (is_null($webuser) || $user->getErrorCount() != 0) {
         LoginView::show($user);
     } else {
         //show profile
         ProfileView::show($webuser, $hockuser);
         //show home
         //HomeView::show();
         //header('Location: /'.$_SESSION['base'].'/user/profile');
     }
 }
Example #11
Show file File: SignupController.class.php Project: mr-augustine/sensor-data-repo
0
 public static function run()
 {
     $user = null;
     if ($_SERVER['REQUEST_METHOD'] == 'POST') {
         $formUser = new User($_POST);
         if ($formUser->getErrorCount() == 0) {
             $plaintextPassword = $formUser->getPassword();
             $hashedPassword = password_hash($plaintextPassword, PASSWORD_DEFAULT);
             $formUser->setPassword($hashedPassword);
             $user = UsersDB::addUser($formUser);
             if ($user->getErrorCount() == 0) {
                 $_SESSION['user'] = $user;
             }
         } else {
             $user = $formUser;
         }
     }
     if (is_null($user) || $user->getErrorCount() != 0) {
         SignupView::show($user);
     } else {
         ProfileView::show();
     }
 }
Example #12
Show file File: UserTest.php Project: bennilyn/examples
0
 public function testInvalidUserName()
 {
     $invalidTest = array("userName" => "krobbins\$", "password" => "123");
     $s1 = new User($invalidTest);
     $this->assertGreaterThan(0, $s1->getErrorCount(), 'It should have an error if the user name is invalid');
 }