Merge pull request #747 from metamaps/fix/unauth-error
redirect to root_path if you get a 403
This commit is contained in:
commit
9d85dab975
2 changed files with 3 additions and 3 deletions
|
@ -35,7 +35,7 @@ class ApplicationController < ActionController::Base
|
|||
|
||||
def handle_unauthorized
|
||||
if authenticated?
|
||||
head :forbidden # TODO: make this better
|
||||
redirect_to root_path, notice: "You don't have permission to see that page."
|
||||
else
|
||||
redirect_to new_user_session_path, notice: 'Try signing in to do that.'
|
||||
end
|
||||
|
|
|
@ -79,8 +79,8 @@ RSpec.describe MapsController, type: :controller do
|
|||
id: unowned_map.to_param
|
||||
}
|
||||
end.to change(Map, :count).by(0)
|
||||
expect(response.body).to eq ''
|
||||
expect(response.status).to eq 403
|
||||
expect(response.headers['Location']).to eq(request.base_url + root_path)
|
||||
expect(response.status).to eq 302
|
||||
end
|
||||
|
||||
it 'deletes owned map' do
|
||||
|
|
Loading…
Reference in a new issue