<commit_before>class Administration < ApplicationRecord
  # Include default devise modules. Others available are:
  # :confirmable, :lockable, :timeoutable and :omniauthable
  devise :database_authenticatable, :rememberable, :trackable, :validatable, :omniauthable, :async, omniauth_providers: [:github]

  def self.from_omniauth(params)
    find_by(email: params["info"]["email"])
  end

  def invite_admin(email)
    password = <PASSWORD>
    administrateur = Administrateur.new({
      email: email,
      active: false,
      password: password,
      password_confirmation: password
    })

    if administrateur.save
      AdministrationMailer.new_admin_email(administrateur, self).deliver_later
      administrateur.invite!(id)
      User.create({
        email: email,
        password: password
      })
    end

    administrateur
  end
end
<commit_msg>[Fix #2042] Pre-validate users for administrateurs<commit_after>class Administration < ApplicationRecord
  # Include default devise modules. Others available are:
  # :confirmable, :lockable, :timeoutable and :omniauthable
  devise :database_authenticatable, :rememberable, :trackable, :validatable, :omniauthable, :async, omniauth_providers: [:github]

  def self.from_omniauth(params)
    find_by(email: params["info"]["email"])
  end

  def invite_admin(email)
    password = <PASSWORD>
    administrateur = Administrateur.new({
      email: email,
      active: false,
      password: password,
      password_confirmation: password
    })

    if administrateur.save
      AdministrationMailer.new_admin_email(administrateur, self).deliver_later
      administrateur.invite!(id)
      User.create({
        email: email,
        password: password,
        confirmed_at: DateTime.now
      })
    end

    administrateur
  end
end

{'fraction_non_alphanumeric': 0.09282934963868816, 'fraction_numerical': 0.0022234574763757642, 'mean_word_length': 3.712041884816754, 'pattern_counts': {'":': 0, '<': 7, '<?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': '1655734', 'n_tokens_mistral': 531, 'n_tokens_neox': 522, 'n_words': 121}