<commit_before>class User < ApplicationRecord
  attr_accessor :password

  validates :username, presence: true, uniqueness: true, length: { :in => 3..20 }
  validates :password, :confirmation => true
  validates :password_confirmation, presence: true, on: :create
  validates_length_of :password, in: 6..20, on: :create

  before_save :encrypt_password
  after_save :clear_password

  def encrypt_password
    if password.present?
      self.encrypted_password = Digest::SHA1.hexdigest(password)
    end
  end

  def clear_password
    self.password = nil
  end

  def authenticate(pass)
    encrypted = Digest::SHA1.hexdigest(pass)
    encrypted == self.encrypt_password
  end
end<commit_msg>truly slothful<commit_after>class User < ApplicationRecord
  attr_accessor :password

  validates :username, presence: true, uniqueness: true, length: { :in => 3..20 }
  validates :password, :confirmation => true
  validates :password_confirmation, presence: true, on: :create
  validates_length_of :password, in: 6..20, on: :create

  before_save :encrypt_password
  after_save :clear_password

  def encrypt_password
    if password.present?
      self.encrypted_password = <PASSWORD>(password)
    end
  end

  def clear_password
    self.password = <PASSWORD>
  end

  def authenticate(pass)
    encrypted = Digest::SHA1.hexdigest(pass)
    encrypted == self.encrypted_password
  end
end
{'fraction_non_alphanumeric': 0.09031791907514451, 'fraction_numerical': 0.01083815028901734, 'mean_word_length': 4.306513409961686, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7512932', 'n_tokens_mistral': 452, 'n_tokens_neox': 424, 'n_words': 110}