spree_auth_devise 1.3.1 → 3.0.5
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of spree_auth_devise might be problematic. Click here for more details.
- checksums.yaml +7 -0
- data/.gitignore +10 -0
- data/.rspec +3 -0
- data/.travis.yml +11 -0
- data/Gemfile +5 -0
- data/{LICENSE → LICENSE.md} +1 -1
- data/README.md +86 -10
- data/Rakefile +15 -0
- data/Versionfile +5 -0
- data/app/controllers/metal_decorator.rb +6 -0
- data/app/mailers/spree/user_mailer.rb +12 -5
- data/app/models/spree/auth_configuration.rb +1 -0
- data/app/models/spree/user.rb +17 -50
- data/app/overrides/spree/admin/shared/_header/auth_admin_login_navigation_bar.html.erb.deface +4 -0
- data/bin/rails +7 -0
- data/circle.yml +11 -0
- data/config.ru +4 -0
- data/config/initializers/devise.rb +3 -8
- data/config/initializers/warden.rb +14 -0
- data/config/locales/de.yml +40 -37
- data/config/locales/en.yml +48 -39
- data/config/locales/es.yml +49 -0
- data/config/locales/fr.yml +49 -0
- data/config/locales/it.yml +76 -0
- data/config/locales/nl.yml +41 -46
- data/config/locales/pt-BR.yml +51 -0
- data/config/locales/tr.yml +49 -0
- data/config/routes.rb +32 -15
- data/db/default/users.rb +13 -6
- data/db/migrate/20140904000425_add_deleted_at_to_users.rb +6 -0
- data/db/migrate/20141002154641_add_confirmable_to_users.rb +7 -0
- data/lib/assets/javascripts/spree/backend/spree_auth.js.erb +1 -0
- data/lib/assets/javascripts/spree/frontend/spree_auth.js.erb +1 -0
- data/lib/assets/stylesheets/spree/backend/spree_auth.css.erb +3 -0
- data/lib/assets/stylesheets/spree/frontend/spree_auth.css.erb +3 -0
- data/lib/controllers/backend/spree/admin/admin_controller_decorator.rb +26 -0
- data/lib/controllers/backend/spree/admin/admin_orders_controller_decorator.rb +20 -0
- data/{app/controllers → lib/controllers/backend}/spree/admin/admin_resource_controller_decorator.rb +0 -0
- data/{app/controllers/spree/admin/admin_orders_controller_decorator.rb → lib/controllers/backend/spree/admin/orders/customer_details_controller_decorator.rb} +3 -2
- data/lib/controllers/backend/spree/admin/user_passwords_controller.rb +42 -0
- data/lib/controllers/backend/spree/admin/user_sessions_controller.rb +53 -0
- data/{app/controllers → lib/controllers/frontend}/spree/checkout_controller_decorator.rb +8 -15
- data/lib/controllers/frontend/spree/user_confirmations_controller.rb +14 -0
- data/{app/controllers → lib/controllers/frontend}/spree/user_passwords_controller.rb +10 -9
- data/{app/controllers → lib/controllers/frontend}/spree/user_registrations_controller.rb +18 -15
- data/lib/controllers/frontend/spree/user_sessions_controller.rb +46 -0
- data/{app/controllers → lib/controllers/frontend}/spree/users_controller.rb +13 -9
- data/lib/generators/spree/auth/install/install_generator.rb +26 -0
- data/lib/generators/spree/auth/install/templates/config/initializers/devise.rb +1 -0
- data/lib/spree/auth.rb +2 -1
- data/lib/spree/auth/devise.rb +7 -0
- data/lib/spree/auth/engine.rb +57 -2
- data/lib/spree/authentication_helpers.rb +1 -1
- data/lib/spree_auth_devise.rb +3 -0
- data/lib/views/backend/spree/admin/user_passwords/edit.html.erb +15 -0
- data/lib/views/backend/spree/admin/user_passwords/new.html.erb +17 -0
- data/lib/views/backend/spree/admin/user_sessions/authorization_failure.html.erb +4 -0
- data/lib/views/backend/spree/admin/user_sessions/new.html.erb +38 -0
- data/lib/views/backend/spree/layouts/admin/_login_nav.html.erb +33 -0
- data/lib/views/backend/spree/layouts/login.html.erb +25 -0
- data/lib/views/frontend/spree/checkout/_new_user.html.erb +20 -0
- data/lib/views/frontend/spree/checkout/registration.html.erb +27 -0
- data/{app/views → lib/views/frontend}/spree/shared/_flashes.html.erb +0 -0
- data/lib/views/frontend/spree/shared/_login.html.erb +18 -0
- data/lib/views/frontend/spree/shared/_login_bar.html.erb +6 -0
- data/lib/views/frontend/spree/shared/_user_form.html.erb +13 -0
- data/lib/views/frontend/spree/user_mailer/confirmation_instructions.text.erb +5 -0
- data/lib/views/frontend/spree/user_mailer/reset_password_instructions.text.erb +10 -0
- data/lib/views/frontend/spree/user_passwords/edit.html.erb +22 -0
- data/lib/views/frontend/spree/user_passwords/new.html.erb +21 -0
- data/lib/views/frontend/spree/user_registrations/new.html.erb +22 -0
- data/lib/views/frontend/spree/user_sessions/new.html.erb +20 -0
- data/lib/views/frontend/spree/users/edit.html.erb +17 -0
- data/lib/views/frontend/spree/users/show.html.erb +43 -0
- data/spec/controllers/spree/admin/orders_controller_spec.rb +14 -0
- data/spec/controllers/spree/checkout_controller_spec.rb +141 -0
- data/spec/controllers/spree/products_controller_spec.rb +21 -0
- data/spec/controllers/spree/user_passwords_controller_spec.rb +44 -0
- data/spec/controllers/spree/user_registrations_controller_spec.rb +13 -0
- data/spec/controllers/spree/user_sessions_controller_spec.rb +56 -0
- data/spec/controllers/spree/users_controller_spec.rb +38 -0
- data/spec/factories/confirmed_user.rb +7 -0
- data/spec/features/account_spec.rb +58 -0
- data/spec/features/admin/orders_spec.rb +28 -0
- data/spec/features/admin/password_reset_spec.rb +24 -0
- data/spec/features/admin/products_spec.rb +9 -0
- data/spec/features/admin/sign_in_spec.rb +45 -0
- data/spec/features/admin/sign_out_spec.rb +22 -0
- data/spec/features/admin_permissions_spec.rb +46 -0
- data/spec/features/change_email_spec.rb +24 -0
- data/spec/features/checkout_spec.rb +160 -0
- data/spec/features/confirmation_spec.rb +28 -0
- data/spec/features/order_spec.rb +62 -0
- data/spec/features/password_reset_spec.rb +24 -0
- data/spec/features/sign_in_spec.rb +54 -0
- data/spec/features/sign_out_spec.rb +25 -0
- data/spec/features/sign_up_spec.rb +30 -0
- data/spec/mailers/user_mailer_spec.rb +46 -0
- data/spec/models/order_spec.rb +26 -0
- data/spec/models/user_spec.rb +58 -0
- data/spec/spec_helper.rb +24 -0
- data/spec/support/ability.rb +15 -0
- data/spec/support/authentication_helpers.rb +14 -0
- data/spec/support/capybara.rb +7 -0
- data/spec/support/confirm_helpers.rb +11 -0
- data/spec/support/database_cleaner.rb +18 -0
- data/spec/support/email.rb +5 -0
- data/spec/support/factory_girl.rb +5 -0
- data/spec/support/spree.rb +26 -0
- data/spree_auth_devise.gemspec +48 -0
- metadata +441 -79
- data/app/assets/javascripts/admin/spree_auth.js +0 -1
- data/app/assets/javascripts/store/spree_auth.js +0 -1
- data/app/assets/stylesheets/admin/spree_auth.css +0 -3
- data/app/assets/stylesheets/store/spree_auth.css +0 -3
- data/app/controllers/spree/admin/admin_controller_decorator.rb +0 -7
- data/app/controllers/spree/admin/admin_users_controller_decorator.rb +0 -21
- data/app/controllers/spree/admin/users_controller.rb +0 -77
- data/app/controllers/spree/base_controller_decorator.rb +0 -18
- data/app/controllers/spree/orders_controller_decorator.rb +0 -15
- data/app/controllers/spree/user_sessions_controller.rb +0 -54
- data/app/helpers/spree/users_helper.rb +0 -15
- data/app/models/spree/current_order_decorator.rb +0 -12
- data/app/overrides/admin_tab.rb +0 -6
- data/app/overrides/auth_admin_login_navigation_bar.rb +0 -5
- data/app/overrides/auth_user_login_form.rb +0 -6
- data/app/views/spree/admin/users/_form.html.erb +0 -37
- data/app/views/spree/admin/users/edit.html.erb +0 -28
- data/app/views/spree/admin/users/index.html.erb +0 -53
- data/app/views/spree/admin/users/new.html.erb +0 -23
- data/app/views/spree/admin/users/show.html.erb +0 -21
- data/app/views/spree/layouts/admin/_login_nav.html.erb +0 -8
- data/app/views/spree/shared/_login.html.erb +0 -20
- data/app/views/spree/shared/_login_bar.html.erb +0 -6
- data/app/views/spree/shared/_user_form.html.erb +0 -17
- data/app/views/spree/user_mailer/reset_password_instructions.text.erb +0 -10
- data/app/views/spree/user_passwords/edit.html.erb +0 -15
- data/app/views/spree/user_passwords/new.html.erb +0 -15
- data/app/views/spree/user_registrations/new.html.erb +0 -22
- data/app/views/spree/user_sessions/authorization_failure.html.erb +0 -4
- data/app/views/spree/user_sessions/new.html.erb +0 -13
- data/app/views/spree/users/edit.html.erb +0 -11
- data/app/views/spree/users/show.html.erb +0 -43
- data/config/initializers/spree.rb +0 -1
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: e8d33a18b8879913709314cd4046b18ee1518627
|
4
|
+
data.tar.gz: aaf7a78332ae2badc7f69ccc3773605d91713d0c
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 1bcc4fdd327f2adfe7ca449333f643e42d004e3e6ccf4adb70306deb4c04157fcc66628889e8bb38d956f6358a471ae33f81d4f53b0dfbae0ea2a88136f5ce7f
|
7
|
+
data.tar.gz: 430bf537bbf294bf7e6cdce733e68cad0f1f0efeade91c181798cd6b7103c27ca1ac5930dfefc83ebc2b2b2c004d690162d725bd78d17d79f1472ac5ecf8016f
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/{LICENSE → LICENSE.md}
RENAMED
data/README.md
CHANGED
@@ -1,14 +1,30 @@
|
|
1
1
|
# Spree Auth (Devise)
|
2
2
|
|
3
|
+
[![Build Status](https://secure.travis-ci.org/spree/spree_auth_devise.png?branch=master)](https://travis-ci.org/spree/spree_auth_devise)
|
4
|
+
[![Code Climate](https://codeclimate.com/github/spree/spree_auth_devise.png)](https://codeclimate.com/github/spree/spree_auth_devise)
|
5
|
+
|
3
6
|
Provides authentication services for Spree, using the Devise gem.
|
4
7
|
|
5
8
|
## Installation
|
6
9
|
|
7
|
-
At one stage in the past, this used to be the auth component for Spree. If that's the feature that you're now finding lacking from Spree, that's
|
10
|
+
At one stage in the past, this used to be the auth component for Spree. If that's the feature that you're now finding lacking from Spree, that's easily fixed.
|
11
|
+
|
12
|
+
Just add this line to your `Gemfile`:
|
13
|
+
```ruby
|
14
|
+
gem 'spree_auth_devise', github: 'spree/spree_auth_devise', branch: 'master'
|
15
|
+
```
|
16
|
+
|
17
|
+
Please ensure you're using the correct branch of `spree_auth_devise` relative to your version of Spree.
|
8
18
|
|
9
|
-
|
19
|
+
Spree 1.3.x or 1-3-stable:
|
20
|
+
```ruby
|
21
|
+
gem 'spree_auth_devise', :github => 'spree/spree_auth_devise', :branch => '1-3-stable'
|
22
|
+
```
|
10
23
|
|
11
|
-
|
24
|
+
Spree 1.2.x or 1-2-stable:
|
25
|
+
```ruby
|
26
|
+
gem 'spree_auth_devise', :github => 'spree/spree_auth_devise', :branch => '1-2-stable'
|
27
|
+
```
|
12
28
|
|
13
29
|
Then run `bundle install`. Authentication will then work exactly as it did in previous versions of Spree.
|
14
30
|
|
@@ -16,14 +32,75 @@ If you're installing this in a new Spree 1.2+ application, you'll need to instal
|
|
16
32
|
|
17
33
|
bundle exec rake spree_auth:install:migrations
|
18
34
|
bundle exec rake db:migrate
|
35
|
+
bundle exec rails g spree:auth:install
|
36
|
+
|
37
|
+
and then, run this command in order to set up the admin user for the application.
|
38
|
+
|
39
|
+
bundle exec rake spree_auth:admin:create
|
40
|
+
|
41
|
+
## Configuration
|
42
|
+
|
43
|
+
### Confirmable
|
44
|
+
|
45
|
+
To enable Devise's Confirmable module, which will send the user an email with a link to confirm their account, you must do the following:
|
46
|
+
|
47
|
+
* Add this line to an initializer in your Rails project (typically `config/initializers/spree.rb`):
|
48
|
+
```ruby
|
49
|
+
Spree::Auth::Config[:confirmable] = true
|
50
|
+
```
|
51
|
+
|
52
|
+
* Add a Devise initializer to your Rails project (typically `config/initializers/devise.rb`):
|
53
|
+
```ruby
|
54
|
+
Devise.setup do |config|
|
55
|
+
# Required so users don't lose their carts when they need to confirm.
|
56
|
+
config.allow_unconfirmed_access_for = 1.days
|
57
|
+
|
58
|
+
# Fixes the bug where Confirmation errors result in a broken page.
|
59
|
+
config.router_name = :spree
|
60
|
+
|
61
|
+
# Add any other devise configurations here, as they will override the defaults provided by spree_auth_devise.
|
62
|
+
end
|
63
|
+
```
|
64
|
+
|
65
|
+
## Using in an existing Rails application
|
66
|
+
|
67
|
+
If you are installing Spree inside of a host application in which you want your own permission setup, you can do this using spree_auth_devise's register_ability method.
|
68
|
+
|
69
|
+
First create your own CanCan Ability class following the CanCan documentation.
|
70
|
+
|
71
|
+
For example: app/models/your_ability_class.rb
|
72
|
+
|
73
|
+
```ruby
|
74
|
+
class YourAbilityClass
|
75
|
+
include CanCan::Ability
|
76
|
+
|
77
|
+
def initialize user
|
78
|
+
# direct permissions
|
79
|
+
can :create, SomeRailsObject
|
80
|
+
|
81
|
+
# or permissions by group
|
82
|
+
if spree_user.has_spree_role? "admin"
|
83
|
+
can :create, SomeRailsAdminObject
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|
87
|
+
```
|
88
|
+
|
89
|
+
Then register your class in your spree initializer: config/initializers/spree.rb
|
90
|
+
```ruby
|
91
|
+
Spree::Ability.register_ability(YourAbilityClass)
|
92
|
+
```
|
19
93
|
|
20
|
-
|
94
|
+
Inside of your host application you can then use CanCan like you normally would.
|
95
|
+
```ruby
|
96
|
+
<% if can? :show SomeRailsObject %>
|
21
97
|
|
22
|
-
|
98
|
+
<% end %>
|
99
|
+
```
|
23
100
|
|
24
|
-
|
25
|
-
rake db:migrate
|
101
|
+
### Adding Permissions to Gems
|
26
102
|
|
103
|
+
This methodology can also be used by gems that extend spree and want/need to add permissions.
|
27
104
|
|
28
105
|
## Testing
|
29
106
|
|
@@ -31,9 +108,8 @@ You need to do a quick one-time creation of a test application and then you can
|
|
31
108
|
|
32
109
|
bundle exec rake test_app
|
33
110
|
|
34
|
-
Then run the rspec tests
|
111
|
+
Then run the rspec tests.
|
35
112
|
|
36
113
|
bundle exec rake spec
|
37
114
|
|
38
|
-
If everything doesn't pass on your machine (using Ruby (1.
|
39
|
-
and we will investigate it.
|
115
|
+
If everything doesn't pass on your machine (using Ruby (1.9.3 or 2.0.0) and (MySQL or PostgreSQL or SQLite3)) then we would consider that a bug. Please file a bug report on the issues page for this project with your test output and we will investigate it.
|
data/Rakefile
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'bundler'
|
2
|
+
Bundler::GemHelper.install_tasks
|
3
|
+
|
4
|
+
require 'rspec/core/rake_task'
|
5
|
+
require 'spree/testing_support/common_rake'
|
6
|
+
|
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'] = 'spree/auth'
|
14
|
+
Rake::Task['common:test_app'].invoke("Spree::User")
|
15
|
+
end
|
data/Versionfile
ADDED
@@ -1,8 +1,15 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
1
|
+
module Spree
|
2
|
+
class UserMailer < BaseMailer
|
3
|
+
def reset_password_instructions(user, token, *args)
|
4
|
+
@edit_password_reset_url = spree.edit_spree_user_password_url(:reset_password_token => token, :host => Spree::Store.current.url)
|
4
5
|
|
5
|
-
|
6
|
-
|
6
|
+
mail to: user.email, from: from_address, subject: Spree::Store.current.name + ' ' + I18n.t(:subject, :scope => [:devise, :mailer, :reset_password_instructions])
|
7
|
+
end
|
8
|
+
|
9
|
+
def confirmation_instructions(user, token, opts={})
|
10
|
+
@confirmation_url = spree.spree_user_confirmation_url(:confirmation_token => token, :host => Spree::Store.current.url)
|
11
|
+
|
12
|
+
mail to: user.email, from: from_address, subject: Spree::Store.current.name + ' ' + I18n.t(:subject, :scope => [:devise, :mailer, :confirmation_instructions])
|
13
|
+
end
|
7
14
|
end
|
8
15
|
end
|
data/app/models/spree/user.rb
CHANGED
@@ -1,48 +1,30 @@
|
|
1
1
|
module Spree
|
2
|
-
class User <
|
3
|
-
include
|
2
|
+
class User < Spree::Base
|
3
|
+
include UserAddress
|
4
|
+
include UserPaymentSource
|
4
5
|
|
5
|
-
devise :database_authenticatable, :
|
6
|
+
devise :database_authenticatable, :registerable, :recoverable,
|
6
7
|
:rememberable, :trackable, :validatable, :encryptable, :encryptor => 'authlogic_sha512'
|
8
|
+
devise :confirmable if Spree::Auth::Config[:confirmable]
|
9
|
+
|
10
|
+
acts_as_paranoid
|
11
|
+
after_destroy :scramble_email_and_password
|
7
12
|
|
8
13
|
has_many :orders
|
9
|
-
belongs_to :ship_address, :foreign_key => 'ship_address_id', :class_name => 'Spree::Address'
|
10
|
-
belongs_to :bill_address, :foreign_key => 'bill_address_id', :class_name => 'Spree::Address'
|
11
14
|
|
12
|
-
before_save :check_admin
|
13
15
|
before_validation :set_login
|
14
|
-
before_destroy :check_completed_orders
|
15
|
-
|
16
|
-
# Setup accessible (or protected) attributes for your model
|
17
|
-
attr_accessible :email, :password, :password_confirmation, :remember_me, :persistence_token, :login, :spree_role_ids
|
18
16
|
|
19
17
|
users_table_name = User.table_name
|
20
18
|
roles_table_name = Role.table_name
|
21
19
|
|
22
|
-
scope :admin,
|
23
|
-
scope :registered, where("#{users_table_name}.email NOT LIKE ?", "%@example.net")
|
24
|
-
|
25
|
-
class DestroyWithOrdersError < StandardError; end
|
26
|
-
|
27
|
-
# Creates an anonymous user. An anonymous user is basically an auto-generated +User+ account that is created for the customer
|
28
|
-
# behind the scenes and its completely transparently to the customer. All +Orders+ must have a +User+ so this is necessary
|
29
|
-
# when adding to the "cart" (which is really an order) and before the customer has a chance to provide an email or to register.
|
30
|
-
def self.anonymous!
|
31
|
-
token = User.generate_token(:persistence_token)
|
32
|
-
User.create(:email => "#{token}@example.net", :password => token, :password_confirmation => token, :persistence_token => token)
|
33
|
-
end
|
20
|
+
scope :admin, -> { includes(:spree_roles).where("#{roles_table_name}.name" => "admin") }
|
34
21
|
|
35
22
|
def self.admin_created?
|
36
23
|
User.admin.count > 0
|
37
24
|
end
|
38
25
|
|
39
|
-
def
|
40
|
-
|
41
|
-
end
|
42
|
-
|
43
|
-
def send_reset_password_instructions
|
44
|
-
generate_reset_password_token!
|
45
|
-
UserMailer.reset_password_instructions(self).deliver
|
26
|
+
def admin?
|
27
|
+
has_spree_role?('admin')
|
46
28
|
end
|
47
29
|
|
48
30
|
protected
|
@@ -52,32 +34,17 @@ module Spree
|
|
52
34
|
|
53
35
|
private
|
54
36
|
|
55
|
-
def check_completed_orders
|
56
|
-
raise DestroyWithOrdersError if orders.complete.present?
|
57
|
-
end
|
58
|
-
|
59
|
-
def check_admin
|
60
|
-
return if self.class.admin_created?
|
61
|
-
admin_role = Role.find_or_create_by_name 'admin'
|
62
|
-
self.spree_roles << admin_role
|
63
|
-
end
|
64
|
-
|
65
37
|
def set_login
|
66
38
|
# for now force login to be same as email, eventually we will make this configurable, etc.
|
67
39
|
self.login ||= self.email if self.email
|
68
40
|
end
|
69
41
|
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
def self.generate_token(column)
|
77
|
-
loop do
|
78
|
-
token = friendly_token
|
79
|
-
break token unless find(:first, :conditions => { column => token })
|
80
|
-
end
|
42
|
+
def scramble_email_and_password
|
43
|
+
self.email = SecureRandom.uuid + "@example.net"
|
44
|
+
self.login = self.email
|
45
|
+
self.password = SecureRandom.hex(8)
|
46
|
+
self.password_confirmation = self.password
|
47
|
+
self.save
|
81
48
|
end
|
82
49
|
end
|
83
50
|
end
|
data/bin/rails
ADDED
data/circle.yml
ADDED
data/config.ru
ADDED
@@ -40,7 +40,7 @@ Devise.setup do |config|
|
|
40
40
|
config.stretches = 20
|
41
41
|
|
42
42
|
# Setup a pepper to generate the encrypted password.
|
43
|
-
config.pepper =
|
43
|
+
config.pepper = Rails.configuration.secret_token
|
44
44
|
|
45
45
|
# ==> Configuration for :confirmable
|
46
46
|
# The time you want to give your user to confirm his account. During this time
|
@@ -65,9 +65,6 @@ Devise.setup do |config|
|
|
65
65
|
# Range for password length
|
66
66
|
# config.password_length = 6..20
|
67
67
|
|
68
|
-
# Regex to use to validate the email address
|
69
|
-
config.email_regexp = /^([\w\.%\+\-]+)@([\w\-]+\.)+([\w]{2,})$/i
|
70
|
-
|
71
68
|
# ==> Configuration for :timeoutable
|
72
69
|
# The time you want to timeout the user session without activity. After this
|
73
70
|
# time the user will be asked for credentials again.
|
@@ -93,10 +90,6 @@ Devise.setup do |config|
|
|
93
90
|
# Time interval to unlock the account if :time is enabled as unlock_strategy.
|
94
91
|
# config.unlock_in = 1.hour
|
95
92
|
|
96
|
-
# ==> Configuration for :token_authenticatable
|
97
|
-
# Defines name of the authentication token params key
|
98
|
-
config.token_authentication_key = :auth_token
|
99
|
-
|
100
93
|
# ==> Scopes configuration
|
101
94
|
# Turn scoped views on. Before rendering 'sessions/new', it will first check for
|
102
95
|
# 'users/sessions/new'. It's turned off by default because it's slower if you
|
@@ -139,4 +132,6 @@ Devise.setup do |config|
|
|
139
132
|
# change their passwords.
|
140
133
|
config.reset_password_within = 6.hours
|
141
134
|
config.sign_out_via = :get
|
135
|
+
|
136
|
+
config.case_insensitive_keys = [:email]
|
142
137
|
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# Merges users orders to their account after sign in and sign up.
|
2
|
+
Warden::Manager.after_set_user except: :fetch do |user, auth, opts|
|
3
|
+
if auth.cookies.signed[:guest_token].present?
|
4
|
+
if user.is_a?(Spree::User)
|
5
|
+
Spree::Order.where(email: user.email, guest_token: auth.cookies.signed[:guest_token], user_id: nil).each do |order|
|
6
|
+
order.associate_user!(user)
|
7
|
+
end
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
Warden::Manager.before_logout do |user, auth, opts|
|
13
|
+
auth.cookies.delete :guest_token
|
14
|
+
end
|
data/config/locales/de.yml
CHANGED
@@ -1,46 +1,49 @@
|
|
1
|
+
---
|
1
2
|
de:
|
2
|
-
errors:
|
3
|
-
messages:
|
4
|
-
not_found: 'nicht gefunden'
|
5
|
-
already_confirmed: 'wurde berreits bestätigt'
|
6
|
-
not_locked: 'war nicht gesperrt'
|
7
|
-
not_saved:
|
8
|
-
one: '1 Fehler verhindert das Speichern von %{resource}:'
|
9
|
-
other: '%{count} Fehler verhindern das Speichern von %{resource}:'
|
10
3
|
devise:
|
4
|
+
confirmations:
|
5
|
+
confirmed: Ihr Konto wurde erfolgreich aktiviert.
|
6
|
+
send_instructions: 'In ein paar Minuten erhalten Sie eine E-Mail mit Anweisungen, um Ihr Konto zu aktivieren.'
|
11
7
|
failure:
|
8
|
+
inactive: Ihr Konto wurde noch nicht aktiviert.
|
9
|
+
invalid: Ungültige E-Mail-Adresse oder Passwort.
|
10
|
+
invalid_token: Ungültiger Authentifizierungsschlüssel.
|
11
|
+
locked: Ihr Konto ist gesperrt.
|
12
|
+
timeout: 'Ihre Sitzung ist abgelaufen. Bitte melden Sie sich erneut an, um fortzufahren.'
|
12
13
|
unauthenticated: 'Sie müssen sich anmelden oder registrieren, bevor Sie fortfahren.'
|
13
14
|
unconfirmed: 'Sie müssen Ihre Registrierung bestätigen, bevor Sie fortfahren.'
|
14
|
-
locked: 'Ihr Konto ist gesperrt.'
|
15
|
-
invalid: 'Ungültige E-Mail-Adresse oder Passwort.'
|
16
|
-
invalid_token: 'Ungültiger Authentifizierungsschlüssel.'
|
17
|
-
timeout: 'Ihre Sitzung ist abgelaufen. Bitte melden Sie sich erneut an, um fortzufahren.'
|
18
|
-
inactive: 'Ihr Konto wurde noch nicht aktiviert.'
|
19
|
-
user_passwords:
|
20
|
-
user:
|
21
|
-
send_instructions: 'In ein paar Minuten erhalten Sie eine E-Mail mit Anweisungen um Ihr Passwort zurücksetzen.'
|
22
|
-
updated: 'Ihr Passwort wurde erfolgreich geändert.'
|
23
|
-
confirmations:
|
24
|
-
send_instructions: 'In ein paar Minuten erhalten Sie eine E-Mail mit Anweisungen, um Ihr Konto zu aktivieren.'
|
25
|
-
confirmed: 'Ihr Konto wurde erfolgreich aktiviert.'
|
26
|
-
user_registrations:
|
27
|
-
signed_up: 'Herzlich Willkommen! Sie haben sich erfolgreich registriert.'
|
28
|
-
inactive_signed_up: 'Sie haben sich erfolgreich registriert. Wir konnten Sie jedoch nicht anmelden, da Ihr Konto %{reason} ist.'
|
29
|
-
updated: 'Sie haben Ihr Konto erfolgreich aktualisiert.'
|
30
|
-
destroyed: 'Ihr Konto wurde erfolgreich gelöscht. Auf Wiedersehen!'
|
31
|
-
user_sessions:
|
32
|
-
signed_in: 'Erfolgreich angemeldet.'
|
33
|
-
signed_out: 'Erfolgreich abgemeldet.'
|
34
|
-
unlocks:
|
35
|
-
send_instructions: 'In ein paar Minuten erhalten Sie eine E-Mail mit Anweisungen um Ihr Konto freizuschalten.'
|
36
|
-
unlocked: 'Ihr Konto wurde erfolgreich freigeschaltet.'
|
37
|
-
oauth_callbacks:
|
38
|
-
success: 'Erfolgreich autorisiert durch %{kind} Konto.'
|
39
|
-
failure: 'Autorisierung durch %{kind} fehlgeschlagen aufgrund von "%{reason}".'
|
40
15
|
mailer:
|
41
16
|
confirmation_instructions:
|
42
|
-
subject:
|
17
|
+
subject: Bestätigen Sie Ihre Registrierung
|
43
18
|
reset_password_instructions:
|
44
|
-
subject:
|
19
|
+
subject: Passwort zurücksetzen
|
45
20
|
unlock_instructions:
|
46
|
-
subject:
|
21
|
+
subject: Konto freischalten
|
22
|
+
oauth_callbacks:
|
23
|
+
failure: 'Autorisierung durch %{kind} fehlgeschlagen aufgrund von %{reason}.'
|
24
|
+
success: 'Erfolgreich autorisiert durch %{kind} Konto.'
|
25
|
+
unlocks:
|
26
|
+
send_instructions: In ein paar Minuten erhalten Sie eine E-Mail mit Anweisungen um Ihr Konto freizuschalten.
|
27
|
+
unlocked: Ihr Konto wurde erfolgreich freigeschaltet.
|
28
|
+
user_passwords:
|
29
|
+
spree_user:
|
30
|
+
cannot_be_blank: Ihr Passwort darf nicht leer sein.
|
31
|
+
send_instructions: In ein paar Minuten erhalten Sie eine E-Mail mit Anweisungen um Ihr Passwort zurücksetzen.
|
32
|
+
updated: Ihr Passwort wurde erfolgreich geändert.
|
33
|
+
user_registrations:
|
34
|
+
destroyed: Ihr Konto wurde erfolgreich gelöscht. Auf Wiedersehen!
|
35
|
+
inactive_signed_up: 'Sie haben sich erfolgreich registriert. Wir konnten Sie jedoch nicht anmelden, da Ihr Konto %{reason} ist.'
|
36
|
+
signed_up: Herzlich Willkommen! Sie haben sich erfolgreich registriert.
|
37
|
+
updated: Sie haben Ihr Konto erfolgreich aktualisiert.
|
38
|
+
user_sessions:
|
39
|
+
signed_in: Erfolgreich angemeldet.
|
40
|
+
signed_out: Erfolgreich abgemeldet.
|
41
|
+
errors:
|
42
|
+
messages:
|
43
|
+
already_confirmed: wurde berreits bestätigt
|
44
|
+
email_is_invalid: E-Mail-Adresse darf nicht leer sein
|
45
|
+
not_found: nicht gefunden
|
46
|
+
not_locked: war nicht gesperrt
|
47
|
+
not_saved:
|
48
|
+
one: '1 Fehler verhindert das Speichern von %{resource}:'
|
49
|
+
other: '%{count} Fehler verhindern das Speichern von %{resource}:'
|