Skip to content

Commit a9fa5dc

Browse files
Merge pull request #45 from RadiusNetworks/eric/activated-dash-error-1818
Updates authentication check
2 parents 2f67c52 + 7c1df05 commit a9fa5dc

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

lib/kracken/controllers/authenticatable.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,13 @@ def sign_in_path(return_to=nil)
3232
end
3333

3434
def authenticate_user
35+
check_token_expiry!
3536
user_signed_in?
3637
end
3738

3839
def authenticate_user!
39-
check_token_expiry!
40-
return if user_signed_in?
40+
return if authenticate_user
41+
4142
if request.format == :json
4243
render json: {error: '401 Unauthorized'}, status: :unauthorized
4344
elsif request.format == :js

spec/kracken/controllers/authenticatable_spec.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ class ControllerDouble < BaseControllerDouble
9595
end
9696

9797
it "#authenticate_user is true" do
98+
controller.session[:token_expires_at] = Time.zone.now + 5.minutes
9899
expect(controller.authenticate_user).to be_truthy
99100
end
100101

0 commit comments

Comments
 (0)