devise 1.1.rc1 → 1.1.rc2

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of devise might be problematic. Click here for more details.

Files changed (93) hide show
  1. data/CHANGELOG.rdoc +63 -27
  2. data/Gemfile +15 -13
  3. data/README.rdoc +63 -51
  4. data/Rakefile +3 -2
  5. data/TODO +1 -0
  6. data/app/controllers/devise/registrations_controller.rb +1 -1
  7. data/app/mailers/devise/mailer.rb +43 -43
  8. data/app/views/devise/confirmations/new.html.erb +2 -2
  9. data/app/views/devise/passwords/edit.html.erb +4 -4
  10. data/app/views/devise/passwords/new.html.erb +2 -2
  11. data/app/views/devise/registrations/edit.html.erb +8 -8
  12. data/app/views/devise/registrations/new.html.erb +6 -6
  13. data/app/views/devise/sessions/new.html.erb +4 -4
  14. data/app/views/devise/unlocks/new.html.erb +2 -2
  15. data/config/locales/en.yml +7 -4
  16. data/lib/devise.rb +33 -6
  17. data/lib/devise/controllers/helpers.rb +38 -2
  18. data/lib/devise/encryptors/authlogic_sha512.rb +0 -2
  19. data/lib/devise/encryptors/bcrypt.rb +0 -2
  20. data/lib/devise/encryptors/clearance_sha1.rb +0 -2
  21. data/lib/devise/encryptors/sha1.rb +6 -8
  22. data/lib/devise/encryptors/sha512.rb +6 -8
  23. data/lib/devise/failure_app.rb +3 -2
  24. data/lib/devise/hooks/activatable.rb +4 -1
  25. data/lib/devise/hooks/forgetable.rb +4 -3
  26. data/lib/devise/hooks/rememberable.rb +6 -2
  27. data/lib/devise/hooks/timeoutable.rb +6 -2
  28. data/lib/devise/mapping.rb +7 -8
  29. data/lib/devise/models.rb +0 -34
  30. data/lib/devise/models/authenticatable.rb +29 -3
  31. data/lib/devise/models/confirmable.rb +3 -2
  32. data/lib/devise/models/database_authenticatable.rb +4 -2
  33. data/lib/devise/models/lockable.rb +1 -1
  34. data/lib/devise/models/recoverable.rb +1 -1
  35. data/lib/devise/models/rememberable.rb +9 -1
  36. data/lib/devise/orm/active_record.rb +4 -6
  37. data/lib/devise/orm/data_mapper.rb +5 -7
  38. data/lib/devise/orm/mongoid.rb +2 -13
  39. data/lib/devise/path_checker.rb +13 -0
  40. data/lib/devise/rails.rb +45 -18
  41. data/lib/devise/rails/routes.rb +24 -7
  42. data/lib/devise/schema.rb +23 -19
  43. data/lib/devise/strategies/authenticatable.rb +20 -4
  44. data/lib/devise/strategies/database_authenticatable.rb +1 -1
  45. data/lib/devise/strategies/token_authenticatable.rb +2 -2
  46. data/lib/devise/test_helpers.rb +2 -1
  47. data/lib/devise/version.rb +1 -1
  48. data/lib/generators/devise/devise/devise_generator.rb +86 -0
  49. data/lib/generators/devise/{templates → devise/templates}/migration.rb +2 -2
  50. data/lib/generators/devise/install/install_generator.rb +24 -0
  51. data/lib/generators/{devise_install → devise/install}/templates/README +1 -1
  52. data/lib/generators/{devise_install → devise/install}/templates/devise.rb +37 -18
  53. data/lib/generators/devise/views/views_generator.rb +63 -0
  54. data/lib/generators/devise_generator.rb +2 -0
  55. data/lib/generators/devise_install_generator.rb +4 -0
  56. data/lib/generators/devise_views_generator.rb +4 -0
  57. data/test/controllers/helpers_test.rb +15 -0
  58. data/test/devise_test.rb +1 -0
  59. data/test/failure_app_test.rb +25 -10
  60. data/test/integration/authenticatable_test.rb +279 -0
  61. data/test/integration/database_authenticatable_test.rb +2 -262
  62. data/test/integration/http_authenticatable_test.rb +7 -9
  63. data/test/integration/registerable_test.rb +14 -2
  64. data/test/integration/rememberable_test.rb +15 -3
  65. data/test/integration/timeoutable_test.rb +12 -0
  66. data/test/integration/token_authenticatable_test.rb +2 -3
  67. data/test/mailers/confirmation_instructions_test.rb +2 -2
  68. data/test/mailers/reset_password_instructions_test.rb +2 -2
  69. data/test/mailers/unlock_instructions_test.rb +3 -3
  70. data/test/models/confirmable_test.rb +16 -0
  71. data/test/models/database_authenticatable_test.rb +20 -20
  72. data/test/models/lockable_test.rb +1 -1
  73. data/test/models/rememberable_test.rb +4 -4
  74. data/test/orm/data_mapper.rb +9 -0
  75. data/test/rails_app/app/active_record/shim.rb +2 -0
  76. data/test/rails_app/app/controllers/application_controller.rb +1 -0
  77. data/test/rails_app/app/controllers/home_controller.rb +3 -0
  78. data/test/rails_app/app/controllers/users_controller.rb +2 -0
  79. data/test/rails_app/app/data_mapper/shim.rb +2 -0
  80. data/test/rails_app/app/data_mapper/user.rb +4 -5
  81. data/test/rails_app/app/mongoid/admin.rb +1 -10
  82. data/test/rails_app/app/mongoid/shim.rb +16 -0
  83. data/test/rails_app/app/mongoid/user.rb +1 -12
  84. data/test/rails_app/config/application.rb +2 -0
  85. data/test/rails_app/config/initializers/devise.rb +2 -2
  86. data/test/rails_app/config/routes.rb +6 -1
  87. data/test/routes_test.rb +2 -2
  88. data/test/test_helper.rb +0 -4
  89. data/test/test_helpers_test.rb +1 -0
  90. metadata +113 -12
  91. data/lib/generators/devise/devise_generator.rb +0 -67
  92. data/lib/generators/devise_install/devise_install_generator.rb +0 -25
  93. data/lib/generators/devise_views/devise_views_generator.rb +0 -62
@@ -1,34 +1,70 @@
1
- == 1.1.rc1
2
-
3
- * enhancements
4
- * Rails 3 compatibility.
5
- * All controllers and views are namespaced, for example: Devise::SessionsController and "devise/sessions".
6
- * Devise.orm is deprecated. This reduces the required API to hook your ORM with devise.
7
- * Use metal for failure app.
8
- * HTML e-mails now have proper formatting.
9
- * Do not remove options from Datamapper and MongoMapper in find.
10
- * Allow to give :skip and :controllers in routes.
11
- * Move trackable logic to the model.
12
- * E-mails now use any template available in the filesystem. Easy to create multipart e-mails.
13
- * E-mails asks headers_for in the model to set the proper headers.
14
- * Allow to specify haml in devise_views.
15
- * Compatibility with Datamapper and Mongoid.
16
- * Make config.devise available on config/application.rb.
17
- * TokenAuthenticatable now works with HTTP Basic Auth.
18
- * Allow :unlock_strategy to be :none and add :lock_strategy which can be :failed_attempts or none. Setting those values to :none means that you want to handle lock and unlocking by yourself.
19
- * No need to append ?unauthenticated=true in URLs anymore since Flash was moved to a middleware in Rails 3.
20
- * :activatable is included by default in your models.
1
+ == 1.1.rc2
2
+
3
+ * enhancements
4
+ * Allow to set cookie domain for the remember token. (by github.com/mantas)
5
+ * Added navigational formats to specify when it should return a 302 and when a 401.
6
+ * Added authenticate(scope) support in routes (by github.com/wildchild)
7
+ * Added after_update_path_for to registrations controller (by github.com/thedelchop)
8
+ * Allow the mailer object to be replaced through config.mailer = "MyOwnMailer"
9
+
10
+ * bug fix
11
+ * Fix a bug where session was timing out on sign out
12
+
13
+ * deprecations
14
+ * bcrypt is now the default encryptor
15
+ * devise.mailer.confirmations_instructions now should be devise.mailer.confirmations_instructions.subject
16
+ * devise.mailer.user.confirmations_instructions now should be devise.mailer.confirmations_instructions.user_subject
17
+ * Generators now use Rails 3 syntax (devise:install) instead of devise_install
18
+
19
+ == 1.1.rc
20
+
21
+ * enhancements
22
+ * Rails 3 compatibility
23
+ * All controllers and views are namespaced, for example: Devise::SessionsController and "devise/sessions"
24
+ * Devise.orm is deprecated. This reduces the required API to hook your ORM with devise
25
+ * Use metal for failure app
26
+ * HTML e-mails now have proper formatting
27
+ * Allow to give :skip and :controllers in routes
28
+ * Move trackable logic to the model
29
+ * E-mails now use any template available in the filesystem. Easy to create multipart e-mails
30
+ * E-mails asks headers_for in the model to set the proper headers
31
+ * Allow to specify haml in devise_views
32
+ * Compatibility with Datamapper and Mongoid
33
+ * Make config.devise available on config/application.rb
34
+ * TokenAuthenticatable now works with HTTP Basic Auth
35
+ * Allow :unlock_strategy to be :none and add :lock_strategy which can be :failed_attempts or none. Setting those values to :none means that you want to handle lock and unlocking by yourself
36
+ * No need to append ?unauthenticated=true in URLs anymore since Flash was moved to a middleware in Rails 3
37
+ * :activatable is included by default in your models
38
+
39
+ * bug fix
40
+ * Fix a bug with STI
41
+
42
+ * deprecations
43
+ * Rails 3 compatible only
44
+ * Removed support for MongoMapper
45
+ * Scoped views are no longer "sessions/users/new". Now use "users/sessions/new"
46
+ * Devise.orm is deprecated, just require "devise/orm/YOUR_ORM" instead
47
+ * Devise.default_url_options is deprecated, just modify ApplicationController.default_url_options
48
+ * All messages under devise.sessions, except :signed_in and :signed_out, should be moved to devise.failure
49
+ * :as and :scope in routes is deprecated. Use :path and :singular instead
50
+
51
+ == 1.0.8
52
+
53
+ * enhancements
54
+ * Support for latest MongoMapper
55
+ * Added anybody_signed_in? helper (by github.com/SSDany)
56
+
57
+ * bug fix
58
+ * confirmation_required? is properly honored on active? calls. (by github.com/paulrosania)
59
+
60
+ == 1.0.7
21
61
 
22
62
  * bug fix
23
- * fix a bug with STI
63
+ * Ensure password confirmation is always required
24
64
 
25
65
  * deprecations
26
- * Rails 3 compatible only.
27
- * Scoped views are no longer "sessions/users/new". Now use "users/sessions/new".
28
- * Devise.orm is deprecated, just require "devise/orm/YOUR_ORM" instead.
29
- * Devise.default_url_options is deprecated, just modify ApplicationController.default_url_options.
30
- * All messages under devise.sessions, except :signed_in and :signed_out, should be moved to devise.failure.
31
- * :as and :scope in routes is deprecated. Use :path and :singular instead.
66
+ * authenticatable was deprecated and renamed to database_authenticatable
67
+ * confirmable is not included by default on generation
32
68
 
33
69
  == 1.0.6
34
70
 
data/Gemfile CHANGED
@@ -1,10 +1,10 @@
1
- source "http://gemcutter.org"
1
+ source "http://rubygems.org"
2
2
 
3
3
  # Need to install Rails from source
4
- gem "rails", "3.0.0.beta3"
5
- gem "warden", "0.10.3"
6
- gem "sqlite3-ruby", :require => "sqlite3"
7
- gem "webrat", "0.7"
4
+ gem "rails", "3.0.0.beta4"
5
+ gem "warden", "0.10.7"
6
+ gem "sqlite3-ruby"
7
+ gem "webrat", "0.7.0"
8
8
  gem "mocha", :require => false
9
9
  gem "bcrypt-ruby", :require => "bcrypt"
10
10
 
@@ -13,15 +13,17 @@ if RUBY_VERSION < '1.9'
13
13
  end
14
14
 
15
15
  group :mongoid do
16
- gem "mongo", ">= 0.18.3"
17
- gem "mongo_ext", ">= 0.18.3", :require => false
16
+ gem "mongo"
18
17
  gem "mongoid", :git => "git://github.com/durran/mongoid.git"
18
+ gem "bson_ext"
19
19
  end
20
20
 
21
21
  group :data_mapper do
22
- gem "do_sqlite3", '>= 0.10.1'
23
- gem "dm-core", :git => "git://github.com/datamapper/dm-core.git"
24
- gem "dm-validations", :git => "git://github.com/datamapper/dm-more.git"
25
- gem "dm-timestamps", :git => "git://github.com/datamapper/dm-more.git"
26
- gem "dm-rails", :git => "git://github.com/datamapper/dm-rails.git"
27
- end
22
+ gem 'dm-core', '~> 1.0.0', :git => 'git://github.com/datamapper/dm-core'
23
+ gem 'dm-migrations', '~> 1.0.0', :git => 'git://github.com/datamapper/dm-migrations'
24
+ gem 'dm-sqlite-adapter', '~> 1.0.0', :git => 'git://github.com/datamapper/dm-sqlite-adapter'
25
+ gem 'dm-validations', '~> 1.0.0', :git => 'git://github.com/datamapper/dm-validations'
26
+ gem 'dm-serializer', '~> 1.0.0', :git => 'git://github.com/datamapper/dm-serializer'
27
+ gem 'dm-timestamps', '~> 1.0.0', :git => 'git://github.com/datamapper/dm-timestamps'
28
+ gem 'dm-rails', '~> 1.0.0', :git => 'git://github.com/datamapper/dm-rails'
29
+ end
@@ -13,53 +13,74 @@ Right now it's composed of 11 modules:
13
13
  * Token Authenticatable: signs in an user based on an authentication token (also known as "single access token"). The token can be given both through query string or HTTP Basic Authentication.
14
14
  * Confirmable: sends emails with confirmation instructions and verifies whether an account is already confirmed during sign in.
15
15
  * Recoverable: resets the user password and sends reset instructions.
16
- * Registerable: handles signing up users through a registration process.
16
+ * Registerable: handles signing up users through a registration process, also allowing them to edit and destroy their account.
17
17
  * Rememberable: manages generating and clearing a token for remembering the user from a saved cookie.
18
18
  * Trackable: tracks sign in count, timestamps and IP address.
19
19
  * Timeoutable: expires sessions that have no activity in a specified period of time.
20
20
  * Validatable: provides validations of email and password. It's optional and can be customized, so you're able to define your own validations.
21
21
  * Lockable: locks an account after a specified number of failed sign-in attempts. Can unlock via email or after a specified time period.
22
22
 
23
- == Examples
23
+ == Installation
24
24
 
25
- * Example application using Devise at http://github.com/plataformatec/devise_example
26
- * Example Rails 2.3 web app combining subdomains with Devise at http://github.com/fortuity/subdomain-authentication
25
+ === Rails 3 beta 4
27
26
 
28
- == Dependencies
27
+ To use Devise with Rails 3 beta 4, please use it straight from the git repository, by adding it to your Gemfile:
29
28
 
30
- Devise is based on Warden (http://github.com/hassox/warden), a Rack Authentication Framework. You need to install Warden as a gem. Please ensure you have it installed in order to use Devise (see installation below).
29
+ gem "devise", :git => "git://github.com/plataformatec/devise.git"
31
30
 
32
- == Installation
31
+ Then follow the same steps as below.
32
+
33
+ === Rails 3 beta 3
33
34
 
34
35
  Devise master branch now supports Rails 3 and is NOT backward compatible. You can use the latest Rails 3 beta gem with Devise latest gem:
35
36
 
36
- sudo gem install devise --version=1.1.rc1
37
+ gem install devise --version=1.1.rc1
37
38
 
38
39
  After you install Devise and add it to your Gemfile, you need to run the generator:
39
40
 
40
- rails generate devise_install
41
+ rails generate devise:install
41
42
 
42
- And you're ready to go. The generator will install an initializer which describes ALL Devise's configuration options, so be sure to take a look at it and at the documentation as well:
43
+ The generator will install an initializer which describes ALL Devise's configuration options and you MUST take a look at it. When you are done, you are ready to add Devise to any of your models using the generator:
43
44
 
44
- http://rdoc.info/projects/plataformatec/devise
45
+ rails generate devise MODEL
45
46
 
46
- The documentation above is for Rails 3. If you want to consult the documentation for Rails 2.3, you need to start `gem server` in your own machine. Finally, another good resource for information, is the wiki:
47
+ Replace MODEL by the class name you want to add devise, like User, Admin, etc. This will create a model (if one does not exist) and configure it with default Devise modules. The generator will also create a migration file (if your ORM support them) and configure your routes. Continue reading this file to understand exactly what the generator produces and how to use it.
47
48
 
48
- http://wiki.github.com/plataformatec/devise
49
-
50
- == Rails 2.3
49
+ === Rails 2.3
51
50
 
52
51
  If you want to use the Rails 2.3.x version, you should do:
53
52
 
54
- sudo gem install devise --version=1.0.6
53
+ gem install devise --version=1.0.7
55
54
 
56
- Or checkout from the v1.0 branch:
55
+ And please check the README at the v1.0 branch since this one is based on Rails 3:
57
56
 
58
57
  http://github.com/plataformatec/devise/tree/v1.0
59
58
 
59
+ == Ecosystem
60
+
61
+ Devise ecosystem is growing solid day after day. If you just need a walkthrough about setting up Devise, this README will work great. But if you need more documentation and resources, please check both the wiki and rdoc:
62
+
63
+ * http://rdoc.info/projects/plataformatec/devise
64
+ * http://wiki.github.com/plataformatec/devise
65
+
66
+ Both links above are for Devise with Rails 3. If you need to use Devise with Rails 2.3, you can always run `gem server` from the command line after you install the gem to access the old documentation.
67
+
68
+ Another great way to learn Devise are Ryan Bates' screencasts:
69
+
70
+ * http://railscasts.com/episodes/209-introducing-devise
71
+ * http://railscasts.com/episodes/210-customizing-devise
72
+
73
+ And a few example applications:
74
+
75
+ * Rails 2.3 app using Devise at http://github.com/plataformatec/devise_example
76
+ * Rails 2.3 app using Devise with subdomains at http://github.com/fortuity/subdomain-authentication
77
+ * Rails 3.0 app with Mongoid at http://github.com/fortuity/rails3-mongoid-devise
78
+
79
+ Finally, Devise also has several extensions built by the community. Don't forget to check them at the end of this README. If you want to write an extension on your own, you should also check Warden (http://github.com/hassox/warden), a Rack Authentication Framework which Devise depends on.
80
+
60
81
  == Basic Usage
61
82
 
62
- This is a walkthrough with all steps you need to setup a devise resource, including model, migration, route files, and optional configuration. You MUST also check out the *Generators* section below to help you start.
83
+ This is a walkthrough with all steps you need to setup a devise resource, including model, migration, route files, and optional configuration.
63
84
 
64
85
  Devise must be set up within the model (or models) you want to use. Devise routes must be created inside your config/routes.rb file.
65
86
 
@@ -88,13 +109,13 @@ Configure your routes after setting up your model. Open your config/routes.rb fi
88
109
 
89
110
  This will use your User model to create a set of needed routes (you can see them by running `rake routes`).
90
111
 
91
- Options for configuring your routes include :class_name (to set the class for that route), :path_prefix, :as and :path_names, where the last two have the same meaning as in common routes. The available :path_names are:
112
+ Options for configuring your routes include :class_name (to set the class for that route), :path_prefix, :path and :path_names, where the last two have the same meaning as in common routes. The available :path_names are:
92
113
 
93
- devise_for :users, :as => "usuarios", :path_names => { :sign_in => 'login', :sign_out => 'logout', :sign_up => 'register', :password => 'secret', :confirmation => 'verification', :unlock => 'unblock' }
114
+ devise_for :users, :path => "usuarios", :path_names => { :sign_in => 'login', :sign_out => 'logout', :password => 'secret', :confirmation => 'verification', :unlock => 'unblock', :registration => 'register', :sign_up => 'cmon_let_me_in' }
94
115
 
95
116
  Be sure to check devise_for documentation for details.
96
117
 
97
- After creating your models and routes, run your migrations, and you are ready to go! But don't stop reading here, we still have a lot to tell you:
118
+ This exactly what the devise generator produces for you: model, routes and migrations. Don't forget to run rake db:migrate and you are ready to go! But don't stop reading here, we still have a lot to tell you.
98
119
 
99
120
  == Controller filters and helpers
100
121
 
@@ -133,13 +154,14 @@ Devise allows you to set up as many roles as you want. For example, you may have
133
154
  t.database_authenticatable
134
155
  t.lockable
135
156
  t.trackable
157
+ t.timestamps
136
158
  end
137
159
 
138
160
  # Inside your Admin model
139
161
  devise :database_authenticatable, :trackable, :timeoutable, :lockable
140
162
 
141
163
  # Inside your routes
142
- devise_for :admin
164
+ devise_for :admins
143
165
 
144
166
  # Inside your protected controller
145
167
  before_filter :authenticate_admin!
@@ -149,27 +171,13 @@ Devise allows you to set up as many roles as you want. For example, you may have
149
171
  current_admin
150
172
  admin_session
151
173
 
152
- == Generators
153
-
154
- Devise has generators to help you get started:
155
-
156
- rails generate devise_install
157
-
158
- This will generate an initializer, with a description of all configuration values.
159
-
160
- You can also generate models:
161
-
162
- rails generate devise Model
163
-
164
- This will create a model named "Model" configured with default Devise modules and attr_accessible set for default fields. The generator will also create the migration and configure your routes for Devise.
165
-
166
174
  == Model configuration
167
175
 
168
176
  The devise method in your models also accepts some options to configure its modules. For example, you can choose which encryptor to use in database_authenticatable:
169
177
 
170
178
  devise :database_authenticatable, :confirmable, :recoverable, :encryptor => :bcrypt
171
179
 
172
- Besides :encryptor, you can define :pepper, :stretches, :confirm_within, :remember_for, :timeout_in, :unlock_in and other values. For details, see the initializer file that was created when you invoked the devise_install generator described above.
180
+ Besides :encryptor, you can define :pepper, :stretches, :confirm_within, :remember_for, :timeout_in, :unlock_in and other values. For details, see the initializer file that was created when you invoked the "devise:install" generator described above.
173
181
 
174
182
  == Configuring views
175
183
 
@@ -177,7 +185,7 @@ We built Devise to help you quickly develop an application that uses authenticat
177
185
 
178
186
  Since Devise is an engine, all its views are packaged inside the gem. These views will help you get started, but after sometime you may want to change them. If this is the case, you just need to invoke the following generator, and it will copy all views to your application:
179
187
 
180
- rails generate devise_views
188
+ rails generate devise:views
181
189
 
182
190
  However, if you have more than one role in your application (such as "User" and "Admin"), you will notice that Devise uses the same views for all roles. Fortunately, Devise offers an easy way to customize views. All you need to do is set "config.scoped_views = true" inside "config/initializers/devise.rb".
183
191
 
@@ -257,6 +265,20 @@ Devise implements encryption strategies for Clearance, Authlogic and Restful-Aut
257
265
 
258
266
  Devise supports ActiveRecord (by default) and Mongoid. We offer experimental Datamapper support (with the limitation that the Devise test suite does not run completely with Datamapper). To choose other ORM, you just need to configure it in the initializer file.
259
267
 
268
+ == Extensions
269
+
270
+ Devise also has extensions created by the community:
271
+
272
+ * http://github.com/scambra/devise_invitable adds support to Devise for sending invitations by email.
273
+
274
+ * http://github.com/grimen/devise_facebook_connectable adds support for Facebook Connect authentication, and optionally fetching user info from Facebook in the same step.
275
+
276
+ * http://github.com/joshk/devise_imapable adds support for imap based authentication, excellent for internal apps when an LDAP server isn't available.
277
+
278
+ * http://github.com/cschiewek/devise_ldap_authenticatable adds support for LDAP authentication via simple bind.
279
+
280
+ Please consult their respective documentation for more information and requirements.
281
+
260
282
  == TODO
261
283
 
262
284
  Please refer to TODO file.
@@ -268,15 +290,9 @@ Please refer to TODO file.
268
290
 
269
291
  == Contributors
270
292
 
271
- We have a long list of valued contributors. See the CHANGELOG or do `git shortlog -s -n` in the cloned repository.
272
-
273
- == Devise extensions
293
+ We have a long list of valued contributors. Check them all at:
274
294
 
275
- * http://github.com/scambra/devise_invitable adds support to Devise for sending invitations by email.
276
-
277
- * http://github.com/grimen/devise_facebook_connectable adds support for Facebook Connect authentication, and optionally fetching user info from Facebook in the same step.
278
-
279
- * http://github.com/joshk/devise_imapable adds support for imap based authentication, excellent for internal apps when an LDAP server isn't available.
295
+ http://github.com/plataformatec/devise/contributors
280
296
 
281
297
  == Bugs and Feedback
282
298
 
@@ -288,10 +304,6 @@ For support, send an e-mail to the mailing list.
288
304
 
289
305
  http://groups.google.com/group/plataformatec-devise
290
306
 
291
- See the wiki for additional documentation and support.
292
-
293
- http://wiki.github.com/plataformatec/devise
294
-
295
307
  == License
296
308
 
297
- MIT License. Copyright 2009 Plataforma Tecnologia. http://blog.plataformatec.com.br
309
+ MIT License. Copyright 2010 Plataforma Tecnologia. http://blog.plataformatec.com.br
data/Rakefile CHANGED
@@ -45,10 +45,11 @@ begin
45
45
  s.authors = ['José Valim', 'Carlos Antônio']
46
46
  s.files = FileList["[A-Z]*", "{app,config,lib}/**/*"]
47
47
  s.extra_rdoc_files = FileList["[A-Z]*"] - %w(Gemfile Rakefile)
48
- s.add_dependency("warden", "~> 0.10.3")
48
+ s.add_dependency("warden", "~> 0.10.7")
49
+ s.add_dependency("bcrypt-ruby", "~> 2.1.2")
49
50
  end
50
51
 
51
52
  Jeweler::GemcutterTasks.new
52
53
  rescue LoadError
53
- puts "Jeweler, or one of its dependencies, is not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com"
54
+ puts "Jeweler, or one of its dependencies, is not available. Install it with: gem install jeweler"
54
55
  end
data/TODO CHANGED
@@ -1,2 +1,3 @@
1
1
  * Move integration tests to Capybara
2
2
  * Better ORM integration
3
+ * Extract activatable models tests from confirmable
@@ -31,7 +31,7 @@ class Devise::RegistrationsController < ApplicationController
31
31
  def update
32
32
  if resource.update_with_password(params[resource_name])
33
33
  set_flash_message :notice, :updated
34
- redirect_to after_sign_in_path_for(self.resource)
34
+ redirect_to after_update_path_for(resource)
35
35
  else
36
36
  clean_up_passwords(resource)
37
37
  render_with_scope :edit
@@ -1,6 +1,5 @@
1
1
  class Devise::Mailer < ::ActionMailer::Base
2
2
  include Devise::Controllers::ScopedViews
3
-
4
3
  attr_reader :devise_mapping, :resource
5
4
 
6
5
  def confirmation_instructions(record)
@@ -17,52 +16,53 @@ class Devise::Mailer < ::ActionMailer::Base
17
16
 
18
17
  private
19
18
 
20
- # Configure default email options
21
- def setup_mail(record, action)
22
- @scope_name = Devise::Mapping.find_scope!(record)
23
- @devise_mapping = Devise.mappings[@scope_name]
24
- @resource = instance_variable_set("@#{@devise_mapping.name}", record)
25
-
26
- template_path = ["devise/mailer"]
27
- template_path.unshift "#{@devise_mapping.plural}/mailer" if self.class.scoped_views?
19
+ # Configure default email options
20
+ def setup_mail(record, action)
21
+ @scope_name = Devise::Mapping.find_scope!(record)
22
+ @devise_mapping = Devise.mappings[@scope_name]
23
+ @resource = instance_variable_set("@#{@devise_mapping.name}", record)
28
24
 
29
- headers = {
30
- :subject => translate(@devise_mapping, action),
31
- :from => mailer_sender(@devise_mapping),
32
- :to => record.email,
33
- :template_path => template_path
34
- }
25
+ template_path = ["devise/mailer"]
26
+ template_path.unshift "#{@devise_mapping.plural}/mailer" if self.class.scoped_views?
35
27
 
36
- headers.merge!(record.headers_for(action)) if record.respond_to?(:headers_for)
37
- mail(headers)
38
- end
28
+ headers = {
29
+ :subject => translate(@devise_mapping, action),
30
+ :from => mailer_sender(@devise_mapping),
31
+ :to => record.email,
32
+ :template_path => template_path
33
+ }
39
34
 
40
- # Fix a bug in Rails 3 beta 3
41
- def mail(*) #:nodoc:
42
- super
43
- @_message["template_path"] = nil
44
- @_message
45
- end
35
+ headers.merge!(record.headers_for(action)) if record.respond_to?(:headers_for)
36
+ mail(headers)
37
+ end
46
38
 
47
- def mailer_sender(mapping)
48
- if Devise.mailer_sender.is_a?(Proc)
49
- Devise.mailer_sender.call(mapping.name)
50
- else
51
- Devise.mailer_sender
52
- end
39
+ def mailer_sender(mapping)
40
+ if Devise.mailer_sender.is_a?(Proc)
41
+ Devise.mailer_sender.call(mapping.name)
42
+ else
43
+ Devise.mailer_sender
53
44
  end
45
+ end
54
46
 
55
- # Setup subject namespaced by model. It means you're able to setup your
56
- # messages using specific resource scope, or provide a default one.
57
- # Example (i18n locale file):
58
- #
59
- # en:
60
- # devise:
61
- # mailer:
62
- # confirmation_instructions: '...'
63
- # user:
64
- # confirmation_instructions: '...'
65
- def translate(mapping, key)
66
- I18n.t(:"#{mapping.name}.#{key}", :scope => [:devise, :mailer], :default => key)
67
- end
47
+ # Setup a subject doing an I18n lookup. At first, it attemps to set a subject
48
+ # based on the current mapping:
49
+ #
50
+ # en:
51
+ # devise:
52
+ # mailer:
53
+ # confirmation_instructions:
54
+ # user_subject: '...'
55
+ #
56
+ # If one does not exist, it fallbacks to ActionMailer default:
57
+ #
58
+ # en:
59
+ # devise:
60
+ # mailer:
61
+ # confirmation_instructions:
62
+ # subject: '...'
63
+ #
64
+ def translate(mapping, key)
65
+ I18n.t(:"#{mapping.name}_subject", :scope => [:devise, :mailer, key],
66
+ :default => [:subject, key.to_s.humanize])
67
+ end
68
68
  end