diff --git a/app/models/spree/auth_configuration.rb b/app/models/spree/auth_configuration.rb index 9a96fe8c0..1c014ce50 100644 --- a/app/models/spree/auth_configuration.rb +++ b/app/models/spree/auth_configuration.rb @@ -4,5 +4,6 @@ class AuthConfiguration < Preferences::Configuration preference :signout_after_password_change, :boolean, default: true preference :confirmable, :boolean, default: false preference :validatable, :boolean, default: true + preference :registerable, :boolean, default: true end end diff --git a/app/models/spree/user.rb b/app/models/spree/user.rb index c2e3f87bb..79f3ed8ca 100644 --- a/app/models/spree/user.rb +++ b/app/models/spree/user.rb @@ -4,10 +4,11 @@ class User < Spree::Base include UserMethods include UserPaymentSource - devise :database_authenticatable, :registerable, :recoverable, + devise :database_authenticatable, :recoverable, :rememberable, :trackable, :encryptable, encryptor: 'authlogic_sha512' devise :confirmable if Spree::Auth::Config[:confirmable] devise :validatable if Spree::Auth::Config[:validatable] + devise :registerable if Spree::Auth::Config[:registerable] acts_as_paranoid after_destroy :scramble_email_and_password diff --git a/config/routes.rb b/config/routes.rb index a45a87d62..212ff1b1b 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -15,8 +15,8 @@ get '/login' => 'user_sessions#new', :as => :login post '/login' => 'user_sessions#create', :as => :create_new_session get '/logout' => 'user_sessions#destroy', :as => :logout - get '/signup' => 'user_registrations#new', :as => :signup - post '/signup' => 'user_registrations#create', :as => :registration + get '/signup' => 'user_registrations#new', :as => :signup if Spree::Auth::Config[:registerable] + post '/signup' => 'user_registrations#create', :as => :registration if Spree::Auth::Config[:registerable] get '/password/recover' => 'user_passwords#new', :as => :recover_password post '/password/recover' => 'user_passwords#create', :as => :reset_password get '/password/change' => 'user_passwords#edit', :as => :edit_password diff --git a/lib/spree/authentication_helpers.rb b/lib/spree/authentication_helpers.rb index 8ec570fc9..6966530b8 100644 --- a/lib/spree/authentication_helpers.rb +++ b/lib/spree/authentication_helpers.rb @@ -16,7 +16,7 @@ def spree_login_path end def spree_signup_path - spree.signup_path + Spree::Auth::Config[:registerable] ? spree.signup_path : '/' end def spree_logout_path diff --git a/lib/views/frontend/spree/user_sessions/new.html.erb b/lib/views/frontend/spree/user_sessions/new.html.erb index fdce6140d..424dd0e49 100755 --- a/lib/views/frontend/spree/user_sessions/new.html.erb +++ b/lib/views/frontend/spree/user_sessions/new.html.erb @@ -8,7 +8,9 @@ <%= render :partial => 'spree/shared/login' %>