Skip to content

Commit f803a7f

Browse files
committed
Do not cache auth responses
1 parent ff504d3 commit f803a7f

File tree

1 file changed

+10
-11
lines changed

1 file changed

+10
-11
lines changed

app/controllers/auths_controller.rb

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,16 @@ class AuthsController < ApplicationController
1111

1212
def show
1313
if params[:username].present? && params[:session_id].present?
14-
return render text: Rails.cache.fetch("auths_controller_user_#{params[:username]}_session_#{params[:session_id]}", expires_in: 1.hour) do
15-
user = User.find_by(login: params[:username])
16-
# Allows using oauth2 tokens of the new api for authenticating
17-
if user && Doorkeeper::AccessToken.find_by(resource_owner_id: user.id, token: params[:session_id])
18-
OK_MESSAGE
19-
elsif user && find_session_by_id(params[:session_id]).andand.belongs_to?(user)
20-
OK_MESSAGE
21-
else
22-
FAIL_MESSAGE
23-
end
24-
end
14+
user = User.find_by(login: params[:username])
15+
# Allows using oauth2 tokens of the new api for authenticating
16+
res = if user && Doorkeeper::AccessToken.find_by(resource_owner_id: user.id, token: params[:session_id])
17+
OK_MESSAGE
18+
elsif user && find_session_by_id(params[:session_id]).andand.belongs_to?(user)
19+
OK_MESSAGE
20+
else
21+
FAIL_MESSAGE
22+
end
23+
return render text: res
2524
end
2625

2726
user = User.find_by(login: params[:username])

0 commit comments

Comments
 (0)