nsa_panel 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -3,7 +3,15 @@
3
3
  ![](nsa-eagle.png)
4
4
 
5
5
  The easiest way to add a special panel for NSA agents to monitor your
6
- users' data. Let's ~~fight terrorism~~ destroy the right to privacy together!
6
+ users' data. Let's ~~destroy the right to privacy~~ fight terrorism together!
7
+
8
+ Why?
9
+
10
+ Well, the government wants to protect you and your users from those
11
+ crazy guys that blow up everything. Everyone wants to be safe. No liberty
12
+ should be superior to the safety and every government is good!
13
+
14
+ Besides, you and your users really have got **nothing to hide**, haven't you?
7
15
 
8
16
  ## Example
9
17
 
@@ -84,6 +92,8 @@ Easy, eh?
84
92
 
85
93
  ## What it looks like
86
94
 
95
+ ![Confirm they have a warrant](0-confirm-warrant.png)
96
+
87
97
  ![Dashboard](1-dashboard.png)
88
98
 
89
99
  ![User details](2-user-details.png)
@@ -0,0 +1,5 @@
1
+ $(function() {
2
+ $('#no-warrant-btn').click(function() {
3
+ alert('Wrong answer, officer.');
4
+ });
5
+ });
@@ -1,11 +1,25 @@
1
1
  module NsaPanel
2
2
  class ApplicationController < ActionController::Base
3
- before_filter :authenticate
3
+ before_filter :authenticate, :require_warrant
4
+
5
+ private
4
6
 
5
7
  def authenticate
6
8
  authenticate_or_request_with_http_basic do |username, password|
7
9
  NsaPanel.username == username && NsaPanel.password == password
8
10
  end
9
11
  end
12
+
13
+ def require_warrant
14
+ render 'nsa_panel/dashboard/law_accordance_check' unless has_warrant?
15
+ end
16
+
17
+ def has_warrant?
18
+ session[:has_warrant] == true
19
+ end
20
+
21
+ def has_warrant!
22
+ session[:has_warrant] = true
23
+ end
10
24
  end
11
25
  end
@@ -0,0 +1,19 @@
1
+ require_dependency "nsa_panel/application_controller"
2
+
3
+ module NsaPanel
4
+ class DashboardController < ApplicationController
5
+ skip_before_filter :require_warrant, only: [:proceed]
6
+
7
+ def index
8
+ redirect_to users_path
9
+ end
10
+
11
+ def law_accordance_check
12
+ end
13
+
14
+ def proceed
15
+ has_warrant!
16
+ redirect_to users_path
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,4 @@
1
+ module NsaPanel
2
+ module DashboardHelper
3
+ end
4
+ end
@@ -0,0 +1,4 @@
1
+ <h3>We want to make sure you are accessing this portal in accordance with the law</h3>
2
+
3
+ <%= link_to 'I have received a FISA warrant', dashboard_proceed_path, method: :post, class: 'btn btn-large btn-block btn-success' %>
4
+ <%= link_to 'I have not received a FISA warrant', '#', class: 'btn btn-large btn-block btn-danger', id: 'no-warrant-btn' %>
data/config/routes.rb CHANGED
@@ -3,5 +3,8 @@ NsaPanel::Engine.routes.draw do
3
3
  resources :data
4
4
  end
5
5
 
6
- root to: 'users#index'
6
+ get '/check' => 'dashboard#law_accordance_check', as: :dashboard_law_accordance_check
7
+ post '/proceed' => 'dashboard#proceed', as: :dashboard_proceed
8
+
9
+ root to: 'dashboard#index'
7
10
  end
@@ -1,3 +1,3 @@
1
1
  module NsaPanel
2
- VERSION = '0.0.4'
2
+ VERSION = '0.0.5'
3
3
  end