]> git.openstreetmap.org Git - rails.git/blobdiff - app/controllers/application.rb
throw user to login if trying to edit without logging in
[rails.git] / app / controllers / application.rb
index a4f65cd54b9d30bb095285b370b402ecabdeb818..6520e027bc8b5a35b127fe9c15667d4964215235 100644 (file)
@@ -6,6 +6,10 @@ class ApplicationController < ActionController::Base
     @user = User.find_by_token(session[:token])
   end
 
     @user = User.find_by_token(session[:token])
   end
 
+  def require_user
+    redirect_to :controller => 'user', :action => 'login' unless @user
+  end
+
   def authorize(realm='Web Password', errormessage="Could't authenticate you") \r
     username, passwd = get_auth_data # parse from headers\r
     # authenticate per-scheme
   def authorize(realm='Web Password', errormessage="Could't authenticate you") \r
     username, passwd = get_auth_data # parse from headers\r
     # authenticate per-scheme