Skip to content

Commit

Permalink
Reuse some methods in jwt_refresh feature
Browse files Browse the repository at this point in the history
  • Loading branch information
janko authored and jeremyevans committed Dec 28, 2020
1 parent cafcfd6 commit ee70ca8
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions lib/rodauth/features/jwt_refresh.rb
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,7 @@ def jwt_refresh_token_ds
end

def remove_jwt_refresh_token_key(token)
account_id, token = split_token(token)
token_id, _ = split_token(token)
account_id, token_id, _ = _account_refresh_token_split(token)
jwt_refresh_token_account_token_ds(account_id, token_id).delete
end

Expand Down Expand Up @@ -210,9 +209,7 @@ def before_logout
id, token_id, key = _account_refresh_token_split(token)

if id && token_id && key && (actual = get_active_refresh_token(session_value, token_id)) && timing_safe_eql?(key, convert_token_key(actual))
jwt_refresh_token_account_ds(id).
where(jwt_refresh_token_id_column=>token_id).
delete
jwt_refresh_token_account_token_ds(id, token_id).delete
end
end
end
Expand Down

0 comments on commit ee70ca8

Please sign in to comment.