Permalink
Browse files

Simplified authentication scheme.

  • Loading branch information...
1 parent 7e6cd8f commit 0ac1c5d13cfbcd0d2894c512f3f85001f3fb2286 @tylerhunt committed Apr 2, 2010
@@ -1,4 +1,4 @@
class Admin::BaseController < ApplicationController
- before_filter :verify_access, :except => %w(index show)
+ before_filter :verify_access
layout 'admin'
end
@@ -1,19 +1,10 @@
class ApplicationController < ActionController::Base
- helper :all # include all helpers, all the time
- protect_from_forgery # :secret => '899abf093c3f8f06fc8860c27936a25b'
-
- def login
- verify_access and redirect_to(admin_venues_path)
- end
-
- def logout
- session[:admin] = false
- redirect_to root_path
- end
+ helper :all
+ protect_from_forgery
def verify_access
- authenticate_or_request_with_http_basic("Admin") do |username, password|
- username == 'admin' && password == 'wallstreet' && session[:admin] = true
+ authenticate_or_request_with_http_basic('Admin') do |username, password|
+ username == 'admin' && password == 'wallstreet'
end
end
protected :verify_access
@@ -31,7 +31,6 @@
<div id="footer">
<ul>
<li><%= link_to 'View Site', root_path %></li>
- <li><%= link_to 'Log Out', logout_path %></li>
</ul>
</div>
</div>
@@ -37,9 +37,6 @@
<li><%= link_to 'BarCamp Orlando', 'http://barcamporlando.org' %></li>
<li><%= link_to 'Twitter Search', 'http://search.twitter.com/search?q=BarCampOrlando+OR+%22BarCamp+Orlando%22+OR+%23bcorlando+OR+%23bco2009' %></li>
<li><%= link_to 'Source Code', 'http://github.com/tylerhunt/barcamplive/tree/master' %></li>
- <% if session[:admin] %>
- <li><%= link_to 'Log Out', logout_path %></li>
- <% end %>
</ul>
</div>
</div>
View
@@ -8,9 +8,7 @@
end
end
- map.admin '/admin', :controller => 'application', :action => 'login'
- map.login '/login', :controller => 'application', :action => 'login'
- map.logout '/logout', :controller => 'application', :action => 'logout'
+ map.admin '/admin', :controller => 'admin/venues', :action => 'index'
map.root :controller => 'venues'
end

0 comments on commit 0ac1c5d

Please sign in to comment.