throw user to login if trying to edit without logging in

This commit is contained in:
Steve Coast 2007-04-07 10:28:38 +00:00
parent 4f826acfca
commit 3789c7b592
2 changed files with 5 additions and 1 deletions

View file

@ -6,6 +6,10 @@ class ApplicationController < ActionController::Base
@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")
username, passwd = get_auth_data # parse from headers
# authenticate per-scheme

View file

@ -1,6 +1,6 @@
class SiteController < ApplicationController
before_filter :authorize_web
before_filter :require_user, :only => [:edit]
def index
end