function authenticate() { // Pull from $_POST @($email = DevblocksPlatform::importGPC($_POST['email'])); @($password = DevblocksPlatform::importGPC($_POST['password'])); $worker = DAO_Worker::login($email, $password); if (!is_null($worker)) { $session = DevblocksPlatform::getSessionService(); $visit = new CerberusVisit(); $visit->setWorker($worker); $session->setVisit($visit); // [TODO] Only direct to /welcome when tour is enabled return true; } else { return false; } }
function authenticate($params = array()) { $server = $params['server']; $port = $params['port']; $dn = $params['dn']; $password = $params['password']; $worker_id = null; // attempt login $conn = ldap_connect($server, $port); ldap_set_option($conn, LDAP_OPT_PROTOCOL_VERSION, 3); if ($conn) { $auth = ldap_bind($conn, $dn, $password); if ($auth) { // search for this user $search_results = ldap_search($conn, $dn, '(objectclass=*)', array('mail')); if ($search_results) { $user_entry = ldap_first_entry($conn, $search_results); if ($user_entry) { // get email addresses for this user $emails = ldap_get_values($conn, $user_entry, 'mail'); if ($emails) { foreach ($emails as $email) { if (is_null($worker_id)) { $worker_id = DAO_Worker::lookupAgentEmail($email); } } } } } } } // we found a worker, continue login if (!is_null($worker_id)) { $worker = DAO_Worker::getAgent($worker_id); $session = DevblocksPlatform::getSessionService(); $visit = new CerberusVisit(); $visit->setWorker($worker); $session->setVisit($visit); return true; } else { return false; } }
function authenticateAction() { //echo "authing!"; @($email = DevblocksPlatform::importGPC($_POST['email'])); @($password = DevblocksPlatform::importGPC($_POST['password'])); // pull auth info out of $_POST, check it, return user_id or false $worker = DAO_Worker::login($email, $password); //echo $email. '-'.$password;print_r($worker);exit(); if (!is_null($worker)) { $session = DevblocksPlatform::getSessionService(); $visit = new CerberusVisit(); $visit->setWorker($worker); $session->setVisit($visit); //$devblocks_response = new DevblocksHttpResponse(array('mobile','mytickets')); $devblocks_response = new DevblocksHttpResponse(array('mobile', 'tickets')); } else { $devblocks_response = new DevblocksHttpResponse(array('mobile', 'login')); //return false; } DevblocksPlatform::redirect($devblocks_response); }
public function authenticateAction() { //echo "authing!"; @($email = DevblocksPlatform::importGPC($_REQUEST['email'])); @($password = DevblocksPlatform::importGPC($_REQUEST['password'])); @($original_path = DevblocksPlatform::importGPC($_REQUEST['original_path'])); // log the worker in $worker = DAO_Worker::login($email, $password); if (!is_null($worker)) { $session = DevblocksPlatform::getSessionService(); $visit = new CerberusVisit(); $visit->setWorker($worker); $session->setVisit($visit); // turn original path into an array... $original_path = explode(',', $original_path); // redirect $devblocks_response = new DevblocksHttpResponse($original_path); } else { $devblocks_response = new DevblocksHttpResponse(array('iphone', 'login')); //return false; } DevblocksPlatform::redirect($devblocks_response); }