db/default/user.rb
def prompt_for_admin_password
  if ENV['ADMIN_PASSWORD']
    password = ENV['ADMIN_PASSWORD'].dup
    say "Admin Password #{password}"
  else
    password = ask('Password [spree123]: ') do |q|
      q.echo = false
      q.validate = /^(|.{5,40})$/
      q.responses[:not_valid] = 'Invalid password. Must be at least 5 characters long.'
      q.whitespace = :strip
    end
    password = 'spree123' if password.blank?
  end

  password
end
# see last line where we create an admin if there is none, asking for email and password
see last line where we create an admin if there is none, asking for email and password
see last line where we create an admin if there is none asking for email and password
def prompt_for_admin_password
  if ENV['ADMIN_PASSWORD']
    password = ENV['ADMIN_PASSWORD'].dup
    say "Admin Password #{password}"
  else
    password = ask('Password [spree123]: ') do |q|
      q.echo = false
      q.validate = /^(|.{5,40})$/
      q.responses[:not_valid] = 'Invalid password. Must be at least 5 characters long.'
      q.whitespace = :strip
    end
    password = 'spree123' if password.blank?
  end
  password
end
def prompt_for_admin_password if ENV [ 'ADMIN_PASSWORD' ] password = ENV [ 'ADMIN_PASSWORD' ] . dup say "Admin Password #{password}" else password = ask ( 'Password [spree123]: ' ) do | q | q . echo = false q . validate = / ^(|.{5,40})$ / q . responses [ :not_valid ] = 'Invalid password. Must be at least 5 characters long.' q . whitespace = :strip end password = 'spree123' if password . blank? end password end
see last line where we create an admin if there is none, asking for email and password
see last line where we create an admin if there is none asking for email and password