From 92d0a5b73503f4926cea8ac3971a1742200a6575 Mon Sep 17 00:00:00 2001 From: Luis Ramos Date: Mon, 13 Apr 2020 18:49:23 +0100 Subject: [PATCH 1/2] Change default user from spree@example.com to ofn@example.com --- GETTING_STARTED.md | 6 +++--- db/default/users.rb | 12 ++++++------ lib/spree/api/testing_support/setup.rb | 4 ++-- script/setup | 8 ++++---- spec/controllers/api/base_controller_spec.rb | 2 +- spec/controllers/api/shipments_controller_spec.rb | 2 +- .../spree/admin/mail_methods_controller_spec.rb | 4 ++-- .../admin/configuration/mail_methods_spec.rb | 2 +- spec/support/api_helper.rb | 2 +- 9 files changed, 21 insertions(+), 21 deletions(-) diff --git a/GETTING_STARTED.md b/GETTING_STARTED.md index 84b38663aa..b2042a8b1e 100644 --- a/GETTING_STARTED.md +++ b/GETTING_STARTED.md @@ -58,10 +58,10 @@ Now, your dreams of spinning up a development server can be realised: bundle exec rails server -To login as Spree default user, use: +To login as the default user, use: - email: spree@example.com - password: spree123 + email: ofn@example.com + password: ofn123 ### Testing diff --git a/db/default/users.rb b/db/default/users.rb index 1bad9daf8a..c968ccf778 100644 --- a/db/default/users.rb +++ b/db/default/users.rb @@ -6,13 +6,13 @@ def prompt_for_admin_password password = ENV['ADMIN_PASSWORD'].dup say "Admin Password #{password}" else - password = ask('Password [spree123]: ') do |q| + password = ask('Password [ofn123]: ') 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? + password = 'ofn123' if password.blank? end password @@ -23,11 +23,11 @@ def prompt_for_admin_email email = ENV['ADMIN_EMAIL'].dup say "Admin User #{email}" else - email = ask('Email [spree@example.com]: ') do |q| + email = ask('Email [ofn@example.com]: ') do |q| q.echo = true q.whitespace = :strip end - email = 'spree@example.com' if email.blank? + email = 'ofn@example.com' if email.blank? end email @@ -35,8 +35,8 @@ end def create_admin_user if ENV.fetch("AUTO_ACCEPT", true) - password = ENV.fetch("ADMIN_PASSWORD", "spree123").dup - email = ENV.fetch("ADMIN_EMAIL", "spree@example.com").dup + password = ENV.fetch("ADMIN_PASSWORD", "ofn123").dup + email = ENV.fetch("ADMIN_EMAIL", "ofn@example.com").dup else puts 'Create the admin user (press enter for defaults).' #name = prompt_for_admin_name unless name diff --git a/lib/spree/api/testing_support/setup.rb b/lib/spree/api/testing_support/setup.rb index f07b152999..3ff75abc04 100644 --- a/lib/spree/api/testing_support/setup.rb +++ b/lib/spree/api/testing_support/setup.rb @@ -4,7 +4,7 @@ module Spree module Setup def sign_in_as_user! let!(:current_api_user) do - user = Spree::LegacyUser.new(email: "spree@example.com") + user = Spree::LegacyUser.new(email: "ofn@example.com") user.stub(:has_spree_role?).with("admin").and_return(false) user.stub(:enterprises) { [] } user.stub(:owned_groups) { [] } @@ -31,7 +31,7 @@ module Spree def sign_in_as_admin! let!(:current_api_user) do - user = Spree::LegacyUser.new(email: "spree@example.com") + user = Spree::LegacyUser.new(email: "ofn@example.com") user.stub(:has_spree_role?).with("admin").and_return(true) # Stub enterprises, needed for cancan ability checks diff --git a/script/setup b/script/setup index 65f46d7949..949cdcc234 100755 --- a/script/setup +++ b/script/setup @@ -54,7 +54,7 @@ if [ ! -f config/newrelic.yml ]; then fi # Set up the database for both development and test -# Confirming the default user and password Spree prompts +# Confirming the default user and password printf '\n\n' | bundle exec rake db:setup db:test:prepare printf '\n' @@ -65,8 +65,8 @@ printf '\n' printf "${YELLOW}WELCOME TO OPEN FOOD NETWORK!\n" printf '\n' -printf "To login as the Spree default user, use:" +printf "To login as the default user, use:" printf '\n' printf '\n' -printf ' email: spree@example.com\n' -printf " password: spree123\n${NO_COLOR}" +printf ' email: ofn@example.com\n' +printf " password: ofn123\n${NO_COLOR}" diff --git a/spec/controllers/api/base_controller_spec.rb b/spec/controllers/api/base_controller_spec.rb index 9e31fc138e..69db1ece52 100644 --- a/spec/controllers/api/base_controller_spec.rb +++ b/spec/controllers/api/base_controller_spec.rb @@ -15,7 +15,7 @@ describe Api::BaseController do context "signed in as a user using an authentication extension" do before do allow(controller).to receive_messages try_spree_current_user: - double(email: "spree@example.com") + double(email: "ofn@example.com") end it "can make a request" do diff --git a/spec/controllers/api/shipments_controller_spec.rb b/spec/controllers/api/shipments_controller_spec.rb index 9e838617e3..d79eaf0c08 100644 --- a/spec/controllers/api/shipments_controller_spec.rb +++ b/spec/controllers/api/shipments_controller_spec.rb @@ -131,7 +131,7 @@ describe Api::ShipmentsController, type: :controller do before do allow_any_instance_of(Spree::Order).to receive_messages(paid?: true, complete?: true) # For the shipment notification email - Spree::Config[:mails_from] = "spree@example.com" + Spree::Config[:mails_from] = "ofn@example.com" shipment.update!(shipment.order) expect(shipment.state).to eq("ready") diff --git a/spec/controllers/spree/admin/mail_methods_controller_spec.rb b/spec/controllers/spree/admin/mail_methods_controller_spec.rb index b58fc75da5..422491660e 100644 --- a/spec/controllers/spree/admin/mail_methods_controller_spec.rb +++ b/spec/controllers/spree/admin/mail_methods_controller_spec.rb @@ -8,13 +8,13 @@ describe Spree::Admin::MailMethodsController do context "#update" do it "should reinitialize the mail settings" do expect(Spree::Core::MailSettings).to receive(:init) - spree_put :update, enable_mail_delivery: "1", mails_from: "spree@example.com" + spree_put :update, enable_mail_delivery: "1", mails_from: "ofn@example.com" end end it "can trigger testmail" do request.env["HTTP_REFERER"] = "/" - user = double('User', email: 'user@spree.com', + user = double('User', email: 'user@example.com', spree_api_key: 'fake', id: nil, owned_groups: nil) diff --git a/spec/features/admin/configuration/mail_methods_spec.rb b/spec/features/admin/configuration/mail_methods_spec.rb index 6ff8db2d6b..d1e550db02 100644 --- a/spec/features/admin/configuration/mail_methods_spec.rb +++ b/spec/features/admin/configuration/mail_methods_spec.rb @@ -15,7 +15,7 @@ describe "Mail Methods" do end it "should be able to edit mail method settings" do - fill_in "mail_bcc", with: "spree@example.com99" + fill_in "mail_bcc", with: "ofn@example.com" click_button "Update" expect(page).to have_content("successfully updated!") end diff --git a/spec/support/api_helper.rb b/spec/support/api_helper.rb index 2dd217117d..5059a94e80 100644 --- a/spec/support/api_helper.rb +++ b/spec/support/api_helper.rb @@ -13,7 +13,7 @@ module OpenFoodNetwork end def current_api_user - @current_api_user ||= Spree::LegacyUser.new(email: "spree@example.com", enterprises: []) + @current_api_user ||= Spree::LegacyUser.new(email: "ofn@example.com", enterprises: []) end def assert_unauthorized! From dd5041db6566bcee272c98174e094aad169d3c8f Mon Sep 17 00:00:00 2001 From: Luis Ramos Date: Thu, 7 May 2020 18:18:42 +0100 Subject: [PATCH 2/2] Remove unnecessary default user email and pwd from docker setup These are now the default values in the app --- docker-compose.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index f4407eb6a4..edd9ac8d1b 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -24,8 +24,6 @@ services: depends_on: - db environment: - ADMIN_EMAIL: ofn@example.com - ADMIN_PASSWORD: ofn123 OFN_DB_HOST: db command: > bash -c "wait-for-it -t 30 db:5432 &&