solidus_social 1.0.0 → 1.4.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 (82) hide show
  1. checksums.yaml +5 -5
  2. data/.circleci/config.yml +35 -0
  3. data/.gem_release.yml +5 -0
  4. data/.gitignore +6 -8
  5. data/.rspec +3 -3
  6. data/.rubocop.yml +3 -7
  7. data/.rubocop_todo.yml +42 -0
  8. data/CHANGELOG.md +34 -4
  9. data/Gemfile +23 -0
  10. data/{LICENSE.md → LICENSE} +2 -2
  11. data/README.md +133 -78
  12. data/Rakefile +4 -13
  13. data/app/controllers/spree/admin/authentication_methods_controller.rb +2 -12
  14. data/app/controllers/spree/omniauth_callbacks_controller.rb +46 -42
  15. data/app/controllers/spree/user_authentications_controller.rb +3 -1
  16. data/app/core/spree/permission_sets/authentication_method_display.rb +11 -0
  17. data/app/core/spree/permission_sets/authentication_method_management.rb +11 -0
  18. data/app/decorators/controllers/solidus_social/spree/user_registrations_controller_decorator.rb +27 -0
  19. data/app/decorators/models/solidus_social/spree/user_decorator.rb +28 -0
  20. data/app/helpers/spree/omniauth_callbacks_helper.rb +2 -0
  21. data/app/models/spree/authentication_method.rb +8 -2
  22. data/app/models/spree/social_configuration.rb +3 -0
  23. data/app/models/spree/user_authentication.rb +3 -1
  24. data/app/overrides/add_authentications_to_account_summary.rb +2 -0
  25. data/app/overrides/admin_configuration_decorator.rb +9 -2
  26. data/app/overrides/user_registrations_decorator.rb +2 -0
  27. data/app/views/spree/admin/authentication_methods/_form.html.erb +6 -22
  28. data/app/views/spree/admin/authentication_methods/edit.html.erb +5 -3
  29. data/app/views/spree/admin/authentication_methods/index.html.erb +22 -18
  30. data/app/views/spree/admin/authentication_methods/new.html.erb +5 -3
  31. data/app/views/spree/shared/_social.html.erb +5 -5
  32. data/app/views/spree/shared/_user_form.html.erb +3 -3
  33. data/app/views/spree/users/_new-customer.html.erb +2 -2
  34. data/app/views/spree/users/_social.html.erb +24 -22
  35. data/bin/console +17 -0
  36. data/bin/rails +15 -4
  37. data/bin/rake +7 -0
  38. data/bin/sandbox +72 -0
  39. data/bin/setup +8 -0
  40. data/config/locales/en.yml +1 -0
  41. data/config/locales/es-MX.yml +8 -4
  42. data/config/locales/es.yml +30 -0
  43. data/config/locales/it.yml +26 -0
  44. data/config/routes.rb +7 -5
  45. data/db/migrate/20120120163432_create_user_authentications.rb +3 -1
  46. data/db/migrate/20120123163222_create_authentication_methods.rb +3 -1
  47. data/lib/generators/solidus_social/install/install_generator.rb +13 -5
  48. data/lib/generators/solidus_social/install/templates/config/initializers/solidus_social.rb +50 -0
  49. data/lib/solidus_social.rb +24 -8
  50. data/lib/solidus_social/engine.rb +29 -55
  51. data/lib/solidus_social/facebook_omniauth_strategy_ext.rb +25 -0
  52. data/lib/solidus_social/factories.rb +4 -0
  53. data/lib/solidus_social/version.rb +3 -16
  54. data/solidus_social.gemspec +43 -46
  55. data/spec/controllers/spree/omniauth_callbacks_controller_spec.rb +42 -9
  56. data/spec/features/spree/admin/authentication_methods_configuration_spec.rb +21 -27
  57. data/spec/features/spree/sign_in_spec.rb +27 -19
  58. data/spec/lib/solidus_social/engine_spec.rb +9 -0
  59. data/spec/lib/solidus_social_speec.rb +25 -0
  60. data/spec/lib/spree/social_config_spec.rb +11 -0
  61. data/spec/models/spree/authentication_method_spec.rb +19 -0
  62. data/spec/models/spree/social_configuration_spec.rb +6 -0
  63. data/spec/models/spree/user_decorator_spec.rb +25 -2
  64. data/spec/spec_helper.rb +17 -29
  65. data/spec/support/omniauth.rb +4 -0
  66. metadata +71 -198
  67. data/.hound.yml +0 -26
  68. data/.travis.yml +0 -19
  69. data/Guardfile +0 -10
  70. data/app/assets/javascripts/spree/backend/solidus_social.js +0 -1
  71. data/app/assets/javascripts/spree/frontend/solidus_social.js +0 -1
  72. data/app/assets/stylesheets/spree/backend/solidus_social.css +0 -3
  73. data/app/controllers/spree/user_registrations_controller_decorator.rb +0 -15
  74. data/app/models/spree/user_decorator.rb +0 -16
  75. data/app/views/spree/admin/shared/_configurations_menu.html.erb +0 -4
  76. data/config/initializers/devise.rb +0 -13
  77. data/spec/lib/spree_social/engine_spec.rb +0 -16
  78. data/spec/support/capybara.rb +0 -18
  79. data/spec/support/database_cleaner.rb +0 -24
  80. data/spec/support/devise.rb +0 -3
  81. data/spec/support/factory_girl.rb +0 -7
  82. data/spec/support/spree.rb +0 -8
data/Rakefile CHANGED
@@ -1,15 +1,6 @@
1
- require 'bundler'
2
- Bundler::GemHelper.install_tasks
1
+ # frozen_string_literal: true
3
2
 
4
- require 'rspec/core/rake_task'
5
- require 'spree/testing_support/common_rake'
3
+ require 'solidus_dev_support/rake_tasks'
4
+ SolidusDevSupport::RakeTasks.install
6
5
 
7
- RSpec::Core::RakeTask.new
8
-
9
- task default: :spec
10
-
11
- desc 'Generates a dummy app for testing'
12
- task :test_app do
13
- ENV['LIB_NAME'] = 'solidus_social'
14
- Rake::Task['common:test_app'].invoke('Spree::User')
15
- end
6
+ task default: 'extension:specs'
@@ -1,18 +1,8 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Spree
2
4
  module Admin
3
5
  class AuthenticationMethodsController < ResourceController
4
- create.after :update_oauth_method
5
- update.after :update_oauth_method
6
-
7
- private
8
-
9
- def update_oauth_method
10
- auth_method = params[:authentication_method]
11
- return unless auth_method[:active] == 'true' && auth_method[:environment] == ::Rails.env
12
- Devise.setup do |config|
13
- config.omniauth auth_method[:provider], auth_method[:api_key], auth_method[:api_secret]
14
- end
15
- end
16
6
  end
17
7
  end
18
8
  end
@@ -1,55 +1,59 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class Spree::OmniauthCallbacksController < Devise::OmniauthCallbacksController
2
4
  include Spree::Core::ControllerHelpers::Common
3
5
  include Spree::Core::ControllerHelpers::Order
4
6
  include Spree::Core::ControllerHelpers::Auth
5
7
  include Spree::Core::ControllerHelpers::Store
6
8
 
7
- def self.provides_callback_for(*providers)
8
- providers.each do |provider|
9
- class_eval <<-FUNCTION_DEFS, __FILE__, __LINE__ + 1
10
- def #{provider}
11
- if request.env['omniauth.error'].present?
12
- flash[:error] = I18n.t('devise.omniauth_callbacks.failure', kind: auth_hash['provider'], reason: Spree.t(:user_was_not_valid))
13
- redirect_back_or_default(root_url)
14
- return
15
- end
9
+ class << self
10
+ def provides_callback_for(*providers)
11
+ providers.each do |provider|
12
+ define_method(provider) { omniauth_callback }
13
+ end
14
+ end
15
+ end
16
+
17
+ Spree::SocialConfig.providers.keys.each do |provider|
18
+ provides_callback_for provider
19
+ end
16
20
 
17
- authentication = Spree::UserAuthentication.find_by_provider_and_uid(auth_hash['provider'], auth_hash['uid'])
21
+ def omniauth_callback
22
+ if request.env['omniauth.error'].present?
23
+ flash[:error] = I18n.t('devise.omniauth_callbacks.failure', kind: auth_hash['provider'], reason: I18n.t('spree.user_was_not_valid'))
24
+ redirect_back_or_default(root_url)
25
+ return
26
+ end
18
27
 
19
- if authentication.present? and authentication.try(:user).present?
20
- flash[:notice] = I18n.t('devise.omniauth_callbacks.success', kind: auth_hash['provider'])
21
- sign_in_and_redirect :spree_user, authentication.user
22
- elsif spree_current_user
23
- spree_current_user.apply_omniauth(auth_hash)
24
- spree_current_user.save!
25
- flash[:notice] = I18n.t('devise.sessions.signed_in')
26
- redirect_back_or_default(account_url)
27
- else
28
- user = Spree::User.find_by_email(auth_hash['info']['email']) || Spree::User.new
29
- user.apply_omniauth(auth_hash)
30
- if user.save
31
- flash[:notice] = I18n.t('devise.omniauth_callbacks.success', kind: auth_hash['provider'])
32
- sign_in_and_redirect :spree_user, user
33
- else
34
- session[:omniauth] = auth_hash.except('extra')
35
- flash[:notice] = Spree.t(:one_more_step, kind: auth_hash['provider'].capitalize)
36
- redirect_to new_spree_user_registration_url
37
- return
38
- end
39
- end
28
+ authentication = Spree::UserAuthentication.find_by(provider: auth_hash['provider'], uid: auth_hash['uid'])
40
29
 
41
- if current_order
42
- user = spree_current_user || authentication.user
43
- current_order.associate_user!(user)
44
- session[:guest_token] = nil
45
- end
46
- end
47
- FUNCTION_DEFS
30
+ if authentication.present? && authentication.try(:user).present?
31
+ flash[:notice] = I18n.t('devise.omniauth_callbacks.success', kind: auth_hash['provider'])
32
+ sign_in_and_redirect :spree_user, authentication.user
33
+ elsif spree_current_user
34
+ spree_current_user.apply_omniauth(auth_hash)
35
+ spree_current_user.save!
36
+ flash[:notice] = I18n.t('devise.sessions.signed_in')
37
+ redirect_back_or_default(account_url)
38
+ else
39
+ user = Spree.user_class.find_by(email: auth_hash['info']['email']) || Spree.user_class.new
40
+ user.apply_omniauth(auth_hash)
41
+ if user.save
42
+ flash[:notice] = I18n.t('devise.omniauth_callbacks.success', kind: auth_hash['provider'])
43
+ sign_in_and_redirect :spree_user, user
44
+ else
45
+ session[:omniauth] = auth_hash.except('extra')
46
+ flash[:notice] = I18n.t('spree.one_more_step', kind: auth_hash['provider'].capitalize)
47
+ redirect_to new_spree_user_registration_url
48
+ return
49
+ end
48
50
  end
49
- end
50
51
 
51
- SolidusSocial::OAUTH_PROVIDERS.each do |provider|
52
- provides_callback_for provider[1].to_sym
52
+ if current_order
53
+ user = spree_current_user || authentication.user
54
+ current_order.associate_user!(user)
55
+ session[:guest_token] = nil
56
+ end
53
57
  end
54
58
 
55
59
  def failure
@@ -58,7 +62,7 @@ class Spree::OmniauthCallbacksController < Devise::OmniauthCallbacksController
58
62
  end
59
63
 
60
64
  def passthru
61
- render file: "#{Rails.root}/public/404", formats: [:html], status: 404, layout: false
65
+ render file: "#{Rails.root}/public/404", formats: [:html], status: :not_found, layout: false
62
66
  end
63
67
 
64
68
  def auth_hash
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class Spree::UserAuthenticationsController < Spree::StoreController
2
4
  def index
3
5
  @authentications = spree_current_user.user_authentications if spree_current_user
@@ -6,7 +8,7 @@ class Spree::UserAuthenticationsController < Spree::StoreController
6
8
  def destroy
7
9
  @authentication = spree_current_user.user_authentications.find(params[:id])
8
10
  @authentication.destroy
9
- flash[:notice] = Spree.t(:destroy, scope: :authentications)
11
+ flash[:notice] = I18n.t('spree.destroy', scope: :authentications)
10
12
  redirect_to spree.account_path
11
13
  end
12
14
  end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Spree
4
+ module PermissionSets
5
+ class AuthenticationMethodDisplay < PermissionSets::Base
6
+ def activate!
7
+ can [:display, :admin], Spree::AuthenticationMethod
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Spree
4
+ module PermissionSets
5
+ class AuthenticationMethodManagement < PermissionSets::Base
6
+ def activate!
7
+ can :manage, Spree::AuthenticationMethod
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,27 @@
1
+ # frozen_string_literal: true
2
+
3
+ module SolidusSocial
4
+ module Spree
5
+ module UserRegistrationsControllerDecorator
6
+ def self.prepended(base)
7
+ base.class_eval do
8
+ after_action :clear_omniauth, only: :create
9
+ end
10
+ end
11
+
12
+ private
13
+
14
+ def build_resource(*args)
15
+ super
16
+ @spree_user.apply_omniauth(session[:omniauth]) if session[:omniauth]
17
+ @spree_user
18
+ end
19
+
20
+ def clear_omniauth
21
+ session[:omniauth] = nil unless @spree_user.new_record?
22
+ end
23
+
24
+ ::Spree::UserRegistrationsController.prepend self
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,28 @@
1
+ # frozen_string_literal: true
2
+
3
+ module SolidusSocial
4
+ module Spree
5
+ module UserDecorator
6
+ def self.prepended(base)
7
+ base.class_eval do
8
+ has_many :user_authentications, dependent: :destroy
9
+
10
+ devise :omniauthable
11
+ end
12
+ end
13
+
14
+ def apply_omniauth(omniauth)
15
+ if omniauth.fetch('info', {})['email'].present?
16
+ self.email = omniauth['info']['email'] if email.blank?
17
+ end
18
+ user_authentications.build(provider: omniauth['provider'], uid: omniauth['uid'])
19
+ end
20
+
21
+ def password_required?
22
+ (user_authentications.empty? || password.present?) && super
23
+ end
24
+
25
+ ::Spree.user_class.prepend self
26
+ end
27
+ end
28
+ end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Spree
2
4
  module OmniauthCallbacksHelper
3
5
  include Spree::BaseHelper
@@ -1,5 +1,11 @@
1
- class Spree::AuthenticationMethod < ActiveRecord::Base
2
- validates :provider, :api_key, :api_secret, presence: true
1
+ # frozen_string_literal: true
2
+
3
+ class Spree::AuthenticationMethod < ApplicationRecord
4
+ def self.provider_options
5
+ SolidusSocial.configured_providers.map { |provider_name| [provider_name.split("_").first.camelize, provider_name] }
6
+ end
7
+
8
+ validates :provider, presence: true
3
9
 
4
10
  def self.active_authentication_methods?
5
11
  where(environment: ::Rails.env, active: true).exists?
@@ -1,5 +1,8 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Spree
2
4
  class SocialConfiguration < Preferences::Configuration
5
+ attr_accessor :providers
3
6
  preference :path_prefix, :string, default: 'users'
4
7
  end
5
8
  end
@@ -1,3 +1,5 @@
1
- class Spree::UserAuthentication < ActiveRecord::Base
1
+ # frozen_string_literal: true
2
+
3
+ class Spree::UserAuthentication < ApplicationRecord
2
4
  belongs_to :user
3
5
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  Deface::Override.new(virtual_path: 'spree/users/show',
2
4
  name: 'add_socials_to_account_summary',
3
5
  insert_after: '[data-hook="account_my_orders"]',
@@ -1,5 +1,12 @@
1
+ # frozen_string_literal: true
2
+
1
3
  Deface::Override.new(virtual_path: 'spree/admin/shared/_configuration_menu',
2
4
  name: 'add_social_providers_link_configuration_menu',
3
5
  insert_bottom: '[data-hook="admin_configurations_sidebar_menu"]',
4
- text: '<%= configurations_sidebar_menu_item Spree.t(:social_authentication_methods), spree.admin_authentication_methods_path %>',
5
- disabled: false)
6
+ disabled: false) do
7
+ <<-HTML
8
+ <% if can? :admin, Spree::AuthenticationMethod %>
9
+ <%= configurations_sidebar_menu_item I18n.t("spree.social_authentication_methods"), spree.admin_authentication_methods_path %>
10
+ <% end %>
11
+ HTML
12
+ end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  Deface::Override.new(virtual_path: 'spree/user_registrations/new',
2
4
  name: 'add_socials_to_login_extras',
3
5
  insert_after: '[data-hook="login_extras"]',
@@ -2,7 +2,7 @@
2
2
  <div class="alpha five columns">
3
3
  <div data-hook="environment" class="field">
4
4
  <%= f.field_container :environment do %>
5
- <%= label_tag nil, Spree.t(:environment) %>
5
+ <%= label_tag nil, Spree::AuthenticationMethod.human_attribute_name(:environment) %>
6
6
  <%= collection_select(:authentication_method, :environment, Rails.configuration.database_configuration.keys, :to_s, :titleize, {}, { class: 'select2 fullwidth' }) %>
7
7
  <% end %>
8
8
  </div>
@@ -10,35 +10,19 @@
10
10
  <div class="alpha five columns">
11
11
  <div data-hook="environment" class="field">
12
12
  <%= f.field_container :provider do %>
13
- <%= f.label :provider, Spree.t(:social_provider) %>
14
- <%= f.select :provider, SolidusSocial::OAUTH_PROVIDERS, {}, { include_blank: false, class: 'select2 fullwidth' } %>
15
- <% end %>
16
- </div>
17
- </div>
18
- <div class="alpha five columns">
19
- <div data-hook="environment" class="field">
20
- <%= f.field_container :api_key do %>
21
- <%= f.label :api_key, Spree.t(:social_api_key) %> <span class="required">*</span><br />
22
- <%= f.text_field :api_key, class: 'fullwidth' %>
23
- <% end %>
24
- </div>
25
- </div>
26
- <div class="alpha five columns">
27
- <div data-hook="environment" class="field">
28
- <%= f.field_container :api_secret do %>
29
- <%= f.label :api_secret, Spree.t(:social_api_secret) %> <span class="required">*</span><br />
30
- <%= f.text_field :api_secret, class: 'fullwidth' %>
13
+ <%= f.label :provider, I18n.t('spree.social_provider') %>
14
+ <%= f.select :provider, Spree::AuthenticationMethod.provider_options, {}, { include_blank: false, class: 'select2 fullwidth' } %>
31
15
  <% end %>
32
16
  </div>
33
17
  </div>
34
18
  <div class="alpha five columns">
35
19
  <div data-hook="environment" class="field">
36
20
  <%= f.field_container :active do %>
37
- <span style="padding:0 10px 2px;"><%= f.label :active, Spree.t(:active) %></span>
21
+ <span style="padding:0 10px 2px;"><%= f.label :active, I18n.t('spree.active') %></span>
38
22
  <%= f.radio_button :active, :true %>
39
- <span style="padding:0 2px;"><%= Spree.t(:say_yes) %></span>
23
+ <span style="padding:0 2px;"><%= I18n.t('spree.say_yes') %></span>
40
24
  <%= f.radio_button :active, :false %>
41
- <span style="padding:0 2px"><%= Spree.t(:say_no) %></span>
25
+ <span style="padding:0 2px"><%= I18n.t('spree.say_no') %></span>
42
26
  <% end %>
43
27
  </div>
44
28
  </div>
@@ -1,11 +1,11 @@
1
1
  <%= render 'spree/admin/shared/configuration_menu' %>
2
2
 
3
3
  <% content_for :page_title do %>
4
- <%= Spree.t(:edit_social_method) %>
4
+ <%= I18n.t('spree.edit_social_method') %>
5
5
  <% end %>
6
6
 
7
7
  <% content_for :page_actions do %>
8
- <li><%= link_to_with_icon 'icon-arrow-left', Spree.t(:back_to_authentication_methods_list), admin_authentication_methods_path, class: 'button' %></li>
8
+ <li><%= link_to_with_icon 'icon-arrow-left', I18n.t('spree.back_to_authentication_methods_list'), admin_authentication_methods_path, class: 'button' %></li>
9
9
  <% end %>
10
10
 
11
11
  <%= render 'spree/shared/error_messages', target: @authentication_method %>
@@ -13,6 +13,8 @@
13
13
  <%= form_for [:admin, @authentication_method] do |f| %>
14
14
  <fieldset class="no-border-top">
15
15
  <%= render 'form', f: f %>
16
- <%= render 'spree/admin/shared/edit_resource_links' %>
16
+ <% if can? :manage, Spree::AuthenticationMethod %>
17
+ <%= render 'spree/admin/shared/edit_resource_links' %>
18
+ <% end %>
17
19
  </fieldset>
18
20
  <% end %>
@@ -1,15 +1,17 @@
1
1
  <%= render 'spree/admin/shared/configuration_menu' %>
2
2
 
3
3
  <% content_for :page_title do %>
4
- <%= Spree.t(:social_authentication_methods) %>
4
+ <%= I18n.t('spree.social_authentication_methods') %>
5
5
  <% end %>
6
6
 
7
7
  <% content_for :page_actions do %>
8
- <ul class="actions inline-menu">
9
- <li>
10
- <%= button_link_to Spree.t(:new_social_method), new_object_url, icon: 'icon-plus', id: 'admin_new_slide_link' %>
11
- </li>
12
- </ul>
8
+ <% if can? :manage, Spree::AuthenticationMethod %>
9
+ <ul class="actions inline-menu">
10
+ <li>
11
+ <%= link_to I18n.t('spree.new_social_method'), new_object_url, id: 'admin_new_slide_link' %>
12
+ </li>
13
+ </ul>
14
+ <% end %>
13
15
  <% end %>
14
16
 
15
17
  <% if @authentication_methods.any? %>
@@ -23,24 +25,26 @@
23
25
  <col style="width: 20%" />
24
26
  </colgroup>
25
27
  <thead data-hook="admin_social_methods_index_headers">
26
- <th><%= Spree.t(:social_provider) %></th>
27
- <th><%= Spree.t(:social_api_key) %></th>
28
- <th><%= Spree.t(:social_api_secret) %></th>
29
- <th><%= Spree.t(:environment) %></th>
30
- <th><%= Spree.t(:active) %></th>
28
+ <th><%= I18n.t('spree.social_provider') %></th>
29
+ <th><%= I18n.t('spree.social_api_key') %></th>
30
+ <th><%= I18n.t('spree.social_api_secret') %></th>
31
+ <th><%= I18n.t('spree.environment') %></th>
32
+ <th><%= I18n.t('spree.active') %></th>
31
33
  <th data-hook="admin_social_methods_index_header_actions" class="actions"></th>
32
34
  </thead>
33
35
  <tbody>
34
36
  <% @authentication_methods.each do |method|%>
35
37
  <tr id="<%= dom_id method %>" data-hook="admin_trackers_index_rows">
36
38
  <td class="align-center"><%= method.provider %></td>
37
- <td class="align-center"><%= truncate method.api_key, length: 20 %></td>
38
- <td class="align-center"><%= truncate method.api_secret, length: 20 %></td>
39
+ <td class="align-center"><%= truncate method.api_key, length: 10 %></td>
40
+ <td class="align-center"><%= truncate method.api_secret, length: 10 %></td>
39
41
  <td class="align-center"><%= method.environment.to_s.titleize %></td>
40
- <td class="align-center"><%= method.active ? Spree.t(:yes) : Spree.t(:no) %></td>
42
+ <td class="align-center"><%= method.active ? I18n.t('spree.yes') : I18n.t('spree.no') %></td>
41
43
  <td class="actions">
42
- <%= link_to_edit method, no_text: true %>
43
- <%= link_to_delete method, no_text: true %>
44
+ <% if can? :manage, Spree::AuthenticationMethod %>
45
+ <%= link_to_edit method, no_text: true %>
46
+ <%= link_to_delete method, no_text: true %>
47
+ <% end %>
44
48
  </td>
45
49
  </tr>
46
50
  <% end %>
@@ -48,7 +52,7 @@
48
52
  </table>
49
53
  <% else %>
50
54
  <div class="alpha twelve columns no-objects-found">
51
- <%= Spree.t(:no_authentication_methods_found) %>,
52
- <%= Spree.t(:add_one) %>!
55
+ <%= I18n.t('spree.no_authentication_methods_found') %>,
56
+ <%= I18n.t('spree.add_one') %>!
53
57
  </div>
54
58
  <% end %>