Skip to content
Browse files

Trust mechanism now tells the user they need to trust the site and us…

…es the base url
  • Loading branch information...
1 parent 052ebcf commit e817408c661cb65024baf468dd4175c43766b8eb @mpurdon committed Aug 22, 2012
View
1 application/config/routes.php
@@ -44,6 +44,7 @@
$route['locations/(:any)/(:any)'] = 'locations/index/$1/$2';
$route['locations/search'] = 'locations/search';
$route['locations'] = 'locations';
+$route['unauthorized/trust'] = 'pages/unauthorized/trust';
$route['unauthorized'] = 'pages/unauthorized';
$route['(:any)'] = 'pages/view/$1';
$route['default_controller'] = "pages/view";
View
9 application/controllers/pages.php
@@ -19,9 +19,16 @@ public function view($page = 'home')
$this->load->view('templates/footer', $data);
}
- public function unauthorized()
+ public function unauthorized($trust=null)
{
$data['title'] = 'Unauthorized Access';
+
+ $data['message'] = 'This site provides intelligence to those who have access. If you are seeing this message, you are not one of them.';
+
+ if (!is_null($trust)) {
+ $data['message'] = 'This site must be viewed in a trusted in-game browser, accept the trust request and <a href="/">try again</a>.';
+ }
+
$this->load->view('templates/header', $data);
$this->load->view('pages/unauthorized', $data);
$this->load->view('templates/footer', $data);
View
15 application/core/MY_Controller.php
@@ -15,15 +15,24 @@ public function __construct()
parent::__construct();
// Don't redirect the unauthorized page...
- if($_SERVER['REQUEST_URI'] == '/unauthorized') {
+ if(strpos($_SERVER['REQUEST_URI'],'/unauthorized') === 0) {
return;
}
// Make sure we are using the IGB
- if (!array_key_exists('HTTP_EVE_ALLIANCEID', $_SERVER)) {
+ if (!array_key_exists('HTTP_EVE_TRUSTED', $_SERVER)) {
error_log('Non-IGB attempted to view the site');
$this->load->helper('url');
- redirect(site_url('unauthorized'));
+ redirect(site_url('unauthorized/trust'));
+ }
+
+ // Make sure the IGB trusts us
+// echo '<pre>',var_dump($_SERVER),'</pre>';
+
+ if (!array_key_exists('HTTP_EVE_TRUSTED', $_SERVER) || $_SERVER['HTTP_EVE_TRUSTED'] != 'Yes') {
+ error_log('An untrusted IGB attempted to view the site');
+ $this->load->helper('url');
+ redirect(site_url('unauthorized/trust'));
}
// Make sure the alliance is correct
View
2 application/views/pages/unauthorized.php
@@ -1,4 +1,4 @@
<div>
<h2>Unauthorized Access</h2>
- <p>This site provides intelligence to those who have access. If you are seeing this message, you aren't one of them.</p>
+ <p><?php echo $message; ?></p>
</div>
View
7 application/views/templates/header.php
@@ -8,7 +8,12 @@
<link rel="stylesheet" type="text/css" href="/static/css/aprise.min.css" media="screen" />
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script>
- <script type="text/javascript" src="/static/js/eve-locations.js"></script>
<script type="text/javascript" src="/static/js/apprise-1.5.min.js.js"></script>
+ <script type="text/javascript" src="/static/js/noty/jquery.noty.js"></script>
+ <script type="text/javascript" src="/static/js/noty/layouts/top.js"></script>
+ <script type="text/javascript" src="/static/js/noty/themes/default.js"></script>
+
+ <script type="text/javascript" src="/static/js/eve-locations.js"></script>
+
</head>
<body>
View
10 static/js/eve-locations.js
@@ -29,7 +29,10 @@ function refreshList() {
$(document).ready(function() {
if (typeof CCPEVE != 'undefined') {
- CCPEVE.requestTrust(document.location.href);
+
+ var current_url = document.location.href;
+ var base_url = current_url.substring(0, current_url.indexOf('/', 7));
+ CCPEVE.requestTrust(base_url);
}
$('#do_refresh').change(function(event) {
@@ -73,7 +76,10 @@ $(document).ready(function() {
CCPEVE.setDestination(system_id);
- alert('Destination set to ' + $(this).text());
+ var noty = noty({
+ timeout: 3000,
+ text: 'Destination set to ' + $(this).text()
+ });
return false;
});

0 comments on commit e817408

Please sign in to comment.
Something went wrong with that request. Please try again.