devise 1.2.rc → 1.2.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.
- data/.gitignore +10 -0
- data/.travis.yml +1 -0
- data/CHANGELOG.rdoc +45 -1
- data/Gemfile +29 -0
- data/Gemfile.lock +158 -0
- data/MIT-LICENSE +1 -1
- data/README.rdoc +25 -8
- data/Rakefile +34 -0
- data/TODO +4 -0
- data/app/controllers/devise/omniauth_callbacks_controller.rb +3 -3
- data/app/controllers/devise/registrations_controller.rb +4 -4
- data/app/controllers/devise/sessions_controller.rb +3 -2
- data/app/helpers/devise_helper.rb +6 -0
- data/config/locales/en.yml +2 -0
- data/devise.gemspec +25 -0
- data/lib/devise.rb +31 -5
- data/lib/devise/controllers/helpers.rb +30 -29
- data/lib/devise/controllers/internal_helpers.rb +6 -1
- data/lib/devise/controllers/rememberable.rb +52 -0
- data/lib/devise/encryptors/authlogic_sha512.rb +1 -1
- data/lib/devise/failure_app.rb +20 -4
- data/lib/devise/hooks/forgetable.rb +1 -4
- data/lib/devise/hooks/rememberable.rb +5 -44
- data/lib/devise/hooks/timeoutable.rb +1 -1
- data/lib/devise/models.rb +4 -2
- data/lib/devise/models/authenticatable.rb +13 -3
- data/lib/devise/models/confirmable.rb +3 -3
- data/lib/devise/models/database_authenticatable.rb +5 -3
- data/lib/devise/models/encryptable.rb +9 -2
- data/lib/devise/models/lockable.rb +18 -13
- data/lib/devise/models/recoverable.rb +9 -1
- data/lib/devise/models/registerable.rb +1 -1
- data/lib/devise/models/rememberable.rb +2 -5
- data/lib/devise/models/token_authenticatable.rb +4 -4
- data/lib/devise/omniauth.rb +3 -18
- data/lib/devise/omniauth/test_helpers.rb +14 -40
- data/lib/devise/omniauth/url_helpers.rb +6 -2
- data/lib/devise/rails.rb +3 -2
- data/lib/devise/rails/warden_compat.rb +5 -0
- data/lib/devise/schema.rb +3 -2
- data/lib/devise/strategies/authenticatable.rb +15 -1
- data/lib/devise/strategies/database_authenticatable.rb +1 -1
- data/lib/devise/strategies/rememberable.rb +6 -5
- data/lib/devise/strategies/token_authenticatable.rb +1 -1
- data/lib/devise/test_helpers.rb +3 -3
- data/lib/devise/version.rb +1 -1
- data/lib/generators/active_record/devise_generator.rb +2 -2
- data/lib/generators/active_record/templates/migration.rb +1 -0
- data/lib/generators/devise/devise_generator.rb +3 -1
- data/lib/generators/devise/orm_helpers.rb +1 -2
- data/lib/generators/devise/views_generator.rb +8 -45
- data/lib/generators/mongoid/devise_generator.rb +2 -2
- data/lib/generators/templates/devise.rb +19 -7
- data/test/controllers/helpers_test.rb +35 -5
- data/test/devise_test.rb +10 -0
- data/test/failure_app_test.rb +32 -3
- data/test/generators/active_record_generator_test.rb +24 -0
- data/test/generators/devise_generator_test.rb +33 -0
- data/test/generators/install_generator_test.rb +3 -4
- data/test/generators/mongoid_generator_test.rb +22 -0
- data/test/generators/views_generator_test.rb +13 -15
- data/test/indifferent_hash.rb +33 -0
- data/test/integration/authenticatable_test.rb +7 -0
- data/test/integration/omniauthable_test.rb +67 -32
- data/test/integration/registerable_test.rb +30 -0
- data/test/integration/rememberable_test.rb +16 -6
- data/test/integration/token_authenticatable_test.rb +43 -5
- data/test/models/confirmable_test.rb +20 -3
- data/test/models/encryptable_test.rb +1 -1
- data/test/models/lockable_test.rb +36 -15
- data/test/models/recoverable_test.rb +20 -11
- data/test/models/token_authenticatable_test.rb +19 -1
- data/test/models_test.rb +7 -0
- data/test/omniauth/test_helpers_test.rb +25 -0
- data/test/omniauth/url_helpers_test.rb +7 -0
- data/test/rails_app/Rakefile +10 -0
- data/test/rails_app/app/controllers/application_controller.rb +0 -1
- data/test/rails_app/app/controllers/users/omniauth_callbacks_controller.rb +7 -0
- data/test/rails_app/app/views/admins/index.html.erb +1 -0
- data/test/rails_app/app/views/admins/sessions/new.html.erb +2 -0
- data/test/rails_app/app/views/home/index.html.erb +1 -0
- data/test/rails_app/app/views/home/private.html.erb +1 -0
- data/test/rails_app/app/views/layouts/application.html.erb +24 -0
- data/test/rails_app/app/views/users/index.html.erb +1 -0
- data/test/rails_app/app/views/users/mailer/confirmation_instructions.erb +1 -0
- data/test/rails_app/app/views/users/sessions/new.html.erb +1 -0
- data/test/rails_app/config.ru +4 -0
- data/test/rails_app/config/application.rb +5 -0
- data/test/rails_app/config/database.yml +18 -0
- data/test/rails_app/config/initializers/devise.rb +18 -2
- data/test/rails_app/public/404.html +26 -0
- data/test/rails_app/public/422.html +26 -0
- data/test/rails_app/public/500.html +26 -0
- data/test/rails_app/public/favicon.ico +0 -0
- data/test/rails_app/script/rails +10 -0
- data/test/schema_test.rb +33 -0
- data/test/support/locale/en.yml +4 -0
- data/test/test_helper.rb +5 -2
- data/test/test_helpers_test.rb +33 -0
- metadata +71 -20
- data/test/generators/generators_test_helper.rb +0 -4
data/.gitignore
ADDED
data/.travis.yml
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
script: "rake test"
|
data/CHANGELOG.rdoc
CHANGED
@@ -1,3 +1,33 @@
|
|
1
|
+
== 1.2.rc2
|
2
|
+
|
3
|
+
* enhancements
|
4
|
+
* Make friendly_token 20 chars long
|
5
|
+
* Use secure_compare
|
6
|
+
|
7
|
+
* bug fix
|
8
|
+
* Fix an issue causing infinite redirects in production
|
9
|
+
* rails g destroy works properly with devise generators (by github.com/andmej)
|
10
|
+
* before_failure callbacks should work on test helpers (by github.com/twinge)
|
11
|
+
* rememberable cookie now is httponly by default (by github.com/JamesFerguson)
|
12
|
+
* Add missing confirmation_keys (by github.com/JohnPlummer)
|
13
|
+
* Ensure after_* hooks are called on RegistrationsController
|
14
|
+
* When using database_authenticatable Devise will now only create an email field when appropriate (if using default authentication_keys or custom authentication_keys with email included)
|
15
|
+
* Ensure stateless token does not trigger timeout (by github.com/pixelauthority)
|
16
|
+
* Implement handle_unverified_request for Rails 3.0.4 compatibility and improve FailureApp reliance on symbols
|
17
|
+
* Consider namespaces while generating routes
|
18
|
+
* Custom failure apps no longer ignored in test mode (by github.com/jaghion)
|
19
|
+
* Do not depend on ActiveModel::Dirty
|
20
|
+
* Manual sign_in now triggers remember token
|
21
|
+
* Be sure to halt strategies on failures
|
22
|
+
* Consider SCRIPT_NAME on Omniauth paths
|
23
|
+
* Reset failed attempts when lock is expired
|
24
|
+
* Ensure there is no Mongoid injection
|
25
|
+
|
26
|
+
* deprecations
|
27
|
+
* Deprecated anybody_signed_in? in favor of signed_in? (by github.com/gavinhughes)
|
28
|
+
* Removed --haml and --slim view templates
|
29
|
+
* Devise::OmniAuth helpers were deprecated and removed in favor of Omniauth.config.test_mode
|
30
|
+
|
1
31
|
== 1.2.rc
|
2
32
|
|
3
33
|
* deprecations
|
@@ -30,12 +60,26 @@
|
|
30
60
|
* bugfix
|
31
61
|
* after_sign_in_path_for always receives a resource
|
32
62
|
* Do not execute Warden::Callbacks on Devise::TestHelpers (by github.com/sgronblo)
|
33
|
-
*
|
63
|
+
* Allow password recovery and account unlocking to change used keys (by github.com/RStankov)
|
34
64
|
* FailureApp now properly handles nil request.format
|
35
65
|
* Fix a bug causing FailureApp to return with HTTP Auth Headers for IE7
|
36
66
|
* Ensure namespaces has proper scoped views
|
37
67
|
* Ensure Devise does not set empty flash messages (by github.com/sxross)
|
38
68
|
|
69
|
+
== 1.1.6
|
70
|
+
|
71
|
+
* Use a more secure e-mail regexp
|
72
|
+
* Implement Rails 3.0.4 handle unverified request
|
73
|
+
* Use secure_compare to compare passwords
|
74
|
+
|
75
|
+
== 1.1.5
|
76
|
+
|
77
|
+
* bugfix
|
78
|
+
* Ensure to convert keys on indifferent hash
|
79
|
+
|
80
|
+
* defaults
|
81
|
+
* Set config.http_authenticatable to false to avoid confusion
|
82
|
+
|
39
83
|
== 1.1.4
|
40
84
|
|
41
85
|
* bugfix
|
data/Gemfile
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
source "http://rubygems.org"
|
2
|
+
|
3
|
+
gemspec
|
4
|
+
|
5
|
+
gem "rails", "~> 3.0.4"
|
6
|
+
gem "oa-oauth", '~> 0.2.0', :require => "omniauth/oauth"
|
7
|
+
gem "oa-openid", '~> 0.2.0', :require => "omniauth/openid"
|
8
|
+
|
9
|
+
group :test do
|
10
|
+
gem "webrat", "0.7.2", :require => false
|
11
|
+
gem "mocha", :require => false
|
12
|
+
end
|
13
|
+
|
14
|
+
platforms :jruby do
|
15
|
+
gem 'activerecord-jdbcsqlite3-adapter'
|
16
|
+
end
|
17
|
+
|
18
|
+
platforms :ruby do
|
19
|
+
group :test do
|
20
|
+
gem "sqlite3-ruby"
|
21
|
+
gem "ruby-debug", ">= 0.10.3" if RUBY_VERSION < '1.9'
|
22
|
+
end
|
23
|
+
|
24
|
+
group :mongoid do
|
25
|
+
gem "mongo", "1.1.2"
|
26
|
+
gem "mongoid", "2.0.0.beta.20"
|
27
|
+
gem "bson_ext", "1.2.1"
|
28
|
+
end
|
29
|
+
end
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,158 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
devise (1.2.rc)
|
5
|
+
bcrypt-ruby (~> 2.1.2)
|
6
|
+
orm_adapter (~> 0.0.3)
|
7
|
+
warden (~> 1.0.3)
|
8
|
+
|
9
|
+
GEM
|
10
|
+
remote: http://rubygems.org/
|
11
|
+
specs:
|
12
|
+
abstract (1.0.0)
|
13
|
+
actionmailer (3.0.4)
|
14
|
+
actionpack (= 3.0.4)
|
15
|
+
mail (~> 2.2.15)
|
16
|
+
actionpack (3.0.4)
|
17
|
+
activemodel (= 3.0.4)
|
18
|
+
activesupport (= 3.0.4)
|
19
|
+
builder (~> 2.1.2)
|
20
|
+
erubis (~> 2.6.6)
|
21
|
+
i18n (~> 0.4)
|
22
|
+
rack (~> 1.2.1)
|
23
|
+
rack-mount (~> 0.6.13)
|
24
|
+
rack-test (~> 0.5.7)
|
25
|
+
tzinfo (~> 0.3.23)
|
26
|
+
activemodel (3.0.4)
|
27
|
+
activesupport (= 3.0.4)
|
28
|
+
builder (~> 2.1.2)
|
29
|
+
i18n (~> 0.4)
|
30
|
+
activerecord (3.0.4)
|
31
|
+
activemodel (= 3.0.4)
|
32
|
+
activesupport (= 3.0.4)
|
33
|
+
arel (~> 2.0.2)
|
34
|
+
tzinfo (~> 0.3.23)
|
35
|
+
activerecord-jdbc-adapter (1.1.1)
|
36
|
+
activerecord-jdbcsqlite3-adapter (1.1.1)
|
37
|
+
activerecord-jdbc-adapter (= 1.1.1)
|
38
|
+
jdbc-sqlite3 (~> 3.6.0)
|
39
|
+
activeresource (3.0.4)
|
40
|
+
activemodel (= 3.0.4)
|
41
|
+
activesupport (= 3.0.4)
|
42
|
+
activesupport (3.0.4)
|
43
|
+
addressable (2.2.4)
|
44
|
+
arel (2.0.8)
|
45
|
+
bcrypt-ruby (2.1.4)
|
46
|
+
bson (1.2.1)
|
47
|
+
bson_ext (1.2.1)
|
48
|
+
builder (2.1.2)
|
49
|
+
columnize (0.3.2)
|
50
|
+
erubis (2.6.6)
|
51
|
+
abstract (>= 1.0.0)
|
52
|
+
faraday (0.5.7)
|
53
|
+
addressable (~> 2.2.4)
|
54
|
+
multipart-post (~> 1.1.0)
|
55
|
+
rack (>= 1.1.0, < 2)
|
56
|
+
i18n (0.5.0)
|
57
|
+
jdbc-sqlite3 (3.6.14.2.056-java)
|
58
|
+
linecache (0.43)
|
59
|
+
mail (2.2.15)
|
60
|
+
activesupport (>= 2.3.6)
|
61
|
+
i18n (>= 0.4.0)
|
62
|
+
mime-types (~> 1.16)
|
63
|
+
treetop (~> 1.4.8)
|
64
|
+
mime-types (1.16)
|
65
|
+
mocha (0.9.12)
|
66
|
+
mongo (1.1.2)
|
67
|
+
bson (>= 1.1.1)
|
68
|
+
mongoid (2.0.0.beta.20)
|
69
|
+
activemodel (~> 3.0)
|
70
|
+
mongo (~> 1.1)
|
71
|
+
tzinfo (~> 0.3.22)
|
72
|
+
will_paginate (~> 3.0.pre)
|
73
|
+
multi_json (0.0.5)
|
74
|
+
multipart-post (1.1.0)
|
75
|
+
nokogiri (1.4.4)
|
76
|
+
nokogiri (1.4.4-java)
|
77
|
+
weakling (>= 0.0.3)
|
78
|
+
oa-core (0.2.0)
|
79
|
+
rack (~> 1.1)
|
80
|
+
oa-oauth (0.2.0)
|
81
|
+
multi_json (~> 0.0.2)
|
82
|
+
nokogiri (~> 1.4.2)
|
83
|
+
oa-core (= 0.2.0)
|
84
|
+
oauth (~> 0.4.0)
|
85
|
+
oauth2 (~> 0.1.1)
|
86
|
+
oa-openid (0.2.0)
|
87
|
+
oa-core (= 0.2.0)
|
88
|
+
rack-openid (~> 1.2.0)
|
89
|
+
ruby-openid-apps-discovery
|
90
|
+
oauth (0.4.4)
|
91
|
+
oauth2 (0.1.1)
|
92
|
+
faraday (~> 0.5.0)
|
93
|
+
multi_json (~> 0.0.4)
|
94
|
+
orm_adapter (0.0.4)
|
95
|
+
polyglot (0.3.1)
|
96
|
+
rack (1.2.1)
|
97
|
+
rack-mount (0.6.13)
|
98
|
+
rack (>= 1.0.0)
|
99
|
+
rack-openid (1.2.0)
|
100
|
+
rack (>= 1.1.0)
|
101
|
+
ruby-openid (>= 2.1.8)
|
102
|
+
rack-test (0.5.7)
|
103
|
+
rack (>= 1.0)
|
104
|
+
rails (3.0.4)
|
105
|
+
actionmailer (= 3.0.4)
|
106
|
+
actionpack (= 3.0.4)
|
107
|
+
activerecord (= 3.0.4)
|
108
|
+
activeresource (= 3.0.4)
|
109
|
+
activesupport (= 3.0.4)
|
110
|
+
bundler (~> 1.0)
|
111
|
+
railties (= 3.0.4)
|
112
|
+
railties (3.0.4)
|
113
|
+
actionpack (= 3.0.4)
|
114
|
+
activesupport (= 3.0.4)
|
115
|
+
rake (>= 0.8.7)
|
116
|
+
thor (~> 0.14.4)
|
117
|
+
rake (0.8.7)
|
118
|
+
ruby-debug (0.10.4)
|
119
|
+
columnize (>= 0.1)
|
120
|
+
ruby-debug-base (~> 0.10.4.0)
|
121
|
+
ruby-debug-base (0.10.4)
|
122
|
+
linecache (>= 0.3)
|
123
|
+
ruby-openid (2.1.8)
|
124
|
+
ruby-openid-apps-discovery (1.2.0)
|
125
|
+
ruby-openid (>= 2.1.7)
|
126
|
+
sqlite3 (1.3.3)
|
127
|
+
sqlite3-ruby (1.3.3)
|
128
|
+
sqlite3 (>= 1.3.3)
|
129
|
+
thor (0.14.6)
|
130
|
+
treetop (1.4.9)
|
131
|
+
polyglot (>= 0.3.1)
|
132
|
+
tzinfo (0.3.24)
|
133
|
+
warden (1.0.3)
|
134
|
+
rack (>= 1.0.0)
|
135
|
+
weakling (0.0.4-java)
|
136
|
+
webrat (0.7.2)
|
137
|
+
nokogiri (>= 1.2.0)
|
138
|
+
rack (>= 1.0)
|
139
|
+
rack-test (>= 0.5.3)
|
140
|
+
will_paginate (3.0.pre2)
|
141
|
+
|
142
|
+
PLATFORMS
|
143
|
+
java
|
144
|
+
ruby
|
145
|
+
|
146
|
+
DEPENDENCIES
|
147
|
+
activerecord-jdbcsqlite3-adapter
|
148
|
+
bson_ext (= 1.2.1)
|
149
|
+
devise!
|
150
|
+
mocha
|
151
|
+
mongo (= 1.1.2)
|
152
|
+
mongoid (= 2.0.0.beta.20)
|
153
|
+
oa-oauth (~> 0.2.0)
|
154
|
+
oa-openid (~> 0.2.0)
|
155
|
+
rails (~> 3.0.4)
|
156
|
+
ruby-debug (>= 0.10.3)
|
157
|
+
sqlite3-ruby
|
158
|
+
webrat (= 0.7.2)
|
data/MIT-LICENSE
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
Copyright 2009 Plataforma Tecnologia. http://blog.plataformatec.com.br
|
1
|
+
Copyright 2009-2011 Plataforma Tecnologia. http://blog.plataformatec.com.br
|
2
2
|
|
3
3
|
Permission is hereby granted, free of charge, to any person obtaining
|
4
4
|
a copy of this software and associated documentation files (the
|
data/README.rdoc
CHANGED
@@ -9,7 +9,7 @@ Devise is a flexible authentication solution for Rails based on Warden. It:
|
|
9
9
|
|
10
10
|
It's composed of 12 modules:
|
11
11
|
|
12
|
-
* Database Authenticatable: encrypts and stores a password in the database to validate the authenticity of
|
12
|
+
* Database Authenticatable: encrypts and stores a password in the database to validate the authenticity of a user while signing in. The authentication can be done both through POST requests or HTTP Basic Authentication.
|
13
13
|
* Token Authenticatable: signs in a 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
|
* Omniauthable: adds Omniauth (github.com/intridea/omniauth) support;
|
15
15
|
* Confirmable: sends emails with confirmation instructions and verifies whether an account is already confirmed during sign in.
|
@@ -20,11 +20,11 @@ It's composed of 12 modules:
|
|
20
20
|
* Timeoutable: expires sessions that have no activity in a specified period of time.
|
21
21
|
* Validatable: provides validations of email and password. It's optional and can be customized, so you're able to define your own validations.
|
22
22
|
* Lockable: locks an account after a specified number of failed sign-in attempts. Can unlock via email or after a specified time period.
|
23
|
-
* Encryptable:
|
23
|
+
* Encryptable: adds support of other authentication mechanisms besides the built-in Bcrypt (the default).
|
24
24
|
|
25
25
|
== Information
|
26
26
|
|
27
|
-
=== The Devise
|
27
|
+
=== The Devise wiki
|
28
28
|
|
29
29
|
The Devise Wiki has lots of additional information about Devise including many "how-to" articles and answers to the most frequently asked questions. Please browse the Wiki after finishing this README:
|
30
30
|
|
@@ -36,11 +36,11 @@ If you discover a problem with Devise, we would like to know about it. However,
|
|
36
36
|
|
37
37
|
http://github.com/plataformatec/devise/wiki/Bug-reports
|
38
38
|
|
39
|
-
If you found a security bug, do *NOT* use the GitHub
|
39
|
+
If you found a security bug, do *NOT* use the GitHub issue tracker. Send email or a private GitHub message to the maintainers listed at the bottom of the README.
|
40
40
|
|
41
|
-
===
|
41
|
+
=== Mailing list
|
42
42
|
|
43
|
-
If you have any questions, comments, or concerns please use the Google Group instead of the GitHub
|
43
|
+
If you have any questions, comments, or concerns, please use the Google Group instead of the GitHub issue tracker:
|
44
44
|
|
45
45
|
http://groups.google.com/group/plataformatec-devise
|
46
46
|
|
@@ -52,7 +52,7 @@ http://rubydoc.info/github/plataformatec/devise/master/frames
|
|
52
52
|
|
53
53
|
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.
|
54
54
|
|
55
|
-
=== Example
|
55
|
+
=== Example applications
|
56
56
|
|
57
57
|
There are a few example applications available on GitHub that demonstrate various features of Devise with different versions of Rails. You can view them here:
|
58
58
|
|
@@ -70,6 +70,8 @@ We hope that you will consider contributing to Devise. Please read this short ov
|
|
70
70
|
|
71
71
|
http://github.com/plataformatec/devise/wiki/Contributing
|
72
72
|
|
73
|
+
You will usually want to write tests for your changes. To run the test suite, `cd` into Devise's top-level directory and run `bundle install` and `rake`. For the tests to pass, you will need to have a MongoDB server (version 1.6 or newer) running on your system.
|
74
|
+
|
73
75
|
== Installation
|
74
76
|
|
75
77
|
You can use the latest Rails 3 gem with the latest Devise gem:
|
@@ -88,6 +90,15 @@ Replace MODEL by the class name you want to add devise, like User, Admin, etc. T
|
|
88
90
|
|
89
91
|
Support for Rails 2.3.x can be found by installing Devise 1.0.x from the v1.0 branch.
|
90
92
|
|
93
|
+
== Starting with Rails?
|
94
|
+
|
95
|
+
If you are building your first Rails application, we recommend you to *not* use Devise. Devise requires a good understanding of the Rails Framework. In such cases, we advise you to start a simple authentication system from scratch, today we have two resources:
|
96
|
+
|
97
|
+
* Michael Hartl's online book: http://railstutorial.org/chapters/modeling-and-viewing-users-two#top
|
98
|
+
* Ryan Bates' Railscast: http://railscasts.com/episodes/250-authentication-from-scratch
|
99
|
+
|
100
|
+
Once you have solidified you understanding of Rails and authentication mechanisms, we assure you Devise will be very pleasant to work with. :)
|
101
|
+
|
91
102
|
== Getting started
|
92
103
|
|
93
104
|
This is a walkthrough with all steps you need to setup a devise resource, including model, migration, route files, and optional configuration.
|
@@ -201,7 +212,13 @@ Since Devise is an engine, all its views are packaged inside the gem. These view
|
|
201
212
|
|
202
213
|
rails generate devise:views
|
203
214
|
|
204
|
-
|
215
|
+
Devise currently supports generating views for the following template engines (use the `-e` flag for the devise:views generator):
|
216
|
+
|
217
|
+
* Erb
|
218
|
+
* Haml (http://github.com/nex3/haml)
|
219
|
+
* Slim (http://github.com/stonean/slim)
|
220
|
+
|
221
|
+
Note: If you are generating Haml or Slim templates, you will need to have a few dependencies such as `ruby_parser` (for Haml), `hpricot` (for both Haml and Slim) and `haml2slim` (for Slim) installed.
|
205
222
|
|
206
223
|
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".
|
207
224
|
|
data/Rakefile
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
|
3
|
+
require 'rake/testtask'
|
4
|
+
require 'rake/rdoctask'
|
5
|
+
|
6
|
+
desc 'Default: run tests for all ORMs.'
|
7
|
+
task :default => :pre_commit
|
8
|
+
|
9
|
+
desc 'Run Devise tests for all ORMs.'
|
10
|
+
task :pre_commit do
|
11
|
+
Dir[File.join(File.dirname(__FILE__), 'test', 'orm', '*.rb')].each do |file|
|
12
|
+
orm = File.basename(file).split(".").first
|
13
|
+
# "Some day, my son, rake's inner wisdom will reveal itself. Until then,
|
14
|
+
# take this `system` -- may its brute force protect you well."
|
15
|
+
exit 1 unless system "rake test DEVISE_ORM=#{orm}"
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
desc 'Run Devise unit tests.'
|
20
|
+
Rake::TestTask.new(:test) do |t|
|
21
|
+
t.libs << 'lib'
|
22
|
+
t.libs << 'test'
|
23
|
+
t.pattern = 'test/**/*_test.rb'
|
24
|
+
t.verbose = true
|
25
|
+
end
|
26
|
+
|
27
|
+
desc 'Generate documentation for Devise.'
|
28
|
+
Rake::RDocTask.new(:rdoc) do |rdoc|
|
29
|
+
rdoc.rdoc_dir = 'rdoc'
|
30
|
+
rdoc.title = 'Devise'
|
31
|
+
rdoc.options << '--line-numbers' << '--inline-source'
|
32
|
+
rdoc.rdoc_files.include('README.rdoc')
|
33
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
34
|
+
end
|
data/TODO
ADDED
@@ -9,18 +9,18 @@ class Devise::OmniauthCallbacksController < ApplicationController
|
|
9
9
|
protected
|
10
10
|
|
11
11
|
def failed_strategy
|
12
|
-
env["omniauth.
|
12
|
+
env["omniauth.error.strategy"]
|
13
13
|
end
|
14
14
|
|
15
15
|
def failure_message
|
16
16
|
exception = env["omniauth.error"]
|
17
17
|
error = exception.error_reason if exception.respond_to?(:error_reason)
|
18
18
|
error ||= exception.error if exception.respond_to?(:error)
|
19
|
-
error ||= env["omniauth.
|
19
|
+
error ||= env["omniauth.error.type"].to_s
|
20
20
|
error.to_s.humanize if error
|
21
21
|
end
|
22
22
|
|
23
23
|
def after_omniauth_failure_path_for(scope)
|
24
24
|
new_session_path(scope)
|
25
25
|
end
|
26
|
-
end
|
26
|
+
end
|
@@ -9,7 +9,7 @@ class Devise::RegistrationsController < ApplicationController
|
|
9
9
|
render_with_scope :new
|
10
10
|
end
|
11
11
|
|
12
|
-
# POST /resource
|
12
|
+
# POST /resource
|
13
13
|
def create
|
14
14
|
build_resource
|
15
15
|
|
@@ -78,8 +78,8 @@ class Devise::RegistrationsController < ApplicationController
|
|
78
78
|
end
|
79
79
|
|
80
80
|
# Overwrite redirect_for_sign_in so it takes uses after_sign_up_path_for.
|
81
|
-
def
|
82
|
-
|
81
|
+
def redirect_location(scope, resource) #:nodoc:
|
82
|
+
stored_location_for(scope) || after_sign_up_path_for(resource)
|
83
83
|
end
|
84
84
|
|
85
85
|
# The path used after sign up for inactive accounts. You need to overwrite
|
@@ -104,7 +104,7 @@ class Devise::RegistrationsController < ApplicationController
|
|
104
104
|
# We need to use a copy because we don't want actions like update changing
|
105
105
|
# the current user in place.
|
106
106
|
def authenticate_scope!
|
107
|
-
send(:"authenticate_#{resource_name}!")
|
107
|
+
send(:"authenticate_#{resource_name}!", true)
|
108
108
|
self.resource = resource_class.to_adapter.get!(send(:"current_#{resource_name}").to_key)
|
109
109
|
end
|
110
110
|
end
|