Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue - 1358 Argument error when converting token updated_at using to… #1388

Merged
merged 1 commit into from
Apr 29, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions app/models/devise_token_auth/concerns/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ def create_new_auth_token(client = nil)
token = create_token(
client: client,
last_token: tokens.fetch(client, {})['token'],
updated_at: now
updated_at: now.to_s(:rfc822)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wouldn't this break other's people defaults?

Copy link
Contributor Author

@saichander17 saichander17 Mar 30, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@MaicolBen , Thanks for your review.
Should it not be used like updated_at.to_time. Even in the whole code of this particular gem, whenever it needs to be compared with time, to_time was always used.

)

update_auth_header(token.token, token.client)
Expand Down Expand Up @@ -194,7 +194,7 @@ def build_auth_url(base_url, args)
end

def extend_batch_buffer(token, client)
tokens[client]['updated_at'] = Time.zone.now
tokens[client]['updated_at'] = Time.zone.now.to_s(:rfc822)
update_auth_header(token, client)
end

Expand Down
2 changes: 1 addition & 1 deletion test/test_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class ActiveSupport::TestCase

def age_token(user, client_id)
if user.tokens[client_id]
user.tokens[client_id]['updated_at'] = Time.zone.now - (DeviseTokenAuth.batch_request_buffer_throttle + 10.seconds)
user.tokens[client_id]['updated_at'] = (Time.zone.now - (DeviseTokenAuth.batch_request_buffer_throttle + 10.seconds)).to_s(:rfc822)
user.save!
end
end
Expand Down