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.
1 parent b7fcfdf commit e463e79Copy full SHA for e463e79
app/models/devise_token_auth/concerns/user.rb
@@ -92,9 +92,12 @@ def send_unlock_instructions(opts = {})
92
def create_token(client: nil, lifespan: nil, cost: nil, **token_extras)
93
token = DeviseTokenAuth::TokenFactory.create(client: client, lifespan: lifespan, cost: cost)
94
95
+ max_expiration_token = tokens.max_by { |_, token_info| token_info['expiry'] }
96
+ max_expiry = max_expiration_token ? max_expiration_token[1]['expiry'] : 0
97
+
98
tokens[token.client] = {
- token: token.token_hash,
- expiry: token.expiry
99
+ token: token.token_hash,
100
+ expiry: [token.expiry, max_expiry + 1].max
101
}.merge!(token_extras)
102
103
clean_old_tokens
0 commit comments