solidus_auth_devise 2.0.0 → 2.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (121) hide show
  1. checksums.yaml +5 -5
  2. data/.circleci/config.yml +35 -0
  3. data/.gem_release.yml +5 -0
  4. data/.github/stale.yml +17 -0
  5. data/.gitignore +12 -8
  6. data/.rubocop.yml +2 -0
  7. data/CHANGELOG.md +284 -145
  8. data/Gemfile +22 -14
  9. data/{LICENSE.md → LICENSE} +2 -2
  10. data/README.md +50 -3
  11. data/Rakefile +2 -0
  12. data/app/mailers/spree/user_mailer.rb +4 -2
  13. data/app/models/spree/auth_configuration.rb +2 -0
  14. data/app/models/spree/user.rb +30 -20
  15. data/app/overrides/spree/admin/users/edit/_add_reset_password_form.html.erb.deface +20 -0
  16. data/bin/console +17 -0
  17. data/bin/rails +12 -4
  18. data/bin/setup +8 -0
  19. data/config/initializers/devise.rb +11 -3
  20. data/config/initializers/warden.rb +4 -2
  21. data/config/locales/en.yml +4 -1
  22. data/config/locales/fr.yml +1 -1
  23. data/config/locales/it.yml +4 -4
  24. data/config/routes.rb +16 -15
  25. data/db/default/users.rb +10 -8
  26. data/db/migrate/20101026184949_create_users.rb +9 -7
  27. data/db/migrate/20101026184950_rename_columns_for_devise.rb +3 -1
  28. data/db/migrate/20101214150824_convert_user_remember_field.rb +2 -0
  29. data/db/migrate/20120203010234_add_reset_password_sent_at_to_spree_users.rb +2 -0
  30. data/db/migrate/20120605211305_make_users_email_index_unique.rb +4 -2
  31. data/db/migrate/20140904000425_add_deleted_at_to_users.rb +2 -0
  32. data/db/migrate/20141002154641_add_confirmable_to_users.rb +2 -0
  33. data/db/migrate/20190125170630_add_reset_password_token_index_to_spree_users.rb +34 -0
  34. data/db/migrate/20200417153503_add_unconfirmed_email_to_spree_users.rb +7 -0
  35. data/db/seeds.rb +2 -0
  36. data/lib/controllers/backend/spree/admin/user_passwords_controller.rb +7 -4
  37. data/lib/controllers/backend/spree/admin/user_sessions_controller.rb +12 -10
  38. data/lib/controllers/frontend/spree/user_confirmations_controller.rb +2 -0
  39. data/lib/controllers/frontend/spree/user_passwords_controller.rb +4 -1
  40. data/lib/controllers/frontend/spree/user_registrations_controller.rb +4 -0
  41. data/lib/controllers/frontend/spree/user_sessions_controller.rb +4 -2
  42. data/lib/controllers/frontend/spree/users_controller.rb +20 -15
  43. data/lib/decorators/backend/controllers/spree/admin/base_controller_decorator.rb +20 -0
  44. data/lib/decorators/backend/controllers/spree/admin/orders/customer_details_controller_decorator.rb +22 -0
  45. data/lib/{controllers/frontend → decorators/frontend/controllers}/spree/checkout_controller_decorator.rb +29 -19
  46. data/lib/generators/solidus/auth/install/install_generator.rb +15 -3
  47. data/lib/generators/solidus/auth/install/templates/config/initializers/devise.rb +3 -1
  48. data/lib/solidus/auth.rb +2 -0
  49. data/lib/solidus_auth_devise.rb +13 -5
  50. data/lib/spree/auth/devise.rb +2 -7
  51. data/lib/spree/auth/engine.rb +51 -38
  52. data/lib/spree/auth/version.rb +7 -0
  53. data/lib/spree/authentication_helpers.rb +5 -11
  54. data/lib/tasks/auth.rake +3 -1
  55. data/lib/views/backend/spree/admin/shared/_navigation_footer.html.erb +13 -6
  56. data/lib/views/backend/spree/admin/user_passwords/edit.html.erb +4 -4
  57. data/lib/views/backend/spree/admin/user_passwords/new.html.erb +6 -8
  58. data/lib/views/backend/spree/admin/user_sessions/authorization_failure.html.erb +1 -1
  59. data/lib/views/backend/spree/admin/user_sessions/new.html.erb +9 -9
  60. data/lib/views/backend/spree/layouts/admin/_login_nav.html.erb +4 -4
  61. data/lib/views/frontend/spree/checkout/registration.html.erb +4 -4
  62. data/lib/views/frontend/spree/shared/_login.html.erb +4 -4
  63. data/lib/views/frontend/spree/shared/_login_bar.html.erb +2 -6
  64. data/lib/views/frontend/spree/shared/_login_bar_items.html.erb +6 -0
  65. data/lib/views/frontend/spree/shared/_user_form.html.erb +3 -3
  66. data/lib/views/frontend/spree/user_passwords/edit.html.erb +4 -4
  67. data/lib/views/frontend/spree/user_passwords/new.html.erb +5 -7
  68. data/lib/views/frontend/spree/user_registrations/new.html.erb +3 -3
  69. data/lib/views/frontend/spree/user_sessions/authorization_failure.html.erb +1 -1
  70. data/lib/views/frontend/spree/user_sessions/new.html.erb +2 -2
  71. data/lib/views/frontend/spree/users/edit.html.erb +2 -2
  72. data/lib/views/frontend/spree/users/show.html.erb +12 -12
  73. data/solidus_auth_devise.gemspec +38 -31
  74. data/spec/controllers/spree/admin/base_controller_spec.rb +53 -0
  75. data/spec/controllers/spree/admin/user_passwords_controller_spec.rb +14 -0
  76. data/spec/controllers/spree/base_controller_spec.rb +53 -0
  77. data/spec/controllers/spree/checkout_controller_spec.rb +6 -10
  78. data/spec/controllers/spree/products_controller_spec.rb +6 -3
  79. data/spec/controllers/spree/user_passwords_controller_spec.rb +4 -3
  80. data/spec/controllers/spree/user_registrations_controller_spec.rb +3 -2
  81. data/spec/controllers/spree/user_sessions_controller_spec.rb +14 -0
  82. data/spec/controllers/spree/users_controller_spec.rb +26 -8
  83. data/spec/factories/confirmed_user.rb +7 -5
  84. data/spec/features/account_spec.rb +4 -3
  85. data/spec/features/admin/password_reset_spec.rb +66 -10
  86. data/spec/features/admin/products_spec.rb +2 -1
  87. data/spec/features/admin/sign_in_spec.rb +2 -1
  88. data/spec/features/admin/sign_out_spec.rb +2 -1
  89. data/spec/features/admin_permissions_spec.rb +2 -1
  90. data/spec/features/change_email_spec.rb +3 -2
  91. data/spec/features/checkout_spec.rb +14 -37
  92. data/spec/features/confirmation_spec.rb +6 -10
  93. data/spec/features/order_spec.rb +2 -1
  94. data/spec/features/password_reset_spec.rb +23 -10
  95. data/spec/features/sign_in_spec.rb +2 -1
  96. data/spec/features/sign_out_spec.rb +4 -3
  97. data/spec/features/sign_up_spec.rb +2 -1
  98. data/spec/mailers/user_mailer_spec.rb +2 -1
  99. data/spec/models/order_spec.rb +2 -1
  100. data/spec/models/user_spec.rb +57 -38
  101. data/spec/spec_helper.rb +13 -9
  102. data/spec/support/ability.rb +3 -1
  103. data/spec/support/authentication_helpers.rb +2 -0
  104. data/spec/support/confirm_helpers.rb +23 -10
  105. data/spec/support/email.rb +2 -0
  106. data/spec/support/features/fill_addresses_fields.rb +29 -0
  107. data/spec/support/preferences.rb +10 -2
  108. data/spec/support/spree.rb +2 -0
  109. metadata +327 -243
  110. data/.travis.yml +0 -22
  111. data/app/overrides/auth_admin_login_navigation_bar.rb +0 -11
  112. data/app/overrides/auth_shared_login_bar.rb +0 -10
  113. data/circle.yml +0 -6
  114. data/lib/assets/javascripts/spree/backend/solidus_auth.js +0 -1
  115. data/lib/assets/javascripts/spree/frontend/solidus_auth.js +0 -1
  116. data/lib/assets/stylesheets/spree/backend/solidus_auth.css +0 -3
  117. data/lib/assets/stylesheets/spree/frontend/solidus_auth.css +0 -3
  118. data/lib/controllers/backend/spree/admin/admin_controller_decorator.rb +0 -11
  119. data/lib/controllers/backend/spree/admin/admin_orders_controller_decorator.rb +0 -20
  120. data/lib/controllers/backend/spree/admin/orders/customer_details_controller_decorator.rb +0 -15
  121. data/spec/features/admin/orders_spec.rb +0 -30
@@ -1,27 +1,32 @@
1
- Spree::CheckoutController.class_eval do
2
- prepend_before_action :check_registration,
3
- except: [:registration, :update_registration]
4
- prepend_before_action :check_authorization
1
+ # frozen_string_literal: true
5
2
 
6
- # This action builds some associations on the order, ex. addresses, which we
7
- # don't to build or save here.
8
- skip_before_action :setup_for_current_state, only: [:registration, :update_registration]
3
+ module Spree
4
+ module CheckoutControllerDecorator
5
+ def self.prepended(base)
6
+ base.before_action :check_registration, except: [:registration, :update_registration]
7
+ base.before_action :check_authorization
9
8
 
10
- def registration
11
- @user = Spree::User.new
12
- end
9
+ # This action builds some associations on the order, ex. addresses, which we
10
+ # don't to build or save here.
11
+ base.skip_before_action :setup_for_current_state, only: [:registration, :update_registration]
12
+ end
13
13
 
14
- def update_registration
15
- if params[:order][:email] =~ Devise.email_regexp && current_order.update_attributes(email: params[:order][:email])
16
- redirect_to spree.checkout_path
17
- else
18
- flash[:registration_error] = t(:email_is_invalid, scope: [:errors, :messages])
14
+ def registration
19
15
  @user = Spree::User.new
20
- render 'registration'
21
16
  end
22
- end
23
17
 
24
- private
18
+ def update_registration
19
+ if params[:order][:email] =~ Devise.email_regexp && current_order.update(email: params[:order][:email])
20
+ redirect_to spree.checkout_path
21
+ else
22
+ flash[:registration_error] = t(:email_is_invalid, scope: [:errors, :messages])
23
+ @user = Spree::User.new
24
+ render 'registration'
25
+ end
26
+ end
27
+
28
+ private
29
+
25
30
  def order_params
26
31
  params.
27
32
  fetch(:order, {}).
@@ -39,6 +44,7 @@ Spree::CheckoutController.class_eval do
39
44
  # Introduces a registration step whenever the +registration_step+ preference is true.
40
45
  def check_registration
41
46
  return unless registration_required?
47
+
42
48
  store_location
43
49
  redirect_to spree.checkout_registration_path
44
50
  end
@@ -53,7 +59,7 @@ Spree::CheckoutController.class_eval do
53
59
  end
54
60
 
55
61
  def guest_authenticated?
56
- current_order.try!(:email).present? &&
62
+ current_order&.email.present? &&
57
63
  Spree::Config[:allow_guest_checkout]
58
64
  end
59
65
 
@@ -61,6 +67,10 @@ Spree::CheckoutController.class_eval do
61
67
  # are redirected to the tokenized order url unless authenticated as a registered user.
62
68
  def completion_route
63
69
  return spree.order_path(@order) if spree_current_user
70
+
64
71
  spree.token_order_path(@order, @order.guest_token)
65
72
  end
73
+
74
+ ::Spree::CheckoutController.prepend self
75
+ end
66
76
  end
@@ -1,10 +1,15 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Solidus
2
4
  module Auth
3
5
  module Generators
4
6
  class InstallGenerator < Rails::Generators::Base
7
+ class_option :auto_run_migrations, type: :boolean, default: false
8
+ class_option :skip_migrations, type: :boolean, default: false
9
+
5
10
  def self.source_paths
6
- paths = self.superclass.source_paths
7
- paths << File.expand_path('../templates', __FILE__)
11
+ paths = superclass.source_paths
12
+ paths << File.expand_path('templates', __dir__)
8
13
  paths.flatten
9
14
  end
10
15
 
@@ -17,7 +22,14 @@ module Solidus
17
22
  end
18
23
 
19
24
  def run_migrations
20
- run 'bundle exec rake db:migrate'
25
+ return if options[:skip_migrations]
26
+
27
+ run_migrations = options[:auto_run_migrations] || ['', 'y', 'Y'].include?(ask('Would you like to run the migrations now? [Y/n]'))
28
+ if run_migrations
29
+ run 'bundle exec rake db:migrate'
30
+ else
31
+ puts 'Skipping rake db:migrate, don\'t forget to run it!' # rubocop:disable Rails/Output
32
+ end
21
33
  end
22
34
  end
23
35
  end
@@ -1 +1,3 @@
1
- Devise.secret_key = <%= SecureRandom.hex(50).inspect %>
1
+ # frozen_string_literal: true
2
+
3
+ Devise.secret_key = SecureRandom.hex(50).inspect
@@ -1,2 +1,4 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # This file is required by the dummy app's config/environment
2
4
  require "solidus_auth_devise"
@@ -1,5 +1,13 @@
1
- require "spree_core"
2
- require "solidus_support"
3
- require "spree/auth/devise"
4
- require "spree/authentication_helpers"
5
- require "deface"
1
+ # frozen_string_literal: true
2
+
3
+ require 'solidus_core'
4
+ require 'solidus_support'
5
+ require 'deface'
6
+ require 'devise'
7
+ require 'devise-encryptable'
8
+ require 'cancan'
9
+
10
+ require 'spree/auth/devise'
11
+ require 'spree/auth/version'
12
+ require 'spree/auth/engine'
13
+ require 'spree/authentication_helpers'
@@ -1,14 +1,9 @@
1
- require 'spree/core'
2
- require 'devise'
3
- require 'devise-encryptable'
4
- require 'cancan'
1
+ # frozen_string_literal: true
5
2
 
6
3
  module Spree
7
4
  module Auth
8
- def self.config(&block)
5
+ def self.config
9
6
  yield(Spree::Auth::Config)
10
7
  end
11
8
  end
12
9
  end
13
-
14
- require 'spree/auth/engine'
@@ -1,13 +1,17 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'devise'
2
4
  require 'devise-encryptable'
3
5
 
4
6
  module Spree
5
7
  module Auth
6
8
  class Engine < Rails::Engine
9
+ include SolidusSupport::EngineExtensions
10
+
7
11
  isolate_namespace Spree
8
12
  engine_name 'solidus_auth'
9
13
 
10
- initializer "spree.auth.environment", before: :load_config_initializers do |app|
14
+ initializer "spree.auth.environment", before: :load_config_initializers do |_app|
11
15
  Spree::Auth::Config = Spree::AuthConfiguration.new
12
16
  end
13
17
 
@@ -16,65 +20,74 @@ module Spree
16
20
  end
17
21
 
18
22
  config.to_prepare do
19
- auth = Spree::Auth::Engine
20
-
21
- auth.prepare_backend if SolidusSupport.backend_available?
22
- auth.prepare_frontend if SolidusSupport.frontend_available?
23
+ Spree::Auth::Engine.prepare_backend if SolidusSupport.backend_available?
24
+ Spree::Auth::Engine.prepare_frontend if SolidusSupport.frontend_available?
23
25
 
24
- ApplicationController.send :include, Spree::AuthenticationHelpers
26
+ ApplicationController.include Spree::AuthenticationHelpers
25
27
  end
26
28
 
27
- def self.prepare_backend
28
- Rails.application.config.assets.precompile += %w[
29
- lib/assets/javascripts/spree/backend/solidus_auth.js
30
- lib/assets/javascripts/spree/backend/solidus_auth.css
31
- ]
29
+ def self.redirect_back_on_unauthorized?
30
+ return false unless Spree::Config.respond_to?(:redirect_back_on_unauthorized)
31
+
32
+ if Spree::Config.redirect_back_on_unauthorized
33
+ true
34
+ else
35
+ Spree::Deprecation.warn <<-WARN.strip_heredoc, caller
36
+ Having Spree::Config.redirect_back_on_unauthorized set
37
+ to `false` is deprecated and will not be supported in Solidus 3.0.
38
+ Please change this configuration to `true` and be sure that your
39
+ application does not break trying to redirect back when there is
40
+ an unauthorized access.
41
+ WARN
32
42
 
33
- Dir.glob(File.join(File.dirname(__FILE__), "../../controllers/backend/*/*/*_decorator*.rb")) do |c|
34
- Rails.configuration.cache_classes ? require(c) : load(c)
43
+ false
35
44
  end
45
+ end
36
46
 
47
+ def self.prepare_backend
37
48
  Spree::Admin::BaseController.unauthorized_redirect = -> do
38
49
  if try_spree_current_user
39
- flash[:error] = Spree.t(:authorization_failure)
40
- redirect_to spree.admin_unauthorized_path
50
+ flash[:error] = I18n.t('spree.authorization_failure')
51
+
52
+ if Spree::Auth::Engine.redirect_back_on_unauthorized?
53
+ redirect_back(fallback_location: spree.admin_unauthorized_path)
54
+ else
55
+ redirect_to spree.admin_unauthorized_path
56
+ end
41
57
  else
42
58
  store_location
43
- redirect_to spree.admin_login_path
59
+
60
+ if Spree::Auth::Engine.redirect_back_on_unauthorized?
61
+ redirect_back(fallback_location: spree.admin_login_path)
62
+ else
63
+ redirect_to spree.admin_login_path
64
+ end
44
65
  end
45
66
  end
46
67
  end
47
68
 
48
- def self.prepare_frontend
49
- Rails.application.config.assets.precompile += %w[
50
- lib/assets/javascripts/spree/frontend/solidus_auth.js
51
- lib/assets/javascripts/spree/frontend/solidus_auth.css
52
- ]
53
-
54
- Dir.glob(File.join(File.dirname(__FILE__), "../../controllers/frontend/*/*_decorator*.rb")) do |c|
55
- Rails.configuration.cache_classes ? require(c) : load(c)
56
- end
57
69
 
70
+ def self.prepare_frontend
58
71
  Spree::BaseController.unauthorized_redirect = -> do
59
72
  if try_spree_current_user
60
- flash[:error] = Spree.t(:authorization_failure)
61
- redirect_to spree.unauthorized_path
73
+ flash[:error] = I18n.t('spree.authorization_failure')
74
+
75
+ if Spree::Auth::Engine.redirect_back_on_unauthorized?
76
+ redirect_back(fallback_location: spree.unauthorized_path)
77
+ else
78
+ redirect_to spree.unauthorized_path
79
+ end
62
80
  else
63
81
  store_location
64
- redirect_to spree.login_path
82
+
83
+ if Spree::Auth::Engine.redirect_back_on_unauthorized?
84
+ redirect_back(fallback_location: spree.login_path)
85
+ else
86
+ redirect_to spree.login_path
87
+ end
65
88
  end
66
89
  end
67
90
  end
68
-
69
- if SolidusSupport.backend_available?
70
- paths["app/controllers"] << "lib/controllers/backend"
71
- paths["app/views"] << "lib/views/backend"
72
- end
73
-
74
- if SolidusSupport.frontend_available?
75
- paths["app/controllers"] << "lib/controllers/frontend"
76
- paths["app/views"] << "lib/views/frontend"
77
- end
78
91
  end
79
92
  end
80
93
  end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Spree
4
+ module Auth
5
+ VERSION = '2.5.0'
6
+ end
7
+ end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Spree
2
4
  module AuthenticationHelpers
3
5
  def self.included(receiver)
@@ -17,17 +19,9 @@ module Spree
17
19
  end
18
20
 
19
21
  if SolidusSupport.frontend_available?
20
- def spree_login_path
21
- spree.login_path
22
- end
23
-
24
- def spree_signup_path
25
- spree.signup_path
26
- end
27
-
28
- def spree_logout_path
29
- spree.logout_path
30
- end
22
+ delegate :login_path, :signup_path, :logout_path,
23
+ to: :spree,
24
+ prefix: :spree
31
25
  end
32
26
  end
33
27
  end
@@ -1,7 +1,9 @@
1
+ # frozen_string_literal: true
2
+
1
3
  namespace :spree_auth do
2
4
  namespace :admin do
3
5
  desc "Create admin username and password"
4
- task :create => :environment do
6
+ task create: :environment do
5
7
  require File.join(File.dirname(__FILE__), '..', '..', 'db', 'default', 'users.rb')
6
8
  puts "Done!"
7
9
  end
@@ -1,15 +1,22 @@
1
1
  <% if spree_current_user %>
2
2
  <ul id="login-nav" class="admin-login-nav">
3
3
  <li data-hook="user-account-link">
4
- <%= link_to spree.edit_admin_user_path(spree_current_user) do %>
5
- <i class='fa fa-user'></i>
6
- <%= spree_current_user.email %>
4
+ <% if can?(:admin, try_spree_current_user) %>
5
+ <%= link_to spree.edit_admin_user_path(try_spree_current_user) do %>
6
+ <i class='fa fa-user'></i>
7
+ <%= try_spree_current_user.email %>
8
+ <% end %>
9
+ <% else %>
10
+ <a>
11
+ <i class='fa fa-user'></i>
12
+ <%= try_spree_current_user.email %>
13
+ </a>
7
14
  <% end %>
8
15
  </li>
9
16
  <li data-hook="user-logout-link">
10
- <%= link_to spree.admin_logout_path do %>
17
+ <%= link_to spree.admin_logout_path, method: Devise.sign_out_via do %>
11
18
  <i class='fa fa-sign-out'></i>
12
- <%= Spree.t(:logout) %>
19
+ <%= I18n.t('spree.logout') %>
13
20
  <% end %>
14
21
  </li>
15
22
 
@@ -17,7 +24,7 @@
17
24
  <li data-hook="store-frontend-link">
18
25
  <%= link_to spree.root_path, target: '_blank' do %>
19
26
  <i class='fa fa-external-link'></i>
20
- <%= Spree.t(:back_to_store) %>
27
+ <%= I18n.t('spree.back_to_store') %>
21
28
  <% end %>
22
29
  </li>
23
30
  <% end %>
@@ -1,15 +1,15 @@
1
1
  <%= render partial: 'spree/shared/error_messages', locals: { target: @spree_user } %>
2
- <h2><%= Spree.t(:change_my_password) %></h2>
2
+ <h2><%= I18n.t('spree.change_my_password') %></h2>
3
3
 
4
4
  <%= form_for @spree_user, as: :spree_user, url: spree.update_password_path, method: :put do |f| %>
5
5
  <p>
6
- <%= f.label :password, Spree.t(:password) %><br />
6
+ <%= f.label :password, I18n.t('spree.password') %><br />
7
7
  <%= f.password_field :password %><br />
8
8
  </p>
9
9
  <p>
10
- <%= f.label :password_confirmation, Spree.t(:confirm_password) %><br />
10
+ <%= f.label :password_confirmation, I18n.t('spree.confirm_password') %><br />
11
11
  <%= f.password_field :password_confirmation %><br />
12
12
  </p>
13
13
  <%= f.hidden_field :reset_password_token %>
14
- <%= f.submit Spree.t(:update), class: 'button primary' %>
14
+ <%= f.submit I18n.t('spree.update'), class: 'button primary' %>
15
15
  <% end %>
@@ -1,17 +1,15 @@
1
- <%= render partial: 'spree/shared/error_messages', locals: { target: @spree_user } %>
2
-
3
1
  <div id="forgot-password">
4
- <h6><%= Spree.t(:forgot_password) %></h6>
2
+ <h6><%= I18n.t('spree.forgot_password') %></h6>
5
3
 
6
- <p><%= Spree.t(:instructions_to_reset_password) %></p>
4
+ <p><%= I18n.t('spree.instructions_to_reset_password') %></p>
7
5
 
8
- <%= form_for Spree::User.new, as: :spree_user, url: spree.reset_password_path do |f| %>
6
+ <%= form_for Spree::User.new, as: :spree_user, url: spree.admin_reset_password_path do |f| %>
9
7
  <p>
10
- <%= f.label :email, Spree.t(:email) %><br />
11
- <%= f.email_field :email %>
8
+ <%= f.label :email, I18n.t('spree.email') %><br />
9
+ <%= f.email_field :email, required: true %>
12
10
  </p>
13
11
  <p>
14
- <%= f.submit Spree.t(:reset_password), class: 'button primary' %>
12
+ <%= f.submit I18n.t('spree.reset_password'), class: 'button primary' %>
15
13
  </p>
16
14
  <% end %>
17
15
  </div>
@@ -1,4 +1,4 @@
1
1
  <div style="height:50px; padding-top:20px;">
2
- <strong><%= Spree.t(:authorization_failure) %></strong>
2
+ <strong><%= I18n.t('spree.authorization_failure') %></strong>
3
3
  </div>
4
4
  <!-- Add your own custom access denied message here if you like -->
@@ -4,28 +4,28 @@
4
4
 
5
5
  <% @body_id = 'login' %>
6
6
  <div id="existing-customer">
7
- <h6><%= Spree.t(:admin_login) %></h6>
7
+ <h6><%= I18n.t('spree.admin_login') %></h6>
8
8
  <div data-hook="login">
9
9
  <%= form_for Spree::User.new, as: :spree_user, url: spree.admin_create_new_session_path do |f| %>
10
10
  <div id="password-credentials">
11
11
  <p>
12
- <%= f.label :email, Spree.t(:email) %><br />
13
- <%= f.email_field :email, class: 'title', tabindex: 1 %>
12
+ <%= f.label :email, I18n.t('spree.email') %><br />
13
+ <%= f.email_field :email, class: 'title', tabindex: 1, autocomplete: 'username' %>
14
14
  </p>
15
15
  <p>
16
- <%= f.label :password, Spree.t(:password) %><br />
17
- <%= f.password_field :password, class: 'title', tabindex: 2 %>
16
+ <%= f.label :password, I18n.t('spree.password') %><br />
17
+ <%= f.password_field :password, class: 'title', tabindex: 2, autocomplete: 'current-password' %>
18
18
  </p>
19
19
  </div>
20
20
  <p>
21
21
  <%= f.check_box :remember_me, tabindex: 3 %>
22
- <%= f.label :remember_me, Spree.t(:remember_me) %>
22
+ <%= f.label :remember_me, I18n.t('spree.remember_me') %>
23
23
  </p>
24
24
 
25
- <p><%= f.submit Spree.t(:login), class: 'button primary', tabindex: 4 %></p>
25
+ <p><%= f.submit I18n.t('spree.login'), class: 'btn btn-primary', tabindex: 4 %></p>
26
26
  <% end %>
27
- <%= Spree.t(:or) %>
28
- <%= link_to Spree.t(:forgot_password), spree.recover_password_path %>
27
+ <%= I18n.t('spree.or') %>
28
+ <%= link_to I18n.t('spree.forgot_password'), spree.admin_recover_password_path %>
29
29
  </div>
30
30
  </div>
31
31
  <div data-hook="login_extras"></div>