module Authpwn::UserExtensions::ApiTokenField
Augments the User
model with a password virtual attribute.
Public Instance Methods
api_token()
click to toggle source
The code from the user's API token credential.
Creates an API token if the user doesn't already have one.
# File lib/authpwn_rails/user_extensions/api_token_field.rb, line 22 def api_token credential = self.api_token_credential || Tokens::Api.random_for(self) credential.code end
api_token_credential()
click to toggle source
Credentials::Password instance associated with this user.
# File lib/authpwn_rails/user_extensions/api_token_field.rb, line 15 def api_token_credential credentials.find { |c| c.instance_of?(Tokens::Api) } end