Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #394 #439

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
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
1 change: 1 addition & 0 deletions app/models/spree/auth_configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
3 changes: 2 additions & 1 deletion app/models/spree/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion lib/spree/authentication_helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion lib/views/frontend/spree/user_sessions/new.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
<%= render :partial => 'spree/shared/login' %>
<div class="text-center">
<%= Spree.t(:or) %>
<%= link_to Spree.t(:create_a_new_account), spree.signup_path %> |
<% if Spree::Auth::Config[:registerable] %>
<%= link_to Spree.t(:create_a_new_account), spree.signup_path %> |
<% end %>
<%= link_to Spree.t(:forgot_password), spree.recover_password_path %>
</div>
<div data-hook="login_extras"></div>
Expand Down
2 changes: 1 addition & 1 deletion spree_auth_devise.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ Gem::Specification.new do |s|
s.add_development_dependency 'factory_bot', '~> 4.7'
s.add_development_dependency 'ffaker'
s.add_development_dependency 'launchy'
s.add_development_dependency 'mysql2', '~> 0.3.18'
s.add_development_dependency 'mysql2', '>= 0.3.18', '<= 0.5.2'
s.add_development_dependency 'pg', '~> 0.18'
s.add_development_dependency 'selenium-webdriver'
s.add_development_dependency 'pry'
Expand Down