Sha256: 101018ceafaffffba429928997b28169eb24892618759ff2603c44e814094b2f
Contents?: true
Size: 1.09 KB
Versions: 24
Compression:
Stored size: 1.09 KB
Contents
module Challah module UserPasswordable # Set the password and password_confirmation in one shortcut method. def password!(new_password) self.password = new_password self.password_confirmation = new_password end def password_provider? return true if @password_updated or @username_updated !!providers[:password] end def password_provider providers[:password] || Hash.new end # Set a password for this user def password=(value) if value.to_s.blank? @password = nil @password_updated = false else @password = value @password_updated = true end end # Set the confirmation when changing a password def password_confirmation=(value) @password_confirmation = value end # Was the password updated def password_changed? !!@password end def username @username ||= password_provider? ? password_provider.fetch(:uid, '') : '' end def username=(value) @username_updated = true @username = value.to_s.strip.downcase end end end
Version data entries
24 entries across 24 versions & 1 rubygems