private static function performLoginAuth($data, $form) { $user = Model::load("auth.users"); $userData = $user->get(array("filter" => "user_name=?", "bind" => array($data["username"])), Model::MODE_ASSOC, false, false); if (count($userData) == 0) { $form->addError("Please check your username or password"); self::handleNumAttempts($userData); return true; } else { if (Auth::getPermission("can_log_in_to_web", $userData[0]["role_id"], $userData[0]['user_id'])) { /* Verify the password of the user or check if the user is logging in * for the first time. */ if ($userData[0]["password"] === md5($data["password"]) || $userData[0]["user_status"] == 2 || $userData[0]["user_status"] == 4) { self::performUserStatusCheckAction($form, $userData); } else { if ($userData[0]["user_status"] == 3) { $form->addError("Your account has been disabled as a result " . "of too many login attempts. Please contact the system administrator"); return true; } else { if ($userData[0]["user_status"] == 0) { $form->addError("Your account has been disabled. Please contact the system administrator"); return true; } else { $form->addError("Please check your username or password"); self::handleNumAttempts($userData); return true; } } } } else { $form->addError("You are not allowed to log in from this terminal"); self::handleNumAttempts($userData); return true; } } }
<?php require_once APPLICATION_PATH . MODEL_DIR . '/Auth.php'; $media_path = APPLICATION_PATH . '../webroot/admin3/media/'; $auth = new Auth(); if ($auth->isLoggedIn()) { ?> <ul class="nav nav-tabs bottom-space" ng-controller="navCtrl"> <?php if ($auth->getPermission("users")) { ?> <li ng-class="{ active: isActive('/index.php') }"> <a href="index.php"> Users </a> </li> <?php } ?> <?php if ($auth->getPermission("products")) { ?> <li ng-class="{ active: isActive('/products.php') }"> <a href="products.php#/products/search"> Products </a> </li> <?php } ?>
public function mobileapp_markets() { $auth = new Auth(); if ($auth->getPermission("mobileapp_markets")) { require_once __DIR__ . "/../Admin3/mobileapp_markets.php"; } else { echo "Login Required"; } }