Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions app/models/spree/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ def password=(new_password)
super
end

before_validation :set_login

scope :admin, -> { includes(:spree_roles).where("#{Role.table_name}.name" => "admin") }

def self.admin_created?
Expand All @@ -50,16 +48,10 @@ def password_required?

private

def set_login
# for now force login to be same as email, eventually we will make this configurable, etc.
self.login ||= email if email
end

def scramble_email_and_password
return true if destroyed?

self.email = SecureRandom.uuid + "@example.net"
self.login = email
self.password = SecureRandom.hex(8)
self.password_confirmation = password
save
Expand Down
3 changes: 1 addition & 2 deletions db/default/users.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,7 @@ def create_admin_user
attributes = {
password: password,
password_confirmation: password,
email: email,
login: email
email: email
}

load 'spree/user.rb'
Expand Down
7 changes: 7 additions & 0 deletions db/migrate/20210601202000_remove_login_from_spree_users.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# frozen_string_literal: true

class RemoveLoginFromSpreeUsers < SolidusSupport::Migration[5.1]
def change
remove_column(:spree_users, :login, :string)
end
end