Module: Sequel::Plugins::SequelAuth::InstanceMethods

Defined in:
lib/sequel_auth.rb

Overview

Instance methods

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#passwordObject

Returns the value of attribute password.



107
108
109
# File 'lib/sequel_auth.rb', line 107

def password
  @password
end

#password_confirmationObject

Returns the value of attribute password_confirmation.



106
107
108
# File 'lib/sequel_auth.rb', line 106

def password_confirmation
  @password_confirmation
end

Instance Method Details

#authenticate(unencrypted) ⇒ Object

Authentication method



116
117
118
119
120
121
122
123
124
# File 'lib/sequel_auth.rb', line 116

def authenticate(unencrypted)
  if model.provider.matches?(self.send(model.digest_column), unencrypted)
    
    self
  else
    
    nil
  end
end

#reset_access_tokenObject

Access token reset



127
128
129
130
131
# File 'lib/sequel_auth.rb', line 127

def reset_access_token
  return unless model.access_token_column
  
  self.update(model.access_token_column => SecureRandom.urlsafe_base64(16))
end

#validateObject

Validation method



134
135
136
137
138
139
# File 'lib/sequel_auth.rb', line 134

def validate
  super
  
  run_basic_validations
  run_password_strength_validations if model.password_strength_enabled?
end