app/models/user.rb
# Encrypts the password attribute and saves the record
Encrypts the password attribute and saves the record
Encrypts the password attribute and saves the record
def encrypt_password
    return if self.password.blank?
    self.password_salt = [Array.new(6){rand(256).chr}.join].pack("m").chomp
    self.password_hash = Digest::SHA256.hexdigest(self.password + self.password_salt)
  end
def encrypt_password return if self . password . blank? self . password_salt = [ Array . new ( 6 ) { rand ( 256 ) . chr } . join ] . pack ( "m" ) . chomp self . password_hash = Digest :: SHA256 . hexdigest ( self . password + self . password_salt ) end
Encrypts the password attribute and saves the record
Encrypts the password attribute and saves the record