module RedTokenAuth::SignInOut

Public Instance Methods

random_token() click to toggle source
# File lib/red_token_auth/sign_in_out.rb, line 22
def random_token
  SecureRandom.hex
end
sign_in(password) click to toggle source
# File lib/red_token_auth/sign_in_out.rb, line 8
def sign_in(password)
  if authenticate(password)
    create_new_authentication_token
  else
    errors.add(:password, :wrong_password)
    false
  end
end
sign_out() click to toggle source
# File lib/red_token_auth/sign_in_out.rb, line 17
def sign_out
  update(authentication_token: nil)
end