We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 2f67c52 + 7c1df05 commit a9fa5dcCopy full SHA for a9fa5dc
lib/kracken/controllers/authenticatable.rb
@@ -32,12 +32,13 @@ def sign_in_path(return_to=nil)
32
end
33
34
def authenticate_user
35
+ check_token_expiry!
36
user_signed_in?
37
38
39
def authenticate_user!
- check_token_expiry!
40
- return if user_signed_in?
+ return if authenticate_user
41
+
42
if request.format == :json
43
render json: {error: '401 Unauthorized'}, status: :unauthorized
44
elsif request.format == :js
spec/kracken/controllers/authenticatable_spec.rb
@@ -95,6 +95,7 @@ class ControllerDouble < BaseControllerDouble
95
96
97
it "#authenticate_user is true" do
98
+ controller.session[:token_expires_at] = Time.zone.now + 5.minutes
99
expect(controller.authenticate_user).to be_truthy
100
101
0 commit comments