<commit_before># Courseware User model
class User < ActiveRecord::Base
  authenticates_with_sorcery!

  attr_accessible :email, :password, :password_confirmation

  # Validations
  validates_confirmation_of :password
  validates_presence_of :password, { on: :create }

  validates_presence_of :username
  validates_presence_of :email

  validates_uniqueness_of :username
  validates_uniqueness_of :email<commit_msg>Added more validations to user model.<commit_after># Courseware User model
class User < ActiveRecord::Base
  authenticates_with_sorcery!

  attr_accessible :email, :password, :password_confirmation

  # Validations
  validates_confirmation_of :password
  validates_presence_of :password, { on: :create }
  validates_length_of :password, :minimum => 6, :maximum => 32

  validates_exclusion_of :username, :in => Courseware.config.domain_blacklist
  validates_uniqueness_of :username, :case_sensitive => false
  validates_format_of :username,:with => /^[a-z0-9\-]+$/
  validates_length_of :username, :minimum => 1, :maximum => 32
  validates_presence_of :username

  validates_presence_of :email
  validates_uniqueness_of :email
{'fraction_non_alphanumeric': 0.08413672217353199, 'fraction_numerical': 0.007011393514460999, 'mean_word_length': 6.367741935483871, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 10, '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': '5786951', 'n_tokens_mistral': 380, 'n_tokens_neox': 356, 'n_words': 79}