<commit_before>module Fae
  class User < ActiveRecord::Base
    include Fae::Concerns::Models::Base


    # Include default devise modules. Others available are:
    # :registerable, :confirmable, :lockable, :timeoutable and :omniauthable
    devise :database_authenticatable,
           :recoverable, :rememberable, :trackable, :validatable

    belongs_to :role

    validates_presence_of :first_name, :email, :role
    validates_uniqueness_of :email, message: "That email address is already in use. Give another one a go."
    validates :password, confirmation: true
    # validates :role_id, presence: true
    # validates :password, format: { with: /(?=.*\d)(?=.*[a-zA-Z])/, message: 'requires at least one letter and one number' }

    default_scope { order(:first_name, :last_name) }

    scope :public_users, -> {joins(:role).where.not('fae_roles.name = ?', 'super admin')}

    def super_admin?
      role.name == "super admin"
    end

    def admin?
      role.name == "admin"
    end

    def full_name
      "#{first_name} #{last_name}"
    end

    def display_name
      full_name
    end

    # Called by Devise to see if an user can currently be signed in
    def active_for_authentication?
      active? && super
    end

    # Called by Devise to get the proper error message when an user cannot be signed in
    def inactive_message
      !active? ? :inactive : super
    end
  end
end<commit_msg>removed unneeded code. I was going to add user to the dashboard, but it wasn't specified so I'll do it when the requirement is there<commit_after>module Fae
  class User < ActiveRecord::Base
    # Include default devise modules. Others available are:
    # :registerable, :confirmable, :lockable, :timeoutable and :omniauthable
    devise :database_authenticatable,
           :recoverable, :rememberable, :trackable, :validatable

    belongs_to :role

    validates_presence_of :first_name, :email, :role
    validates_uniqueness_of :email, message: "That email address is already in use. Give another one a go."
    validates :password, confirmation: true
    # validates :role_id, presence: true
    # validates :password, format: { with: /(?=.*\d)(?=.*[a-zA-Z])/, message: 'requires at least one letter and one number' }

    default_scope { order(:first_name, :last_name) }

    scope :public_users, -> {joins(:role).where.not('fae_roles.name = ?', 'super admin')}

    def super_admin?
      role.name == "super admin"
    end

    def admin?
      role.name == "admin"
    end

    def full_name
      "#{first_name} #{last_name}"
    end

    # Called by Devise to see if an user can currently be signed in
    def active_for_authentication?
      active? && super
    end

    # Called by Devise to get the proper error message when an user cannot be signed in
    def inactive_message
      !active? ? :inactive : super
    end
  end
end
{'fraction_non_alphanumeric': 0.09842931937172775, 'fraction_numerical': 0.0, 'mean_word_length': 3.2209131075110458, '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': '4701271', 'n_tokens_mistral': 901, 'n_tokens_neox': 859, 'n_words': 297}