Force user to authenticate instead of raising error

This commit is contained in:
Marek Lewandowski 2012-09-29 15:52:30 +02:00
parent 531c5b0c32
commit 125e45cdba
2 changed files with 4 additions and 3 deletions

View file

@ -83,7 +83,7 @@ class PeopleController < ApplicationController
def show def show
@person = Person.find_from_guid_or_username(params) @person = Person.find_from_guid_or_username(params)
raise(ActiveRecord::RecordNotFound) if remote_profile_with_no_user_session? authenticate_user! if remote_profile_with_no_user_session?
return redirect_to :back, :notice => t("people.show.closed_account") if @person.closed_account? return redirect_to :back, :notice => t("people.show.closed_account") if @person.closed_account?
@post_type = :all @post_type = :all

View file

@ -287,11 +287,12 @@ describe PeopleController do
end end
end end
it 'throws 404 if the person is remote' do it 'forces to sign in if the person is remote' do
p = FactoryGirl.create(:person) p = FactoryGirl.create(:person)
get :show, :id => p.to_param get :show, :id => p.to_param
response.status.should == 404 response.should be_redirect
response.should redirect_to new_user_session_path
end end
end end