module DqAdmin class User < ApplicationRecord DEFAULT_USER_EMAIL = 'admin@dq.com' # Include default devise modules. Others available are: # :confirmable, :lockable, :timeoutable and :omniauthable devise :database_authenticatable, :recoverable, :rememberable, :trackable, :validatable def self.populate if User.count == 0 password = SecureRandom.hex User.create(email: User::DEFAULT_USER_EMAIL, username: 'root', password: password, password_confirmation: password) Rails.logger.info "[DQ] root user email: #{DEFAULT_USER_EMAIL} password: #{password}" end rescue => e end def self.generate_test_users 100.times do |i| name = rand(36**10).to_s(36) User.create(email: "#{name}@sap.com", username: name, password: 'password', password_confirmation: 'password') end end end end