Class: User
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- User
- Defined in:
- lib/rails/generators/simple_login/templates/models/user.rb
Instance Method Summary collapse
Instance Method Details
#generate_token(column) ⇒ Object
26 27 28 29 30 |
# File 'lib/rails/generators/simple_login/templates/models/user.rb', line 26 def generate_token(column) begin self[column] = SecureRandom.urlsafe_base64 end while User.exists?(column => self[column]) end |
#send_account_confirmation ⇒ Object
22 23 24 |
# File 'lib/rails/generators/simple_login/templates/models/user.rb', line 22 def send_account_confirmation UserMailer.account_confirmation(self).deliver end |
#send_password_reset ⇒ Object
15 16 17 18 19 20 |
# File 'lib/rails/generators/simple_login/templates/models/user.rb', line 15 def send_password_reset generate_token(:password_reset_token) self.password_reset_sent_at = Time.zone.now save! UserMailer.password_reset(self).deliver end |