devise_ennder 1.0.1.0.9
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.rdoc +397 -0
- data/INSTALL +94 -0
- data/MIT-LICENSE +20 -0
- data/README.rdoc +272 -0
- data/Rakefile +53 -0
- data/TODO +2 -0
- data/app/controllers/confirmations_controller.rb +33 -0
- data/app/controllers/passwords_controller.rb +41 -0
- data/app/controllers/registrations_controller.rb +62 -0
- data/app/controllers/sessions_controller.rb +42 -0
- data/app/controllers/unlocks_controller.rb +41 -0
- data/app/models/devise_mailer.rb +68 -0
- data/app/models/user.rb +9 -0
- data/app/views/confirmations/new.html.erb +14 -0
- data/app/views/devise_mailer/confirmation_instructions.html.erb +6 -0
- data/app/views/devise_mailer/reset_password_instructions.html.erb +8 -0
- data/app/views/devise_mailer/unlock_instructions.html.erb +7 -0
- data/app/views/passwords/edit.html.erb +16 -0
- data/app/views/passwords/new.html.erb +12 -0
- data/app/views/registrations/edit.html.erb +25 -0
- data/app/views/registrations/new.html.erb +17 -0
- data/app/views/sessions/new.html.erb +17 -0
- data/app/views/shared/_devise_links.erb +19 -0
- data/app/views/shared/_user_nav.html.erb +15 -0
- data/app/views/unlocks/new.html.erb +12 -0
- data/config/locales/devise.en.yml +62 -0
- data/config/locales/devise.fr.yml +60 -0
- data/config/locales/en.yml +6 -0
- data/config/locales/fr.yml +18 -0
- data/config/routes.rb +4 -0
- data/db/migrate/20100506013336_devise_create_users.rb +23 -0
- data/lib/devise/controllers/helpers.rb +212 -0
- data/lib/devise/controllers/internal_helpers.rb +129 -0
- data/lib/devise/controllers/url_helpers.rb +41 -0
- data/lib/devise/encryptors/authlogic_sha512.rb +21 -0
- data/lib/devise/encryptors/base.rb +20 -0
- data/lib/devise/encryptors/bcrypt.rb +21 -0
- data/lib/devise/encryptors/clearance_sha1.rb +19 -0
- data/lib/devise/encryptors/restful_authentication_sha1.rb +22 -0
- data/lib/devise/encryptors/sha1.rb +27 -0
- data/lib/devise/encryptors/sha512.rb +27 -0
- data/lib/devise/failure_app.rb +70 -0
- data/lib/devise/hooks/activatable.rb +15 -0
- data/lib/devise/hooks/rememberable.rb +33 -0
- data/lib/devise/hooks/timeoutable.rb +18 -0
- data/lib/devise/hooks/trackable.rb +18 -0
- data/lib/devise/locales/en.yml +35 -0
- data/lib/devise/mapping.rb +130 -0
- data/lib/devise/models/activatable.rb +16 -0
- data/lib/devise/models/confirmable.rb +167 -0
- data/lib/devise/models/database_authenticatable.rb +144 -0
- data/lib/devise/models/http_authenticatable.rb +23 -0
- data/lib/devise/models/lockable.rb +150 -0
- data/lib/devise/models/recoverable.rb +80 -0
- data/lib/devise/models/registerable.rb +8 -0
- data/lib/devise/models/rememberable.rb +92 -0
- data/lib/devise/models/timeoutable.rb +28 -0
- data/lib/devise/models/token_authenticatable.rb +89 -0
- data/lib/devise/models/trackable.rb +16 -0
- data/lib/devise/models/validatable.rb +39 -0
- data/lib/devise/models.rb +117 -0
- data/lib/devise/orm/active_record.rb +41 -0
- data/lib/devise/orm/data_mapper.rb +83 -0
- data/lib/devise/orm/mongo_mapper.rb +52 -0
- data/lib/devise/rails/routes.rb +133 -0
- data/lib/devise/rails/warden_compat.rb +60 -0
- data/lib/devise/rails.rb +14 -0
- data/lib/devise/schema.rb +73 -0
- data/lib/devise/strategies/base.rb +16 -0
- data/lib/devise/strategies/database_authenticatable.rb +36 -0
- data/lib/devise/strategies/http_authenticatable.rb +59 -0
- data/lib/devise/strategies/rememberable.rb +37 -0
- data/lib/devise/strategies/token_authenticatable.rb +37 -0
- data/lib/devise/test_helpers.rb +90 -0
- data/lib/devise/version.rb +3 -0
- data/lib/devise.rb +269 -0
- data/lib/devise_ennder.rb +3 -0
- data/lib/tasks/devise_ennder_tasks.rake +11 -0
- data/test/controllers/helpers_test.rb +184 -0
- data/test/controllers/internal_helpers_test.rb +55 -0
- data/test/controllers/url_helpers_test.rb +47 -0
- data/test/devise_test.rb +74 -0
- data/test/encryptors_test.rb +31 -0
- data/test/failure_app_test.rb +44 -0
- data/test/integration/authenticatable_test.rb +332 -0
- data/test/integration/confirmable_test.rb +97 -0
- data/test/integration/http_authenticatable_test.rb +52 -0
- data/test/integration/lockable_test.rb +102 -0
- data/test/integration/rack_middleware_test.rb +47 -0
- data/test/integration/recoverable_test.rb +141 -0
- data/test/integration/registerable_test.rb +144 -0
- data/test/integration/rememberable_test.rb +72 -0
- data/test/integration/timeoutable_test.rb +68 -0
- data/test/integration/token_authenticatable_test.rb +55 -0
- data/test/integration/trackable_test.rb +64 -0
- data/test/mailers/confirmation_instructions_test.rb +86 -0
- data/test/mailers/reset_password_instructions_test.rb +68 -0
- data/test/mailers/unlock_instructions_test.rb +62 -0
- data/test/mapping_test.rb +158 -0
- data/test/models/authenticatable_test.rb +180 -0
- data/test/models/confirmable_test.rb +228 -0
- data/test/models/lockable_test.rb +202 -0
- data/test/models/recoverable_test.rb +138 -0
- data/test/models/rememberable_test.rb +135 -0
- data/test/models/timeoutable_test.rb +28 -0
- data/test/models/token_authenticatable_test.rb +51 -0
- data/test/models/trackable_test.rb +5 -0
- data/test/models/validatable_test.rb +106 -0
- data/test/models_test.rb +70 -0
- data/test/orm/active_record.rb +31 -0
- data/test/orm/mongo_mapper.rb +20 -0
- data/test/rails_app/app/active_record/admin.rb +7 -0
- data/test/rails_app/app/active_record/user.rb +7 -0
- data/test/rails_app/app/controllers/admins_controller.rb +6 -0
- data/test/rails_app/app/controllers/application_controller.rb +12 -0
- data/test/rails_app/app/controllers/home_controller.rb +4 -0
- data/test/rails_app/app/controllers/users_controller.rb +16 -0
- data/test/rails_app/app/helpers/application_helper.rb +3 -0
- data/test/rails_app/app/mongo_mapper/admin.rb +13 -0
- data/test/rails_app/app/mongo_mapper/user.rb +14 -0
- data/test/rails_app/config/boot.rb +110 -0
- data/test/rails_app/config/environment.rb +42 -0
- data/test/rails_app/config/environments/development.rb +17 -0
- data/test/rails_app/config/environments/production.rb +28 -0
- data/test/rails_app/config/environments/test.rb +28 -0
- data/test/rails_app/config/initializers/devise.rb +82 -0
- data/test/rails_app/config/initializers/inflections.rb +2 -0
- data/test/rails_app/config/initializers/new_rails_defaults.rb +24 -0
- data/test/rails_app/config/initializers/session_store.rb +15 -0
- data/test/rails_app/config/routes.rb +25 -0
- data/test/rails_app/vendor/plugins/devise/app/controllers/confirmations_controller.rb +33 -0
- data/test/rails_app/vendor/plugins/devise/app/controllers/passwords_controller.rb +41 -0
- data/test/rails_app/vendor/plugins/devise/app/controllers/registrations_controller.rb +53 -0
- data/test/rails_app/vendor/plugins/devise/app/controllers/sessions_controller.rb +42 -0
- data/test/rails_app/vendor/plugins/devise/app/controllers/unlocks_controller.rb +41 -0
- data/test/rails_app/vendor/plugins/devise/app/models/devise_mailer.rb +68 -0
- data/test/rails_app/vendor/plugins/devise/generators/devise/devise_generator.rb +15 -0
- data/test/rails_app/vendor/plugins/devise/generators/devise/lib/route_devise.rb +32 -0
- data/test/rails_app/vendor/plugins/devise/generators/devise/templates/migration.rb +23 -0
- data/test/rails_app/vendor/plugins/devise/generators/devise/templates/model.rb +9 -0
- data/test/rails_app/vendor/plugins/devise/generators/devise_install/devise_install_generator.rb +15 -0
- data/test/rails_app/vendor/plugins/devise/generators/devise_install/templates/devise.rb +105 -0
- data/test/rails_app/vendor/plugins/devise/generators/devise_views/devise_views_generator.rb +21 -0
- data/test/rails_app/vendor/plugins/devise/lib/devise/controllers/helpers.rb +212 -0
- data/test/rails_app/vendor/plugins/devise/lib/devise/controllers/internal_helpers.rb +129 -0
- data/test/rails_app/vendor/plugins/devise/lib/devise/controllers/url_helpers.rb +41 -0
- data/test/rails_app/vendor/plugins/devise/lib/devise/encryptors/authlogic_sha512.rb +21 -0
- data/test/rails_app/vendor/plugins/devise/lib/devise/encryptors/base.rb +20 -0
- data/test/rails_app/vendor/plugins/devise/lib/devise/encryptors/bcrypt.rb +21 -0
- data/test/rails_app/vendor/plugins/devise/lib/devise/encryptors/clearance_sha1.rb +19 -0
- data/test/rails_app/vendor/plugins/devise/lib/devise/encryptors/restful_authentication_sha1.rb +22 -0
- data/test/rails_app/vendor/plugins/devise/lib/devise/encryptors/sha1.rb +27 -0
- data/test/rails_app/vendor/plugins/devise/lib/devise/encryptors/sha512.rb +27 -0
- data/test/rails_app/vendor/plugins/devise/lib/devise/failure_app.rb +70 -0
- data/test/rails_app/vendor/plugins/devise/lib/devise/hooks/activatable.rb +15 -0
- data/test/rails_app/vendor/plugins/devise/lib/devise/hooks/rememberable.rb +33 -0
- data/test/rails_app/vendor/plugins/devise/lib/devise/hooks/timeoutable.rb +18 -0
- data/test/rails_app/vendor/plugins/devise/lib/devise/hooks/trackable.rb +18 -0
- data/test/rails_app/vendor/plugins/devise/lib/devise/mapping.rb +130 -0
- data/test/rails_app/vendor/plugins/devise/lib/devise/models/activatable.rb +16 -0
- data/test/rails_app/vendor/plugins/devise/lib/devise/models/confirmable.rb +167 -0
- data/test/rails_app/vendor/plugins/devise/lib/devise/models/database_authenticatable.rb +144 -0
- data/test/rails_app/vendor/plugins/devise/lib/devise/models/http_authenticatable.rb +23 -0
- data/test/rails_app/vendor/plugins/devise/lib/devise/models/lockable.rb +150 -0
- data/test/rails_app/vendor/plugins/devise/lib/devise/models/recoverable.rb +80 -0
- data/test/rails_app/vendor/plugins/devise/lib/devise/models/registerable.rb +8 -0
- data/test/rails_app/vendor/plugins/devise/lib/devise/models/rememberable.rb +92 -0
- data/test/rails_app/vendor/plugins/devise/lib/devise/models/timeoutable.rb +28 -0
- data/test/rails_app/vendor/plugins/devise/lib/devise/models/token_authenticatable.rb +89 -0
- data/test/rails_app/vendor/plugins/devise/lib/devise/models/trackable.rb +16 -0
- data/test/rails_app/vendor/plugins/devise/lib/devise/models/validatable.rb +39 -0
- data/test/rails_app/vendor/plugins/devise/lib/devise/models.rb +117 -0
- data/test/rails_app/vendor/plugins/devise/lib/devise/orm/active_record.rb +41 -0
- data/test/rails_app/vendor/plugins/devise/lib/devise/orm/data_mapper.rb +83 -0
- data/test/rails_app/vendor/plugins/devise/lib/devise/orm/mongo_mapper.rb +52 -0
- data/test/rails_app/vendor/plugins/devise/lib/devise/rails/routes.rb +133 -0
- data/test/rails_app/vendor/plugins/devise/lib/devise/rails/warden_compat.rb +60 -0
- data/test/rails_app/vendor/plugins/devise/lib/devise/rails.rb +14 -0
- data/test/rails_app/vendor/plugins/devise/lib/devise/schema.rb +73 -0
- data/test/rails_app/vendor/plugins/devise/lib/devise/strategies/base.rb +16 -0
- data/test/rails_app/vendor/plugins/devise/lib/devise/strategies/database_authenticatable.rb +36 -0
- data/test/rails_app/vendor/plugins/devise/lib/devise/strategies/http_authenticatable.rb +59 -0
- data/test/rails_app/vendor/plugins/devise/lib/devise/strategies/rememberable.rb +37 -0
- data/test/rails_app/vendor/plugins/devise/lib/devise/strategies/token_authenticatable.rb +37 -0
- data/test/rails_app/vendor/plugins/devise/lib/devise/test_helpers.rb +90 -0
- data/test/rails_app/vendor/plugins/devise/lib/devise/version.rb +3 -0
- data/test/rails_app/vendor/plugins/devise/lib/devise.rb +266 -0
- data/test/rails_app/vendor/plugins/devise/rails/init.rb +2 -0
- data/test/rails_app/vendor/plugins/devise/test/controllers/helpers_test.rb +184 -0
- data/test/rails_app/vendor/plugins/devise/test/controllers/internal_helpers_test.rb +55 -0
- data/test/rails_app/vendor/plugins/devise/test/controllers/url_helpers_test.rb +47 -0
- data/test/rails_app/vendor/plugins/devise/test/devise_test.rb +74 -0
- data/test/rails_app/vendor/plugins/devise/test/encryptors_test.rb +31 -0
- data/test/rails_app/vendor/plugins/devise/test/failure_app_test.rb +44 -0
- data/test/rails_app/vendor/plugins/devise/test/integration/authenticatable_test.rb +332 -0
- data/test/rails_app/vendor/plugins/devise/test/integration/confirmable_test.rb +97 -0
- data/test/rails_app/vendor/plugins/devise/test/integration/http_authenticatable_test.rb +52 -0
- data/test/rails_app/vendor/plugins/devise/test/integration/lockable_test.rb +102 -0
- data/test/rails_app/vendor/plugins/devise/test/integration/rack_middleware_test.rb +47 -0
- data/test/rails_app/vendor/plugins/devise/test/integration/recoverable_test.rb +141 -0
- data/test/rails_app/vendor/plugins/devise/test/integration/registerable_test.rb +144 -0
- data/test/rails_app/vendor/plugins/devise/test/integration/rememberable_test.rb +72 -0
- data/test/rails_app/vendor/plugins/devise/test/integration/timeoutable_test.rb +68 -0
- data/test/rails_app/vendor/plugins/devise/test/integration/token_authenticatable_test.rb +55 -0
- data/test/rails_app/vendor/plugins/devise/test/integration/trackable_test.rb +64 -0
- data/test/rails_app/vendor/plugins/devise/test/mailers/confirmation_instructions_test.rb +86 -0
- data/test/rails_app/vendor/plugins/devise/test/mailers/reset_password_instructions_test.rb +68 -0
- data/test/rails_app/vendor/plugins/devise/test/mailers/unlock_instructions_test.rb +62 -0
- data/test/rails_app/vendor/plugins/devise/test/mapping_test.rb +158 -0
- data/test/rails_app/vendor/plugins/devise/test/models/authenticatable_test.rb +180 -0
- data/test/rails_app/vendor/plugins/devise/test/models/confirmable_test.rb +228 -0
- data/test/rails_app/vendor/plugins/devise/test/models/lockable_test.rb +202 -0
- data/test/rails_app/vendor/plugins/devise/test/models/recoverable_test.rb +138 -0
- data/test/rails_app/vendor/plugins/devise/test/models/rememberable_test.rb +135 -0
- data/test/rails_app/vendor/plugins/devise/test/models/timeoutable_test.rb +28 -0
- data/test/rails_app/vendor/plugins/devise/test/models/token_authenticatable_test.rb +51 -0
- data/test/rails_app/vendor/plugins/devise/test/models/trackable_test.rb +5 -0
- data/test/rails_app/vendor/plugins/devise/test/models/validatable_test.rb +106 -0
- data/test/rails_app/vendor/plugins/devise/test/models_test.rb +70 -0
- data/test/rails_app/vendor/plugins/devise/test/orm/active_record.rb +31 -0
- data/test/rails_app/vendor/plugins/devise/test/orm/mongo_mapper.rb +20 -0
- data/test/rails_app/vendor/plugins/devise/test/rails_app/app/active_record/admin.rb +7 -0
- data/test/rails_app/vendor/plugins/devise/test/rails_app/app/active_record/user.rb +7 -0
- data/test/rails_app/vendor/plugins/devise/test/rails_app/app/controllers/admins_controller.rb +6 -0
- data/test/rails_app/vendor/plugins/devise/test/rails_app/app/controllers/application_controller.rb +12 -0
- data/test/rails_app/vendor/plugins/devise/test/rails_app/app/controllers/home_controller.rb +4 -0
- data/test/rails_app/vendor/plugins/devise/test/rails_app/app/controllers/users_controller.rb +16 -0
- data/test/rails_app/vendor/plugins/devise/test/rails_app/app/helpers/application_helper.rb +3 -0
- data/test/rails_app/vendor/plugins/devise/test/rails_app/app/mongo_mapper/admin.rb +13 -0
- data/test/rails_app/vendor/plugins/devise/test/rails_app/app/mongo_mapper/user.rb +14 -0
- data/test/rails_app/vendor/plugins/devise/test/rails_app/config/boot.rb +110 -0
- data/test/rails_app/vendor/plugins/devise/test/rails_app/config/environment.rb +42 -0
- data/test/rails_app/vendor/plugins/devise/test/rails_app/config/environments/development.rb +17 -0
- data/test/rails_app/vendor/plugins/devise/test/rails_app/config/environments/production.rb +28 -0
- data/test/rails_app/vendor/plugins/devise/test/rails_app/config/environments/test.rb +28 -0
- data/test/rails_app/vendor/plugins/devise/test/rails_app/config/initializers/devise.rb +82 -0
- data/test/rails_app/vendor/plugins/devise/test/rails_app/config/initializers/inflections.rb +2 -0
- data/test/rails_app/vendor/plugins/devise/test/rails_app/config/initializers/new_rails_defaults.rb +24 -0
- data/test/rails_app/vendor/plugins/devise/test/rails_app/config/initializers/session_store.rb +15 -0
- data/test/rails_app/vendor/plugins/devise/test/rails_app/config/routes.rb +25 -0
- data/test/rails_app/vendor/plugins/devise/test/routes_test.rb +131 -0
- data/test/rails_app/vendor/plugins/devise/test/support/assertions_helper.rb +37 -0
- data/test/rails_app/vendor/plugins/devise/test/support/integration_tests_helper.rb +71 -0
- data/test/rails_app/vendor/plugins/devise/test/support/test_silencer.rb +5 -0
- data/test/rails_app/vendor/plugins/devise/test/support/tests_helper.rb +39 -0
- data/test/rails_app/vendor/plugins/devise/test/test_helper.rb +21 -0
- data/test/rails_app/vendor/plugins/devise/test/test_helpers_test.rb +57 -0
- data/test/routes_test.rb +131 -0
- data/test/support/assertions_helper.rb +37 -0
- data/test/support/integration_tests_helper.rb +71 -0
- data/test/support/test_silencer.rb +5 -0
- data/test/support/tests_helper.rb +39 -0
- data/test/test_helper.rb +21 -0
- data/test/test_helpers_test.rb +57 -0
- metadata +515 -0
@@ -0,0 +1,73 @@
|
|
1
|
+
module Devise
|
2
|
+
# Holds devise schema information. To use it, just include its methods
|
3
|
+
# and overwrite the apply_schema method.
|
4
|
+
module Schema
|
5
|
+
|
6
|
+
def authenticatable(*args)
|
7
|
+
ActiveSupport::Deprecation.warn "t.authenticatable in migrations is deprecated. Please use t.database_authenticatable instead.", caller
|
8
|
+
database_authenticatable(*args)
|
9
|
+
end
|
10
|
+
|
11
|
+
# Creates email, encrypted_password and password_salt.
|
12
|
+
#
|
13
|
+
# == Options
|
14
|
+
# * :null - When true, allow columns to be null.
|
15
|
+
def database_authenticatable(options={})
|
16
|
+
null = options[:null] || false
|
17
|
+
default = options[:default] || ""
|
18
|
+
|
19
|
+
if options.delete(:encryptor)
|
20
|
+
ActiveSupport::Deprecation.warn ":encryptor as option is deprecated, simply remove it."
|
21
|
+
end
|
22
|
+
|
23
|
+
apply_schema :email, String, :null => null, :default => default
|
24
|
+
apply_schema :encrypted_password, String, :null => null, :default => default, :limit => 128
|
25
|
+
apply_schema :password_salt, String, :null => null, :default => default
|
26
|
+
end
|
27
|
+
|
28
|
+
# Creates authentication_token.
|
29
|
+
def token_authenticatable
|
30
|
+
apply_schema :authentication_token, String
|
31
|
+
end
|
32
|
+
|
33
|
+
# Creates confirmation_token, confirmed_at and confirmation_sent_at.
|
34
|
+
def confirmable
|
35
|
+
apply_schema :confirmation_token, String
|
36
|
+
apply_schema :confirmed_at, DateTime
|
37
|
+
apply_schema :confirmation_sent_at, DateTime
|
38
|
+
end
|
39
|
+
|
40
|
+
# Creates reset_password_token.
|
41
|
+
def recoverable
|
42
|
+
apply_schema :reset_password_token, String
|
43
|
+
end
|
44
|
+
|
45
|
+
# Creates remember_token and remember_created_at.
|
46
|
+
def rememberable
|
47
|
+
apply_schema :remember_token, String
|
48
|
+
apply_schema :remember_created_at, DateTime
|
49
|
+
end
|
50
|
+
|
51
|
+
# Creates sign_in_count, current_sign_in_at, last_sign_in_at,
|
52
|
+
# current_sign_in_ip, last_sign_in_ip.
|
53
|
+
def trackable
|
54
|
+
apply_schema :sign_in_count, Integer, :default => 0
|
55
|
+
apply_schema :current_sign_in_at, DateTime
|
56
|
+
apply_schema :last_sign_in_at, DateTime
|
57
|
+
apply_schema :current_sign_in_ip, String
|
58
|
+
apply_schema :last_sign_in_ip, String
|
59
|
+
end
|
60
|
+
|
61
|
+
# Creates failed_attempts, unlock_token and locked_at
|
62
|
+
def lockable
|
63
|
+
apply_schema :failed_attempts, Integer, :default => 0
|
64
|
+
apply_schema :unlock_token, String
|
65
|
+
apply_schema :locked_at, DateTime
|
66
|
+
end
|
67
|
+
|
68
|
+
# Overwrite with specific modification to create your own schema.
|
69
|
+
def apply_schema(name, type, options={})
|
70
|
+
raise NotImplementedError
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module Devise
|
2
|
+
module Strategies
|
3
|
+
# Base strategy for Devise. Responsible for verifying correct scope and mapping.
|
4
|
+
class Base < ::Warden::Strategies::Base
|
5
|
+
# Checks if a valid scope was given for devise and find mapping based on
|
6
|
+
# this scope.
|
7
|
+
def mapping
|
8
|
+
@mapping ||= begin
|
9
|
+
mapping = Devise.mappings[scope]
|
10
|
+
raise "Could not find mapping for #{scope}" unless mapping
|
11
|
+
mapping
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
require 'devise/strategies/base'
|
2
|
+
|
3
|
+
module Devise
|
4
|
+
module Strategies
|
5
|
+
# Default strategy for signing in a user, based on his email and password.
|
6
|
+
# Redirects to sign_in page if it's not authenticated
|
7
|
+
class DatabaseAuthenticatable < Base
|
8
|
+
def valid?
|
9
|
+
valid_controller? && valid_params? && mapping.to.respond_to?(:authenticate)
|
10
|
+
end
|
11
|
+
|
12
|
+
# Authenticate a user based on email and password params, returning to warden
|
13
|
+
# success and the authenticated user if everything is okay. Otherwise redirect
|
14
|
+
# to sign in page.
|
15
|
+
def authenticate!
|
16
|
+
if resource = mapping.to.authenticate(params[scope])
|
17
|
+
success!(resource)
|
18
|
+
else
|
19
|
+
fail(:invalid)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
protected
|
24
|
+
|
25
|
+
def valid_controller?
|
26
|
+
params[:controller] =~ /sessions$/
|
27
|
+
end
|
28
|
+
|
29
|
+
def valid_params?
|
30
|
+
params[scope] && params[scope][:password].present?
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
Warden::Strategies.add(:database_authenticatable, Devise::Strategies::DatabaseAuthenticatable)
|
@@ -0,0 +1,59 @@
|
|
1
|
+
require 'devise/strategies/base'
|
2
|
+
|
3
|
+
module Devise
|
4
|
+
module Strategies
|
5
|
+
# Sign in an user using HTTP authentication.
|
6
|
+
class HttpAuthenticatable < Base
|
7
|
+
def valid?
|
8
|
+
http_authentication? && mapping.to.respond_to?(:authenticate_with_http)
|
9
|
+
end
|
10
|
+
|
11
|
+
def authenticate!
|
12
|
+
username, password = username_and_password
|
13
|
+
|
14
|
+
if resource = mapping.to.authenticate_with_http(username, password)
|
15
|
+
success!(resource)
|
16
|
+
else
|
17
|
+
custom!([401, custom_headers, [response_body]])
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
private
|
22
|
+
|
23
|
+
def username_and_password
|
24
|
+
decode_credentials(request).split(/:/, 2)
|
25
|
+
end
|
26
|
+
|
27
|
+
def response_body
|
28
|
+
body = "HTTP Basic: Access denied."
|
29
|
+
method = :"to_#{request_format.to_sym}"
|
30
|
+
{}.respond_to?(method) ? { :error => body }.send(method) : body
|
31
|
+
end
|
32
|
+
|
33
|
+
def http_authentication
|
34
|
+
request.env['HTTP_AUTHORIZATION'] ||
|
35
|
+
request.env['X-HTTP_AUTHORIZATION'] ||
|
36
|
+
request.env['X_HTTP_AUTHORIZATION'] ||
|
37
|
+
request.env['REDIRECT_X_HTTP_AUTHORIZATION']
|
38
|
+
end
|
39
|
+
alias :http_authentication? :http_authentication
|
40
|
+
|
41
|
+
def decode_credentials(request)
|
42
|
+
ActiveSupport::Base64.decode64(http_authentication.split(' ', 2).last || '')
|
43
|
+
end
|
44
|
+
|
45
|
+
def custom_headers
|
46
|
+
{
|
47
|
+
"Content-Type" => request_format.to_s,
|
48
|
+
"WWW-Authenticate" => %(Basic realm="#{Devise.http_authentication_realm.gsub(/"/, "")}")
|
49
|
+
}
|
50
|
+
end
|
51
|
+
|
52
|
+
def request_format
|
53
|
+
@request_format ||= Mime::Type.lookup_by_extension(request.template_format.to_s)
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
Warden::Strategies.add(:http_authenticatable, Devise::Strategies::HttpAuthenticatable)
|
@@ -0,0 +1,37 @@
|
|
1
|
+
require 'devise/strategies/base'
|
2
|
+
|
3
|
+
module Devise
|
4
|
+
module Strategies
|
5
|
+
# Remember the user through the remember token. This strategy is responsible
|
6
|
+
# to verify whether there is a cookie with the remember token, and to
|
7
|
+
# recreate the user from this cookie if it exists. Must be called *before*
|
8
|
+
# authenticatable.
|
9
|
+
class Rememberable < Devise::Strategies::Base
|
10
|
+
|
11
|
+
# A valid strategy for rememberable needs a remember token in the cookies.
|
12
|
+
def valid?
|
13
|
+
remember_me_cookie.present? && mapping.to.respond_to?(:serialize_from_cookie)
|
14
|
+
end
|
15
|
+
|
16
|
+
# To authenticate a user we deserialize the cookie and attempt finding
|
17
|
+
# the record in the database. If the attempt fails, we pass to another
|
18
|
+
# strategy handle the authentication.
|
19
|
+
def authenticate!
|
20
|
+
if resource = mapping.to.serialize_from_cookie(remember_me_cookie)
|
21
|
+
success!(resource)
|
22
|
+
else
|
23
|
+
pass
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
private
|
28
|
+
|
29
|
+
# Accessor for remember cookie
|
30
|
+
def remember_me_cookie
|
31
|
+
@remember_me_cookie ||= request.cookies["remember_#{mapping.name}_token"]
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
Warden::Strategies.add(:rememberable, Devise::Strategies::Rememberable)
|
@@ -0,0 +1,37 @@
|
|
1
|
+
require 'devise/strategies/base'
|
2
|
+
|
3
|
+
module Devise
|
4
|
+
module Strategies
|
5
|
+
# Strategy for signing in a user, based on a authenticatable token.
|
6
|
+
# Redirects to sign_in page if it's not authenticated.
|
7
|
+
class TokenAuthenticatable < Base
|
8
|
+
def valid?
|
9
|
+
mapping.to.respond_to?(:authenticate_with_token) && authentication_token(scope).present?
|
10
|
+
end
|
11
|
+
|
12
|
+
# Authenticate a user based on authenticatable token params, returning to warden
|
13
|
+
# success and the authenticated user if everything is okay. Otherwise redirect
|
14
|
+
# to sign in page.
|
15
|
+
def authenticate!
|
16
|
+
if resource = mapping.to.authenticate_with_token(params[scope] || params)
|
17
|
+
success!(resource)
|
18
|
+
else
|
19
|
+
fail!(:invalid_token)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
private
|
24
|
+
|
25
|
+
# Detect authentication token in params: scoped or not.
|
26
|
+
def authentication_token(scope)
|
27
|
+
if params[scope]
|
28
|
+
params[scope][mapping.to.token_authentication_key]
|
29
|
+
else
|
30
|
+
params[mapping.to.token_authentication_key]
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
Warden::Strategies.add(:token_authenticatable, Devise::Strategies::TokenAuthenticatable)
|
@@ -0,0 +1,90 @@
|
|
1
|
+
module Devise
|
2
|
+
module TestHelpers
|
3
|
+
def self.included(base)
|
4
|
+
base.class_eval do
|
5
|
+
setup :setup_controller_for_warden, :warden if respond_to?(:setup)
|
6
|
+
end
|
7
|
+
end
|
8
|
+
|
9
|
+
# This is a Warden::Proxy customized for functional tests. It's meant to
|
10
|
+
# some of Warden::Manager responsibilities, as retrieving configuration
|
11
|
+
# options and calling the FailureApp.
|
12
|
+
class TestWarden < Warden::Proxy #:nodoc:
|
13
|
+
attr_reader :controller
|
14
|
+
|
15
|
+
def initialize(controller)
|
16
|
+
@controller = controller
|
17
|
+
manager = Warden::Manager.new(nil) do |config|
|
18
|
+
Devise.configure_warden(config)
|
19
|
+
end
|
20
|
+
super(controller.request.env, manager)
|
21
|
+
end
|
22
|
+
|
23
|
+
def authenticate!(*args)
|
24
|
+
catch_with_redirect { super }
|
25
|
+
end
|
26
|
+
|
27
|
+
def user(*args)
|
28
|
+
catch_with_redirect { super }
|
29
|
+
end
|
30
|
+
|
31
|
+
def catch_with_redirect(&block)
|
32
|
+
result = catch(:warden, &block)
|
33
|
+
|
34
|
+
if result.is_a?(Hash) && !custom_failure? && !@controller.send(:performed?)
|
35
|
+
result[:action] ||= :unauthenticated
|
36
|
+
|
37
|
+
env = @controller.request.env
|
38
|
+
env["PATH_INFO"] = "/#{result[:action]}"
|
39
|
+
env["warden.options"] = result
|
40
|
+
Warden::Manager._before_failure.each{ |hook| hook.call(env, result) }
|
41
|
+
|
42
|
+
status, headers, body = Devise::FailureApp.call(env).to_a
|
43
|
+
@controller.send :redirect_to, headers["Location"]
|
44
|
+
else
|
45
|
+
result
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
# We need to setup the environment variables and the response in the controller.
|
51
|
+
def setup_controller_for_warden #:nodoc:
|
52
|
+
@request.env['action_controller.rescue.request'] = @request
|
53
|
+
@request.env['action_controller.rescue.response'] = @response
|
54
|
+
@request.env['rack.session'] = session
|
55
|
+
@controller.response = @response
|
56
|
+
end
|
57
|
+
|
58
|
+
# Quick access to Warden::Proxy.
|
59
|
+
def warden #:nodoc:
|
60
|
+
@warden ||= (@request.env['warden'] = TestWarden.new(@controller))
|
61
|
+
end
|
62
|
+
|
63
|
+
# sign_in a given resource by storing its keys in the session.
|
64
|
+
#
|
65
|
+
# Examples:
|
66
|
+
#
|
67
|
+
# sign_in :user, @user # sign_in(scope, resource)
|
68
|
+
# sign_in @user # sign_in(resource)
|
69
|
+
#
|
70
|
+
def sign_in(resource_or_scope, resource=nil)
|
71
|
+
scope ||= Devise::Mapping.find_scope!(resource_or_scope)
|
72
|
+
resource ||= resource_or_scope
|
73
|
+
warden.session_serializer.store(resource, scope)
|
74
|
+
end
|
75
|
+
|
76
|
+
# Sign out a given resource or scope by calling logout on Warden.
|
77
|
+
#
|
78
|
+
# Examples:
|
79
|
+
#
|
80
|
+
# sign_out :user # sign_out(scope)
|
81
|
+
# sign_out @user # sign_out(resource)
|
82
|
+
#
|
83
|
+
def sign_out(resource_or_scope)
|
84
|
+
scope = Devise::Mapping.find_scope!(resource_or_scope)
|
85
|
+
@controller.instance_variable_set(:"@current_#{scope}", nil)
|
86
|
+
warden.logout(scope)
|
87
|
+
end
|
88
|
+
|
89
|
+
end
|
90
|
+
end
|
data/lib/devise.rb
ADDED
@@ -0,0 +1,269 @@
|
|
1
|
+
print "loading lib/devise.rb"
|
2
|
+
|
3
|
+
|
4
|
+
module Devise
|
5
|
+
autoload :FailureApp, 'devise/failure_app'
|
6
|
+
autoload :Models, 'devise/models'
|
7
|
+
autoload :Schema, 'devise/schema'
|
8
|
+
autoload :TestHelpers, 'devise/test_helpers'
|
9
|
+
|
10
|
+
module Controllers
|
11
|
+
autoload :Helpers, 'devise/controllers/helpers'
|
12
|
+
autoload :InternalHelpers, 'devise/controllers/internal_helpers'
|
13
|
+
autoload :UrlHelpers, 'devise/controllers/url_helpers'
|
14
|
+
end
|
15
|
+
|
16
|
+
module Encryptors
|
17
|
+
autoload :Base, 'devise/encryptors/base'
|
18
|
+
autoload :Bcrypt, 'devise/encryptors/bcrypt'
|
19
|
+
autoload :AuthlogicSha512, 'devise/encryptors/authlogic_sha512'
|
20
|
+
autoload :ClearanceSha1, 'devise/encryptors/clearance_sha1'
|
21
|
+
autoload :RestfulAuthenticationSha1, 'devise/encryptors/restful_authentication_sha1'
|
22
|
+
autoload :Sha512, 'devise/encryptors/sha512'
|
23
|
+
autoload :Sha1, 'devise/encryptors/sha1'
|
24
|
+
end
|
25
|
+
|
26
|
+
module Orm
|
27
|
+
autoload :ActiveRecord, 'devise/orm/active_record'
|
28
|
+
autoload :DataMapper, 'devise/orm/data_mapper'
|
29
|
+
autoload :MongoMapper, 'devise/orm/mongo_mapper'
|
30
|
+
end
|
31
|
+
|
32
|
+
ALL = []
|
33
|
+
|
34
|
+
# Authentication ones first
|
35
|
+
ALL.push :database_authenticatable, :http_authenticatable, :token_authenticatable, :rememberable
|
36
|
+
|
37
|
+
# Misc after
|
38
|
+
ALL.push :recoverable, :registerable, :validatable
|
39
|
+
|
40
|
+
# The ones which can sign out after
|
41
|
+
ALL.push :activatable, :confirmable, :lockable, :timeoutable
|
42
|
+
|
43
|
+
# Stats for last, so we make sure the user is really signed in
|
44
|
+
ALL.push :trackable
|
45
|
+
|
46
|
+
# Maps controller names to devise modules.
|
47
|
+
CONTROLLERS = {
|
48
|
+
:sessions => [:database_authenticatable, :token_authenticatable],
|
49
|
+
:passwords => [:recoverable],
|
50
|
+
:confirmations => [:confirmable],
|
51
|
+
:registrations => [:registerable],
|
52
|
+
:unlocks => [:lockable]
|
53
|
+
}
|
54
|
+
|
55
|
+
# Routes for generating url helpers.
|
56
|
+
ROUTES = [:session, :password, :confirmation, :registration, :unlock]
|
57
|
+
|
58
|
+
STRATEGIES = [:rememberable, :http_authenticatable, :token_authenticatable, :database_authenticatable]
|
59
|
+
|
60
|
+
TRUE_VALUES = [true, 1, '1', 't', 'T', 'true', 'TRUE']
|
61
|
+
|
62
|
+
# Maps the messages types that are used in flash message.
|
63
|
+
FLASH_MESSAGES = [:unauthenticated, :unconfirmed, :invalid, :invalid_token, :timeout, :inactive, :locked]
|
64
|
+
|
65
|
+
# Declare encryptors length which are used in migrations.
|
66
|
+
ENCRYPTORS_LENGTH = {
|
67
|
+
:sha1 => 40,
|
68
|
+
:sha512 => 128,
|
69
|
+
:clearance_sha1 => 40,
|
70
|
+
:restful_authentication_sha1 => 40,
|
71
|
+
:authlogic_sha512 => 128,
|
72
|
+
:bcrypt => 60
|
73
|
+
}
|
74
|
+
|
75
|
+
# Email regex used to validate email formats. Adapted from authlogic.
|
76
|
+
EMAIL_REGEX = /^([\w\.%\+\-]+)@([\w\-]+\.)+([\w]{2,})$/i
|
77
|
+
|
78
|
+
# Used to encrypt password. Please generate one with rake secret.
|
79
|
+
mattr_accessor :pepper
|
80
|
+
@@pepper = nil
|
81
|
+
|
82
|
+
# The number of times to encrypt password.
|
83
|
+
mattr_accessor :stretches
|
84
|
+
@@stretches = 10
|
85
|
+
|
86
|
+
# Keys used when authenticating an user.
|
87
|
+
mattr_accessor :authentication_keys
|
88
|
+
@@authentication_keys = [ :email ]
|
89
|
+
|
90
|
+
# Time interval where the remember me token is valid.
|
91
|
+
mattr_accessor :remember_for
|
92
|
+
@@remember_for = 2.weeks
|
93
|
+
|
94
|
+
# Time interval you can access your account before confirming your account.
|
95
|
+
mattr_accessor :confirm_within
|
96
|
+
@@confirm_within = 0.days
|
97
|
+
|
98
|
+
# Time interval to timeout the user session without activity.
|
99
|
+
mattr_accessor :timeout_in
|
100
|
+
@@timeout_in = 30.minutes
|
101
|
+
|
102
|
+
# Used to define the password encryption algorithm.
|
103
|
+
mattr_accessor :encryptor
|
104
|
+
@@encryptor = :sha1
|
105
|
+
|
106
|
+
# Store scopes mappings.
|
107
|
+
mattr_accessor :mappings
|
108
|
+
@@mappings = ActiveSupport::OrderedHash.new
|
109
|
+
|
110
|
+
# Stores the chosen ORM.
|
111
|
+
mattr_accessor :orm
|
112
|
+
@@orm = :active_record
|
113
|
+
|
114
|
+
# TODO Remove
|
115
|
+
mattr_accessor :all
|
116
|
+
@@all = []
|
117
|
+
|
118
|
+
# Tells if devise should apply the schema in ORMs where devise declaration
|
119
|
+
# and schema belongs to the same class (as Datamapper and MongoMapper).
|
120
|
+
mattr_accessor :apply_schema
|
121
|
+
@@apply_schema = true
|
122
|
+
|
123
|
+
# Scoped views. Since it relies on fallbacks to render default views, it's
|
124
|
+
# turned off by default.
|
125
|
+
mattr_accessor :scoped_views
|
126
|
+
@@scoped_views = false
|
127
|
+
|
128
|
+
# Number of authentication tries before locking an account
|
129
|
+
mattr_accessor :maximum_attempts
|
130
|
+
@@maximum_attempts = 20
|
131
|
+
|
132
|
+
# Defines which strategy can be used to unlock an account.
|
133
|
+
# Values: :email, :time, :both
|
134
|
+
mattr_accessor :unlock_strategy
|
135
|
+
@@unlock_strategy = :both
|
136
|
+
|
137
|
+
# Time interval to unlock the account if :time is defined as unlock_strategy.
|
138
|
+
mattr_accessor :unlock_in
|
139
|
+
@@unlock_in = 1.hour
|
140
|
+
|
141
|
+
# Tell when to use the default scope, if one cannot be found from routes.
|
142
|
+
mattr_accessor :use_default_scope
|
143
|
+
@@use_default_scope = false
|
144
|
+
|
145
|
+
# The default scope which is used by warden.
|
146
|
+
mattr_accessor :default_scope
|
147
|
+
@@default_scope = nil
|
148
|
+
|
149
|
+
# Address which sends Devise e-mails.
|
150
|
+
mattr_accessor :mailer_sender
|
151
|
+
@@mailer_sender = nil
|
152
|
+
|
153
|
+
# Content Type of Devise e-mails.
|
154
|
+
mattr_accessor :mailer_content_type
|
155
|
+
@@mailer_content_type = 'text/html'
|
156
|
+
|
157
|
+
# Authentication token params key name of choice. E.g. /users/sign_in?some_key=...
|
158
|
+
mattr_accessor :token_authentication_key
|
159
|
+
@@token_authentication_key = :auth_token
|
160
|
+
|
161
|
+
# The realm used in Http Basic Authentication
|
162
|
+
mattr_accessor :http_authentication_realm
|
163
|
+
@@http_authentication_realm = "Application"
|
164
|
+
|
165
|
+
class << self
|
166
|
+
# Default way to setup Devise. Run script/generate devise_install to create
|
167
|
+
# a fresh initializer with all configuration values.
|
168
|
+
def setup
|
169
|
+
yield self
|
170
|
+
end
|
171
|
+
|
172
|
+
# Sets warden configuration using a block that will be invoked on warden
|
173
|
+
# initialization.
|
174
|
+
#
|
175
|
+
# Devise.initialize do |config|
|
176
|
+
# config.confirm_within = 2.days
|
177
|
+
#
|
178
|
+
# config.warden do |manager|
|
179
|
+
# # Configure warden to use other strategies, like oauth.
|
180
|
+
# manager.oauth(:twitter)
|
181
|
+
# end
|
182
|
+
# end
|
183
|
+
def warden(&block)
|
184
|
+
@warden_config = block
|
185
|
+
end
|
186
|
+
|
187
|
+
# Configure default url options to be used within Devise and ActionController.
|
188
|
+
def default_url_options(&block)
|
189
|
+
who = Devise::Mapping.respond_to?(:singleton_class) ?
|
190
|
+
Devise::Mapping.singleton_class : Devise::Mapping.metaclass
|
191
|
+
who.send :define_method, :default_url_options, &block
|
192
|
+
end
|
193
|
+
|
194
|
+
# A method used internally to setup warden manager from the Rails initialize
|
195
|
+
# block.
|
196
|
+
def configure_warden(config) #:nodoc:
|
197
|
+
config.default_strategies *Devise::STRATEGIES
|
198
|
+
config.failure_app = Devise::FailureApp
|
199
|
+
config.silence_missing_strategies!
|
200
|
+
config.default_scope = Devise.default_scope
|
201
|
+
|
202
|
+
# If the user provided a warden hook, call it now.
|
203
|
+
@warden_config.try :call, config
|
204
|
+
end
|
205
|
+
|
206
|
+
# The class of the configured ORM
|
207
|
+
def orm_class
|
208
|
+
Devise::Orm.const_get(@@orm.to_s.camelize.to_sym)
|
209
|
+
end
|
210
|
+
|
211
|
+
# Generate a friendly string randomically to be used as token.
|
212
|
+
def friendly_token
|
213
|
+
ActiveSupport::SecureRandom.base64(15).tr('+/=', '-_ ').strip.delete("\n")
|
214
|
+
end
|
215
|
+
|
216
|
+
# Make Devise aware of an 3rd party Devise-module. For convenience.
|
217
|
+
#
|
218
|
+
# == Options:
|
219
|
+
#
|
220
|
+
# +strategy+ - Boolean value representing if this module got a custom *strategy*.
|
221
|
+
# Default is +false+. Note: Devise will auto-detect this in such case if this is true.
|
222
|
+
# +model+ - String representing a load path to a custom *model* for this module (to autoload).
|
223
|
+
# Default is +nil+ (i.e. +false+).
|
224
|
+
# +controller+ - Symbol representing a name of an exisiting or custom *controller* for this module.
|
225
|
+
# Default is +nil+ (i.e. +false+).
|
226
|
+
# +route+ - Symbol representing the name of a *route* related to this module which a set of
|
227
|
+
# route view helpers should be created for.
|
228
|
+
# Default is +nil+ (i.e. +false+).
|
229
|
+
#
|
230
|
+
# == Examples:
|
231
|
+
#
|
232
|
+
# Devise.add_module(:party_module)
|
233
|
+
# Devise.add_module(:party_module, :strategy => true, :controller => :sessions)
|
234
|
+
# Devise.add_module(:party_module, :model => 'party_module/model')
|
235
|
+
#
|
236
|
+
def add_module(module_name, options = {})
|
237
|
+
Devise::ALL << module_name unless Devise::ALL.include?(module_name)
|
238
|
+
Devise::STRATEGIES.unshift module_name if options[:strategy] && !Devise::STRATEGIES.include?(module_name)
|
239
|
+
|
240
|
+
if options[:controller]
|
241
|
+
controller = options[:controller].to_sym
|
242
|
+
Devise::CONTROLLERS[controller] ||= []
|
243
|
+
Devise::CONTROLLERS[controller].unshift module_name unless Devise::CONTROLLERS[controller].include?(module_name)
|
244
|
+
end
|
245
|
+
|
246
|
+
if options[:route]
|
247
|
+
Devise::ROUTES.unshift options[:route] unless Devise::ROUTES.include?(options[:route])
|
248
|
+
end
|
249
|
+
|
250
|
+
if options[:model]
|
251
|
+
Devise::Models.module_eval do
|
252
|
+
autoload :"#{module_name.to_s.classify}", options[:model]
|
253
|
+
end
|
254
|
+
end
|
255
|
+
|
256
|
+
Devise::Mapping.register module_name
|
257
|
+
end
|
258
|
+
end
|
259
|
+
end
|
260
|
+
|
261
|
+
begin
|
262
|
+
require 'warden'
|
263
|
+
rescue
|
264
|
+
gem 'warden'
|
265
|
+
require 'warden'
|
266
|
+
end
|
267
|
+
|
268
|
+
require 'devise/mapping'
|
269
|
+
require 'devise/rails'
|
@@ -0,0 +1,11 @@
|
|
1
|
+
namespace :devise_ennder do
|
2
|
+
desc "Synchronise les migrations du plugin devise_ennder vers l'appli"
|
3
|
+
task :sync_migrations do
|
4
|
+
system "rsync -ruv vendor/plugins/devise_ennder/db/migrate db"
|
5
|
+
end
|
6
|
+
|
7
|
+
desc "Synchronise le modèle user du plugin devise_ennder vers l'appli"
|
8
|
+
task :sync_user_model do
|
9
|
+
system "rsync -ruv vendor/plugins/devise_ennder/app/models/user.rb app/models"
|
10
|
+
end
|
11
|
+
end
|