<commit_before>class User < ActiveRecord::Base
  has_many :rounds
  has_many :decks, :through => :rounds
  # Remember to create a migration!

  #add validation
  validates :email, presence: true, uniqueness: true
  #validates :email, format:
  validates :name, presence: true
  validates :password, presence: true

  def self.authenticate(email, password)
    @user = User.where(email: email).first
    if @user.nil?
      return false
    else
      if @user.password == password
        return @user
      else
        return false
      end
    end
  end

end
<commit_msg>added email authentication<commit_after>class User < ActiveRecord::Base
  has_many :rounds
  has_many :decks, :through => :rounds
  # Remember to create a migration!

  #add validation
  validates :email, presence: true, uniqueness: true
  validates :email, format: /\w{1,}+[@]+\w{1,}+[.]+\w{2,}/
  validates :name, presence: true
  validates :password, presence: true

  def self.authenticate(email, password)
    @user = User.where(email: email).first
    if @user.nil?
      return false
    else
      if @user.password == password
        return @user
      else
        return false
      end
    end
  end

end

{'fraction_non_alphanumeric': 0.10310142497904443, 'fraction_numerical': 0.002514668901927913, 'mean_word_length': 2.98, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '901874', 'n_tokens_mistral': 375, 'n_tokens_neox': 361, 'n_words': 115}