Skip to content

Commit 2f40052

Browse files
committed
Fixing API to 401 rather than 302.
When our auth is bad, we shouldn't 302, we should 401. That was stupid.
1 parent 4d92b60 commit 2f40052

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

controllers/programs_controller.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@
7171
put "/programs/:username/:slug.json" do
7272
require_login_or_api! :username => params[:username], :password => params[:password]
7373
if current_user.username != params[:username]
74-
redirect "/"
74+
halt 401
7575
end
7676
program = Program.first(:creator_username => params[:username], :slug => params[:slug])
7777
if program.nil?

helpers.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ def require_login_or_api!(opts = {:return => "/"})
5757
if hacker
5858
session[:hacker_id] = hacker.id
5959
else
60-
require_login!(opts)
60+
halt 401
6161
end
6262
end
6363

0 commit comments

Comments
 (0)