<commit_before>class User < ApplicationRecord
  has_one :coordinator, dependent: :destroy
  has_one :administrative_assistant, dependent: :destroy
  has_one :department_assistant, dependent: :destroy
  has_secure_password
  accepts_nested_attributes_for :department_assistant, :reject_if => :all_blank
  accepts_nested_attributes_for :coordinator, :reject_if => :all_blank
  accepts_nested_attributes_for :administrative_assistant


#name
validates_length_of :name,
		:within => 7..100,
		:too_short => 'Nome tem que ter no minimo 7 caracters',
		:too_long => 'Nome pode ter no maximo 100 caracters'

# email
VALID_EMAIL_REGEX = /\A[\w+\-.]+@[a-z\d\-]+(?:\.[a-z\d\-]+)*\.[a-z]+\z/i

validates :email, :presence => { :message => 'Email não pode ser vazio' },
	length: { maximum: 50}, uniqueness: true, confirmation: true,
	format: { with: VALID_EMAIL_REGEX, :message => 'Insira um e-mail válido'}

# password
validates :password, length: { minimum: 6, maximum: 20, :message => 'Senha deve possuir o mínimo 6 e máximo de 20 caracteres' }, confirmation: true, on: :create		  			

# cpf
VALID_CPF_REGEX = /\A[0-9]{3}?[0-9]{3}?[0-9]{3}?[0-9]{2}\z/i

validates :cpf, :presence => { :message => 'Cpf nao pode ser vazio' },
	length: { is: 11}, uniqueness: true,
	format: { with: VALID_CPF_REGEX, :message => 'Insira um Cpf válido'}

# registration
validates :registration, :presence => { :message => 'Matricula nao pode ser vazio' },
	length: { is: 9}, uniqueness: true

end<commit_msg>Update email and registration validations<commit_after>class User < ApplicationRecord
  has_one :coordinator, dependent: :destroy
  has_one :administrative_assistant, dependent: :destroy
  has_one :department_assistant, dependent: :destroy
  has_secure_password
  accepts_nested_attributes_for :department_assistant, :reject_if => :all_blank
  accepts_nested_attributes_for :coordinator, :reject_if => :all_blank
  accepts_nested_attributes_for :administrative_assistant


#name
validates_length_of :name,
		:within => 7..100,
		:too_short => 'Nome tem que ter no minimo 7 caracters',
		:too_long => 'Nome pode ter no maximo 100 caracters'

# email
VALID_EMAIL_REGEX = /\A[\w+\-.]+@unb.br\z/i

validates :email, :presence => { :message => 'Email não pode ser vazio' },
	length: { maximum: 50}, uniqueness: true, confirmation: true,
	format: { with: VALID_EMAIL_REGEX, :message => 'Insira um e-mail válido'}

# password
validates :password, length: { minimum: 6, maximum: 20, :message => 'Senha deve possuir o mínimo 6 e máximo de 20 caracteres' }, confirmation: true, on: :create		  			

# cpf
VALID_CPF_REGEX = /\A[0-9]{3}?[0-9]{3}?[0-9]{3}?[0-9]{2}\z/i

validates :cpf, :presence => { :message => 'Cpf nao pode ser vazio' },
	length: { is: 11}, uniqueness: true,
	format: { with: VALID_CPF_REGEX, :message => 'Insira um Cpf válido'}
	
# registration
validates :registration, :presence => { :message => 'Matricula nao pode ser vazio' },
	length: { is: 7}, uniqueness: true

end
{'fraction_non_alphanumeric': 0.14208389715832206, 'fraction_numerical': 0.02097428958051421, 'mean_word_length': 5.084362139917696, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 31, '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': '2846657', 'n_tokens_mistral': 1122, 'n_tokens_neox': 1059, 'n_words': 283}