diff options
Diffstat (limited to 'app/models/concerns/token_authenticatable.rb')
-rw-r--r-- | app/models/concerns/token_authenticatable.rb | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/app/models/concerns/token_authenticatable.rb b/app/models/concerns/token_authenticatable.rb index a1f83884f02..535cf25eb9d 100644 --- a/app/models/concerns/token_authenticatable.rb +++ b/app/models/concerns/token_authenticatable.rb @@ -57,6 +57,13 @@ module TokenAuthenticatable token = read_attribute(token_field) token.present? && ActiveSupport::SecurityUtils.secure_compare(other_token, token) end + + # Base strategy delegates to this method for formatting a token before + # calling set_token. Can be overridden in models to e.g. add a prefix + # to the tokens + mod.define_method("format_#{token_field}") do |token| + token + end end def token_authenticatable_module |