public function authenticate() { $data = array("username" => Input::get("username"), "password" => Input::get("password")); // $auth = new User(); if ($auth->Authenticate($data)) { if (Auth::attempt($data)) { return Redirect::to('/')->with('message_login_success', 'Đăng nhập thành công!'); } else { return Redirect::to('login')->withInput()->with('message_error', 'Mật khẩu không chính xác!'); } } else { return Redirect::to('login')->withInput()->with('message_error', 'Tài khoản hoặc mật khẩu không chính xác!'); } }
if ($_GET['action'] == 'authenticate') { if (!isset($_POST['username']) || !isset($_POST['password'])) { die(formatJSEND("error", "Missing username or password")); } $User->username = $_POST['username']; $User->password = $_POST['password']; // check if the asked languages exist and is registered in languages/code.php require_once '../../languages/code.php'; if (isset($languages[$_POST['language']])) { $User->lang = $_POST['language']; } else { $User->lang = 'en'; } // theme $User->theme = $_POST['theme']; $User->Authenticate(); } /* OpenCart LOGIN */ if ($_GET['action'] == 'opencart') { if (isset($_SESSION['codemanager']) && $_SESSION['codemanager'] == true) { $User->username = '******'; $User->password = '******'; // check if the asked languages exist and is registered in languages/code.php require_once '../../languages/code.php'; if (isset($languages[$_POST['language']])) { $User->lang = $_POST['language']; } else { $User->lang = 'en'; } // theme $User->theme = $_POST['theme'];
echoResponse(SUCCESS_CODE, $response); }); // // ServiceAPIUtils::CallAPIService( $dataArray,"/User/ShowAll/123", "json" ); $app->post("/User/Authenticate/123", function () use($app) { require "../src/services/User.php"; //TODO: check this later include_once dirname(__FILE__) . '../../include/Config.php'; // verifyRequiredParams(array("loginname", "password", "deviceid", "ipaddress", "gpscoordinates")); // $userID = $app->request->post("userid"); //$request = Slim::getInstance()->request(); $request = $app->request(); $userData = json_decode($request->post('data')); //$userData = json_decode($request->getBody()); $userObj = new User(); $dataArray = array("email" => $userData->email, "password" => $userData->password); $response = $userObj->Authenticate($dataArray); if ($response == null || $response == FAILED) { handleErrorResponse($response); } echoResponse(SUCCESS_CODE, $response); }); //"/User/CheckEmailAvailability/123" /* * $dataArray = array( "email"=>$this->email, "accountType"=>$this->accountType, "profileId"=>$profileId, "userId"=>$userId ); */ $app->post("/User/CheckEmailAvailability/123", function () use($app) {
<?php include "../../includes/layouts/admin-header.php"; require_once "../../includes/initialize.php"; if ($session->IsLoggedIn()) { RedirectTo("index.php"); } if (isset($_POST["submit"])) { $username = trim($_POST['username']); $password = trim($_POST['password']); $found_user = User::Authenticate($username, $password); if ($found_user) { $session->LogIn($found_user); $log_file->WriteLog($username, "has logged in"); RedirectTo("index.php"); } else { echo "wrong"; } } else { $username = ""; $password = ""; } ?> <section class="all-subj-menu"><div></div></section> <section class="page"> <div> <h2>Login</h2> <form action="login.php" method="post">
} else { unset($args['userinfo'][$key]); } break; default: } } User::leaveStatusMode(); include "views/show.view.php"; } } } else { if ($action == 'login') { $vid = get_viewer_id(); session_regenerate_id(); $res = User::Authenticate($params['name'], $params['password'], $error); if ($res) { Error::generate('notice', 'Authentication successful'); Pageview::RenameUser($vid, get_viewer_id()); if (isset($_SESSION) && $_SESSION['last_rendered_page']) { redirect_raw($_SESSION['last_rendered_page']); } else { redirect(); } } else { Error::generate('notice', $error, Error::$FLAGS['single']); include "views/login.view.php"; } } else { if ($action == 'forgot_password') { $name = $params['name'];