Skip to content

Commit

Permalink
indicate that login is required for "/following"
Browse files Browse the repository at this point in the history
  • Loading branch information
mislav committed Nov 5, 2011
1 parent e8a9111 commit 18f113f
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
8 changes: 7 additions & 1 deletion app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,13 @@ def check_admin
head :forbidden
end
end


def login_required
unless logged_in?
render 'shared/login_required', :status => 401
end
end

private

def render_not_found(message = nil)
Expand Down
1 change: 1 addition & 0 deletions app/controllers/users_controller.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
class UsersController < ApplicationController

before_filter :load_user, :only => [:show, :to_watch, :liked]
before_filter :login_required, :only => [:following]

def index
@users = User.find({}, :sort => ['_id', -1]).to_a
Expand Down
7 changes: 7 additions & 0 deletions app/views/shared/login_required.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<% @title = "Login required" %>
<% body_class 'error' %>
<article>
<h1>This page requires being logged in</h1>

<p>Choose one of the following services above to log in</p>
</article>

0 comments on commit 18f113f

Please sign in to comment.