sorcery 0.1.4 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Gemfile +4 -2
- data/Gemfile.lock +16 -13
- data/README.rdoc +111 -78
- data/Rakefile +5 -0
- data/VERSION +1 -1
- data/lib/generators/sorcery_migration/sorcery_migration_generator.rb +24 -0
- data/lib/generators/sorcery_migration/templates/activity_logging.rb +17 -0
- data/lib/generators/sorcery_migration/templates/brute_force_protection.rb +11 -0
- data/lib/generators/sorcery_migration/templates/core.rb +16 -0
- data/lib/generators/sorcery_migration/templates/oauth.rb +14 -0
- data/lib/generators/sorcery_migration/templates/remember_me.rb +15 -0
- data/lib/generators/sorcery_migration/templates/reset_password.rb +13 -0
- data/lib/generators/sorcery_migration/templates/user_activation.rb +17 -0
- data/lib/sorcery/controller/adapters/sinatra.rb +97 -0
- data/lib/sorcery/controller/submodules/activity_logging.rb +20 -7
- data/lib/sorcery/controller/submodules/brute_force_protection.rb +9 -2
- data/lib/sorcery/controller/submodules/http_basic_auth.rb +18 -9
- data/lib/sorcery/controller/submodules/oauth/oauth1.rb +33 -0
- data/lib/sorcery/controller/submodules/oauth/oauth2.rb +24 -0
- data/lib/sorcery/controller/submodules/oauth/providers/facebook.rb +64 -0
- data/lib/sorcery/controller/submodules/oauth/providers/twitter.rb +61 -0
- data/lib/sorcery/controller/submodules/oauth.rb +95 -0
- data/lib/sorcery/controller/submodules/remember_me.rb +14 -5
- data/lib/sorcery/controller/submodules/session_timeout.rb +6 -1
- data/lib/sorcery/controller.rb +29 -17
- data/lib/sorcery/engine.rb +9 -2
- data/lib/sorcery/model/submodules/activity_logging.rb +13 -8
- data/lib/sorcery/model/submodules/brute_force_protection.rb +11 -8
- data/lib/sorcery/model/submodules/oauth.rb +53 -0
- data/lib/sorcery/model/submodules/remember_me.rb +5 -3
- data/lib/sorcery/model/submodules/reset_password.rb +16 -13
- data/lib/sorcery/model/submodules/user_activation.rb +38 -19
- data/lib/sorcery/model/temporary_token.rb +22 -0
- data/lib/sorcery/model.rb +10 -3
- data/lib/sorcery/sinatra.rb +14 -0
- data/lib/sorcery/test_helpers/rails.rb +57 -0
- data/lib/sorcery/test_helpers/sinatra.rb +131 -0
- data/lib/sorcery/test_helpers.rb +40 -0
- data/lib/sorcery.rb +20 -0
- data/sorcery.gemspec +144 -41
- data/spec/Gemfile +3 -2
- data/spec/Gemfile.lock +15 -2
- data/spec/rails3/app_root/.rspec +1 -0
- data/spec/rails3/{Gemfile → app_root/Gemfile} +4 -4
- data/spec/rails3/{Gemfile.lock → app_root/Gemfile.lock} +23 -3
- data/spec/rails3/app_root/app/controllers/application_controller.rb +42 -1
- data/spec/rails3/app_root/app/models/authentication.rb +3 -0
- data/spec/rails3/app_root/app/models/user.rb +4 -1
- data/spec/rails3/app_root/config/application.rb +1 -3
- data/spec/rails3/app_root/config/routes.rb +1 -10
- data/spec/rails3/app_root/db/migrate/activation/20101224223622_add_activation_to_users.rb +6 -4
- data/spec/rails3/app_root/db/migrate/core/20101224223620_create_users.rb +4 -4
- data/spec/rails3/app_root/db/migrate/oauth/20101224223628_create_authentications.rb +14 -0
- data/spec/rails3/{controller_activity_logging_spec.rb → app_root/spec/controller_activity_logging_spec.rb} +13 -13
- data/spec/rails3/{controller_brute_force_protection_spec.rb → app_root/spec/controller_brute_force_protection_spec.rb} +16 -6
- data/spec/rails3/{controller_http_basic_auth_spec.rb → app_root/spec/controller_http_basic_auth_spec.rb} +3 -3
- data/spec/rails3/app_root/spec/controller_oauth2_spec.rb +119 -0
- data/spec/rails3/app_root/spec/controller_oauth_spec.rb +122 -0
- data/spec/rails3/{controller_remember_me_spec.rb → app_root/spec/controller_remember_me_spec.rb} +4 -4
- data/spec/rails3/{controller_session_timeout_spec.rb → app_root/spec/controller_session_timeout_spec.rb} +6 -6
- data/spec/rails3/{controller_spec.rb → app_root/spec/controller_spec.rb} +20 -13
- data/spec/rails3/app_root/spec/spec_helper.orig.rb +27 -0
- data/spec/rails3/app_root/spec/spec_helper.rb +62 -0
- data/spec/rails3/{user_activation_spec.rb → app_root/spec/user_activation_spec.rb} +60 -20
- data/spec/rails3/{user_activity_logging_spec.rb → app_root/spec/user_activity_logging_spec.rb} +4 -4
- data/spec/rails3/{user_brute_force_protection_spec.rb → app_root/spec/user_brute_force_protection_spec.rb} +7 -7
- data/spec/rails3/app_root/spec/user_oauth_spec.rb +39 -0
- data/spec/rails3/{user_remember_me_spec.rb → app_root/spec/user_remember_me_spec.rb} +4 -4
- data/spec/rails3/{user_reset_password_spec.rb → app_root/spec/user_reset_password_spec.rb} +21 -41
- data/spec/rails3/app_root/spec/user_spec.rb +317 -0
- data/spec/sinatra/Gemfile +12 -0
- data/spec/sinatra/Gemfile.lock +134 -0
- data/spec/sinatra/Rakefile +10 -0
- data/spec/sinatra/authentication.rb +3 -0
- data/spec/sinatra/db/migrate/activation/20101224223622_add_activation_to_users.rb +17 -0
- data/spec/sinatra/db/migrate/activity_logging/20101224223624_add_activity_logging_to_users.rb +17 -0
- data/spec/sinatra/db/migrate/brute_force_protection/20101224223626_add_brute_force_protection_to_users.rb +11 -0
- data/spec/sinatra/db/migrate/core/20101224223620_create_users.rb +16 -0
- data/spec/sinatra/db/migrate/oauth/20101224223628_create_authentications.rb +14 -0
- data/spec/sinatra/db/migrate/remember_me/20101224223623_add_remember_me_token_to_users.rb +15 -0
- data/spec/sinatra/db/migrate/reset_password/20101224223622_add_reset_password_to_users.rb +13 -0
- data/spec/sinatra/filters.rb +21 -0
- data/spec/sinatra/myapp.rb +133 -0
- data/spec/sinatra/sorcery_mailer.rb +25 -0
- data/spec/sinatra/spec/controller_activity_logging_spec.rb +85 -0
- data/spec/sinatra/spec/controller_brute_force_protection_spec.rb +69 -0
- data/spec/sinatra/spec/controller_http_basic_auth_spec.rb +53 -0
- data/spec/sinatra/spec/controller_oauth2_spec.rb +119 -0
- data/spec/sinatra/spec/controller_oauth_spec.rb +121 -0
- data/spec/sinatra/spec/controller_remember_me_spec.rb +64 -0
- data/spec/sinatra/spec/controller_session_timeout_spec.rb +52 -0
- data/spec/sinatra/spec/controller_spec.rb +120 -0
- data/spec/sinatra/spec/spec.opts +4 -0
- data/spec/sinatra/spec/spec_helper.rb +44 -0
- data/spec/sinatra/spec/user_activation_spec.rb +188 -0
- data/spec/sinatra/spec/user_activity_logging_spec.rb +36 -0
- data/spec/sinatra/spec/user_brute_force_protection_spec.rb +76 -0
- data/spec/sinatra/spec/user_oauth_spec.rb +39 -0
- data/spec/sinatra/spec/user_remember_me_spec.rb +66 -0
- data/spec/sinatra/spec/user_reset_password_spec.rb +178 -0
- data/spec/{rails3 → sinatra/spec}/user_spec.rb +68 -38
- data/spec/sinatra/user.rb +6 -0
- data/spec/sinatra/views/test_login.erb +4 -0
- data/spec/untitled folder +18 -0
- metadata +201 -58
- data/spec/rails3/app_root/test/fixtures/users.yml +0 -9
- data/spec/rails3/app_root/test/performance/browsing_test.rb +0 -9
- data/spec/rails3/app_root/test/test_helper.rb +0 -13
- data/spec/rails3/app_root/test/unit/user_test.rb +0 -8
- data/spec/rails3/spec_helper.rb +0 -135
- /data/spec/rails3/{Rakefile → app_root/Rakefile} +0 -0
data/lib/sorcery.rb
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
module Sorcery
|
|
2
2
|
autoload :Model, 'sorcery/model'
|
|
3
3
|
module Model
|
|
4
|
+
autoload :TemporaryToken, 'sorcery/model/temporary_token'
|
|
4
5
|
module Submodules
|
|
5
6
|
autoload :UserActivation, 'sorcery/model/submodules/user_activation'
|
|
6
7
|
autoload :ResetPassword, 'sorcery/model/submodules/reset_password'
|
|
7
8
|
autoload :RememberMe, 'sorcery/model/submodules/remember_me'
|
|
8
9
|
autoload :ActivityLogging, 'sorcery/model/submodules/activity_logging'
|
|
9
10
|
autoload :BruteForceProtection, 'sorcery/model/submodules/brute_force_protection'
|
|
11
|
+
autoload :Oauth, 'sorcery/model/submodules/oauth'
|
|
10
12
|
end
|
|
11
13
|
end
|
|
12
14
|
autoload :Controller, 'sorcery/controller'
|
|
@@ -17,6 +19,18 @@ module Sorcery
|
|
|
17
19
|
autoload :BruteForceProtection, 'sorcery/controller/submodules/brute_force_protection'
|
|
18
20
|
autoload :HttpBasicAuth, 'sorcery/controller/submodules/http_basic_auth'
|
|
19
21
|
autoload :ActivityLogging, 'sorcery/controller/submodules/activity_logging'
|
|
22
|
+
autoload :Oauth, 'sorcery/controller/submodules/oauth'
|
|
23
|
+
module Oauth
|
|
24
|
+
autoload :Oauth1, 'sorcery/controller/submodules/oauth/oauth1'
|
|
25
|
+
autoload :Oauth2, 'sorcery/controller/submodules/oauth/oauth2'
|
|
26
|
+
module Providers
|
|
27
|
+
autoload :Twitter, 'sorcery/controller/submodules/oauth/providers/twitter'
|
|
28
|
+
autoload :Facebook, 'sorcery/controller/submodules/oauth/providers/facebook'
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
module Adapters
|
|
33
|
+
autoload :Sinatra, 'sorcery/controller/adapters/sinatra'
|
|
20
34
|
end
|
|
21
35
|
end
|
|
22
36
|
module CryptoProviders
|
|
@@ -27,6 +41,12 @@ module Sorcery
|
|
|
27
41
|
autoload :SHA256, 'sorcery/crypto_providers/sha256'
|
|
28
42
|
autoload :SHA512, 'sorcery/crypto_providers/sha512'
|
|
29
43
|
end
|
|
44
|
+
autoload :TestHelpers, 'sorcery/test_helpers'
|
|
45
|
+
module TestHelpers
|
|
46
|
+
autoload :Rails, 'sorcery/test_helpers/rails'
|
|
47
|
+
autoload :Sinatra, 'sorcery/test_helpers/sinatra'
|
|
48
|
+
end
|
|
30
49
|
|
|
31
50
|
require 'sorcery/engine' if defined?(Rails) && Rails::VERSION::MAJOR == 3
|
|
51
|
+
require 'sorcery/sinatra' if defined?(Sinatra)
|
|
32
52
|
end
|
data/sorcery.gemspec
CHANGED
|
@@ -5,11 +5,11 @@
|
|
|
5
5
|
|
|
6
6
|
Gem::Specification.new do |s|
|
|
7
7
|
s.name = %q{sorcery}
|
|
8
|
-
s.version = "0.
|
|
8
|
+
s.version = "0.3.0"
|
|
9
9
|
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
|
11
11
|
s.authors = ["Noam Ben Ari"]
|
|
12
|
-
s.date = %q{2011-
|
|
12
|
+
s.date = %q{2011-04-04}
|
|
13
13
|
s.description = %q{Provides common authentication needs such as signing in/out, activating by email and resetting password.}
|
|
14
14
|
s.email = %q{nbenari@gmail.com}
|
|
15
15
|
s.extra_rdoc_files = [
|
|
@@ -25,11 +25,25 @@ Gem::Specification.new do |s|
|
|
|
25
25
|
"README.rdoc",
|
|
26
26
|
"Rakefile",
|
|
27
27
|
"VERSION",
|
|
28
|
+
"lib/generators/sorcery_migration/sorcery_migration_generator.rb",
|
|
29
|
+
"lib/generators/sorcery_migration/templates/activity_logging.rb",
|
|
30
|
+
"lib/generators/sorcery_migration/templates/brute_force_protection.rb",
|
|
31
|
+
"lib/generators/sorcery_migration/templates/core.rb",
|
|
32
|
+
"lib/generators/sorcery_migration/templates/oauth.rb",
|
|
33
|
+
"lib/generators/sorcery_migration/templates/remember_me.rb",
|
|
34
|
+
"lib/generators/sorcery_migration/templates/reset_password.rb",
|
|
35
|
+
"lib/generators/sorcery_migration/templates/user_activation.rb",
|
|
28
36
|
"lib/sorcery.rb",
|
|
29
37
|
"lib/sorcery/controller.rb",
|
|
38
|
+
"lib/sorcery/controller/adapters/sinatra.rb",
|
|
30
39
|
"lib/sorcery/controller/submodules/activity_logging.rb",
|
|
31
40
|
"lib/sorcery/controller/submodules/brute_force_protection.rb",
|
|
32
41
|
"lib/sorcery/controller/submodules/http_basic_auth.rb",
|
|
42
|
+
"lib/sorcery/controller/submodules/oauth.rb",
|
|
43
|
+
"lib/sorcery/controller/submodules/oauth/oauth1.rb",
|
|
44
|
+
"lib/sorcery/controller/submodules/oauth/oauth2.rb",
|
|
45
|
+
"lib/sorcery/controller/submodules/oauth/providers/facebook.rb",
|
|
46
|
+
"lib/sorcery/controller/submodules/oauth/providers/twitter.rb",
|
|
33
47
|
"lib/sorcery/controller/submodules/remember_me.rb",
|
|
34
48
|
"lib/sorcery/controller/submodules/session_timeout.rb",
|
|
35
49
|
"lib/sorcery/crypto_providers/aes256.rb",
|
|
@@ -42,23 +56,31 @@ Gem::Specification.new do |s|
|
|
|
42
56
|
"lib/sorcery/model.rb",
|
|
43
57
|
"lib/sorcery/model/submodules/activity_logging.rb",
|
|
44
58
|
"lib/sorcery/model/submodules/brute_force_protection.rb",
|
|
59
|
+
"lib/sorcery/model/submodules/oauth.rb",
|
|
45
60
|
"lib/sorcery/model/submodules/remember_me.rb",
|
|
46
61
|
"lib/sorcery/model/submodules/reset_password.rb",
|
|
47
62
|
"lib/sorcery/model/submodules/user_activation.rb",
|
|
63
|
+
"lib/sorcery/model/temporary_token.rb",
|
|
64
|
+
"lib/sorcery/sinatra.rb",
|
|
65
|
+
"lib/sorcery/test_helpers.rb",
|
|
66
|
+
"lib/sorcery/test_helpers/rails.rb",
|
|
67
|
+
"lib/sorcery/test_helpers/sinatra.rb",
|
|
48
68
|
"sorcery.gemspec",
|
|
49
69
|
"spec/Gemfile",
|
|
50
70
|
"spec/Gemfile.lock",
|
|
51
71
|
"spec/Rakefile",
|
|
52
72
|
"spec/rails3/.rspec",
|
|
53
|
-
"spec/rails3/Gemfile",
|
|
54
|
-
"spec/rails3/Gemfile.lock",
|
|
55
|
-
"spec/rails3/Rakefile",
|
|
56
73
|
"spec/rails3/app_root/.gitignore",
|
|
74
|
+
"spec/rails3/app_root/.rspec",
|
|
75
|
+
"spec/rails3/app_root/Gemfile",
|
|
76
|
+
"spec/rails3/app_root/Gemfile.lock",
|
|
57
77
|
"spec/rails3/app_root/README",
|
|
78
|
+
"spec/rails3/app_root/Rakefile",
|
|
58
79
|
"spec/rails3/app_root/Rakefile.unused",
|
|
59
80
|
"spec/rails3/app_root/app/controllers/application_controller.rb",
|
|
60
81
|
"spec/rails3/app_root/app/helpers/application_helper.rb",
|
|
61
82
|
"spec/rails3/app_root/app/mailers/sorcery_mailer.rb",
|
|
83
|
+
"spec/rails3/app_root/app/models/authentication.rb",
|
|
62
84
|
"spec/rails3/app_root/app/models/user.rb",
|
|
63
85
|
"spec/rails3/app_root/app/views/layouts/application.html.erb",
|
|
64
86
|
"spec/rails3/app_root/app/views/sorcery_mailer/activation_email.html.erb",
|
|
@@ -87,6 +109,7 @@ Gem::Specification.new do |s|
|
|
|
87
109
|
"spec/rails3/app_root/db/migrate/activity_logging/20101224223624_add_activity_logging_to_users.rb",
|
|
88
110
|
"spec/rails3/app_root/db/migrate/brute_force_protection/20101224223626_add_brute_force_protection_to_users.rb",
|
|
89
111
|
"spec/rails3/app_root/db/migrate/core/20101224223620_create_users.rb",
|
|
112
|
+
"spec/rails3/app_root/db/migrate/oauth/20101224223628_create_authentications.rb",
|
|
90
113
|
"spec/rails3/app_root/db/migrate/remember_me/20101224223623_add_remember_me_token_to_users.rb",
|
|
91
114
|
"spec/rails3/app_root/db/migrate/reset_password/20101224223622_add_reset_password_to_users.rb",
|
|
92
115
|
"spec/rails3/app_root/db/schema.rb",
|
|
@@ -107,36 +130,71 @@ Gem::Specification.new do |s|
|
|
|
107
130
|
"spec/rails3/app_root/public/robots.txt",
|
|
108
131
|
"spec/rails3/app_root/public/stylesheets/.gitkeep",
|
|
109
132
|
"spec/rails3/app_root/script/rails",
|
|
110
|
-
"spec/rails3/app_root/
|
|
111
|
-
"spec/rails3/app_root/
|
|
112
|
-
"spec/rails3/app_root/
|
|
113
|
-
"spec/rails3/app_root/
|
|
133
|
+
"spec/rails3/app_root/spec/controller_activity_logging_spec.rb",
|
|
134
|
+
"spec/rails3/app_root/spec/controller_brute_force_protection_spec.rb",
|
|
135
|
+
"spec/rails3/app_root/spec/controller_http_basic_auth_spec.rb",
|
|
136
|
+
"spec/rails3/app_root/spec/controller_oauth2_spec.rb",
|
|
137
|
+
"spec/rails3/app_root/spec/controller_oauth_spec.rb",
|
|
138
|
+
"spec/rails3/app_root/spec/controller_remember_me_spec.rb",
|
|
139
|
+
"spec/rails3/app_root/spec/controller_session_timeout_spec.rb",
|
|
140
|
+
"spec/rails3/app_root/spec/controller_spec.rb",
|
|
141
|
+
"spec/rails3/app_root/spec/spec_helper.orig.rb",
|
|
142
|
+
"spec/rails3/app_root/spec/spec_helper.rb",
|
|
143
|
+
"spec/rails3/app_root/spec/user_activation_spec.rb",
|
|
144
|
+
"spec/rails3/app_root/spec/user_activity_logging_spec.rb",
|
|
145
|
+
"spec/rails3/app_root/spec/user_brute_force_protection_spec.rb",
|
|
146
|
+
"spec/rails3/app_root/spec/user_oauth_spec.rb",
|
|
147
|
+
"spec/rails3/app_root/spec/user_remember_me_spec.rb",
|
|
148
|
+
"spec/rails3/app_root/spec/user_reset_password_spec.rb",
|
|
149
|
+
"spec/rails3/app_root/spec/user_spec.rb",
|
|
114
150
|
"spec/rails3/app_root/vendor/plugins/.gitkeep",
|
|
115
|
-
"spec/
|
|
116
|
-
"spec/
|
|
117
|
-
"spec/
|
|
118
|
-
"spec/
|
|
119
|
-
"spec/
|
|
120
|
-
"spec/
|
|
121
|
-
"spec/
|
|
122
|
-
"spec/
|
|
123
|
-
"spec/
|
|
124
|
-
"spec/
|
|
125
|
-
"spec/
|
|
126
|
-
"spec/
|
|
127
|
-
"spec/
|
|
151
|
+
"spec/sinatra/Gemfile",
|
|
152
|
+
"spec/sinatra/Gemfile.lock",
|
|
153
|
+
"spec/sinatra/Rakefile",
|
|
154
|
+
"spec/sinatra/authentication.rb",
|
|
155
|
+
"spec/sinatra/db/migrate/activation/20101224223622_add_activation_to_users.rb",
|
|
156
|
+
"spec/sinatra/db/migrate/activity_logging/20101224223624_add_activity_logging_to_users.rb",
|
|
157
|
+
"spec/sinatra/db/migrate/brute_force_protection/20101224223626_add_brute_force_protection_to_users.rb",
|
|
158
|
+
"spec/sinatra/db/migrate/core/20101224223620_create_users.rb",
|
|
159
|
+
"spec/sinatra/db/migrate/oauth/20101224223628_create_authentications.rb",
|
|
160
|
+
"spec/sinatra/db/migrate/remember_me/20101224223623_add_remember_me_token_to_users.rb",
|
|
161
|
+
"spec/sinatra/db/migrate/reset_password/20101224223622_add_reset_password_to_users.rb",
|
|
162
|
+
"spec/sinatra/filters.rb",
|
|
163
|
+
"spec/sinatra/myapp.rb",
|
|
164
|
+
"spec/sinatra/sorcery_mailer.rb",
|
|
165
|
+
"spec/sinatra/spec/controller_activity_logging_spec.rb",
|
|
166
|
+
"spec/sinatra/spec/controller_brute_force_protection_spec.rb",
|
|
167
|
+
"spec/sinatra/spec/controller_http_basic_auth_spec.rb",
|
|
168
|
+
"spec/sinatra/spec/controller_oauth2_spec.rb",
|
|
169
|
+
"spec/sinatra/spec/controller_oauth_spec.rb",
|
|
170
|
+
"spec/sinatra/spec/controller_remember_me_spec.rb",
|
|
171
|
+
"spec/sinatra/spec/controller_session_timeout_spec.rb",
|
|
172
|
+
"spec/sinatra/spec/controller_spec.rb",
|
|
173
|
+
"spec/sinatra/spec/spec.opts",
|
|
174
|
+
"spec/sinatra/spec/spec_helper.rb",
|
|
175
|
+
"spec/sinatra/spec/user_activation_spec.rb",
|
|
176
|
+
"spec/sinatra/spec/user_activity_logging_spec.rb",
|
|
177
|
+
"spec/sinatra/spec/user_brute_force_protection_spec.rb",
|
|
178
|
+
"spec/sinatra/spec/user_oauth_spec.rb",
|
|
179
|
+
"spec/sinatra/spec/user_remember_me_spec.rb",
|
|
180
|
+
"spec/sinatra/spec/user_reset_password_spec.rb",
|
|
181
|
+
"spec/sinatra/spec/user_spec.rb",
|
|
182
|
+
"spec/sinatra/user.rb",
|
|
183
|
+
"spec/sinatra/views/test_login.erb",
|
|
128
184
|
"spec/sorcery_crypto_providers_spec.rb",
|
|
129
|
-
"spec/spec_helper.rb"
|
|
185
|
+
"spec/spec_helper.rb",
|
|
186
|
+
"spec/untitled folder"
|
|
130
187
|
]
|
|
131
188
|
s.homepage = %q{http://github.com/NoamB/sorcery}
|
|
132
189
|
s.licenses = ["MIT"]
|
|
133
190
|
s.require_paths = ["lib"]
|
|
134
|
-
s.rubygems_version = %q{1.
|
|
191
|
+
s.rubygems_version = %q{1.6.2}
|
|
135
192
|
s.summary = %q{Magical authentication for Rails 3 applications}
|
|
136
193
|
s.test_files = [
|
|
137
194
|
"spec/rails3/app_root/app/controllers/application_controller.rb",
|
|
138
195
|
"spec/rails3/app_root/app/helpers/application_helper.rb",
|
|
139
196
|
"spec/rails3/app_root/app/mailers/sorcery_mailer.rb",
|
|
197
|
+
"spec/rails3/app_root/app/models/authentication.rb",
|
|
140
198
|
"spec/rails3/app_root/app/models/user.rb",
|
|
141
199
|
"spec/rails3/app_root/config/application.rb",
|
|
142
200
|
"spec/rails3/app_root/config/boot.rb",
|
|
@@ -155,26 +213,56 @@ Gem::Specification.new do |s|
|
|
|
155
213
|
"spec/rails3/app_root/db/migrate/activity_logging/20101224223624_add_activity_logging_to_users.rb",
|
|
156
214
|
"spec/rails3/app_root/db/migrate/brute_force_protection/20101224223626_add_brute_force_protection_to_users.rb",
|
|
157
215
|
"spec/rails3/app_root/db/migrate/core/20101224223620_create_users.rb",
|
|
216
|
+
"spec/rails3/app_root/db/migrate/oauth/20101224223628_create_authentications.rb",
|
|
158
217
|
"spec/rails3/app_root/db/migrate/remember_me/20101224223623_add_remember_me_token_to_users.rb",
|
|
159
218
|
"spec/rails3/app_root/db/migrate/reset_password/20101224223622_add_reset_password_to_users.rb",
|
|
160
219
|
"spec/rails3/app_root/db/schema.rb",
|
|
161
220
|
"spec/rails3/app_root/db/seeds.rb",
|
|
162
|
-
"spec/rails3/app_root/
|
|
163
|
-
"spec/rails3/app_root/
|
|
164
|
-
"spec/rails3/app_root/
|
|
165
|
-
"spec/rails3/
|
|
166
|
-
"spec/rails3/
|
|
167
|
-
"spec/rails3/
|
|
168
|
-
"spec/rails3/
|
|
169
|
-
"spec/rails3/
|
|
170
|
-
"spec/rails3/
|
|
171
|
-
"spec/rails3/spec_helper.rb",
|
|
172
|
-
"spec/rails3/user_activation_spec.rb",
|
|
173
|
-
"spec/rails3/user_activity_logging_spec.rb",
|
|
174
|
-
"spec/rails3/user_brute_force_protection_spec.rb",
|
|
175
|
-
"spec/rails3/
|
|
176
|
-
"spec/rails3/
|
|
177
|
-
"spec/rails3/
|
|
221
|
+
"spec/rails3/app_root/spec/controller_activity_logging_spec.rb",
|
|
222
|
+
"spec/rails3/app_root/spec/controller_brute_force_protection_spec.rb",
|
|
223
|
+
"spec/rails3/app_root/spec/controller_http_basic_auth_spec.rb",
|
|
224
|
+
"spec/rails3/app_root/spec/controller_oauth2_spec.rb",
|
|
225
|
+
"spec/rails3/app_root/spec/controller_oauth_spec.rb",
|
|
226
|
+
"spec/rails3/app_root/spec/controller_remember_me_spec.rb",
|
|
227
|
+
"spec/rails3/app_root/spec/controller_session_timeout_spec.rb",
|
|
228
|
+
"spec/rails3/app_root/spec/controller_spec.rb",
|
|
229
|
+
"spec/rails3/app_root/spec/spec_helper.orig.rb",
|
|
230
|
+
"spec/rails3/app_root/spec/spec_helper.rb",
|
|
231
|
+
"spec/rails3/app_root/spec/user_activation_spec.rb",
|
|
232
|
+
"spec/rails3/app_root/spec/user_activity_logging_spec.rb",
|
|
233
|
+
"spec/rails3/app_root/spec/user_brute_force_protection_spec.rb",
|
|
234
|
+
"spec/rails3/app_root/spec/user_oauth_spec.rb",
|
|
235
|
+
"spec/rails3/app_root/spec/user_remember_me_spec.rb",
|
|
236
|
+
"spec/rails3/app_root/spec/user_reset_password_spec.rb",
|
|
237
|
+
"spec/rails3/app_root/spec/user_spec.rb",
|
|
238
|
+
"spec/sinatra/authentication.rb",
|
|
239
|
+
"spec/sinatra/db/migrate/activation/20101224223622_add_activation_to_users.rb",
|
|
240
|
+
"spec/sinatra/db/migrate/activity_logging/20101224223624_add_activity_logging_to_users.rb",
|
|
241
|
+
"spec/sinatra/db/migrate/brute_force_protection/20101224223626_add_brute_force_protection_to_users.rb",
|
|
242
|
+
"spec/sinatra/db/migrate/core/20101224223620_create_users.rb",
|
|
243
|
+
"spec/sinatra/db/migrate/oauth/20101224223628_create_authentications.rb",
|
|
244
|
+
"spec/sinatra/db/migrate/remember_me/20101224223623_add_remember_me_token_to_users.rb",
|
|
245
|
+
"spec/sinatra/db/migrate/reset_password/20101224223622_add_reset_password_to_users.rb",
|
|
246
|
+
"spec/sinatra/filters.rb",
|
|
247
|
+
"spec/sinatra/myapp.rb",
|
|
248
|
+
"spec/sinatra/sorcery_mailer.rb",
|
|
249
|
+
"spec/sinatra/spec/controller_activity_logging_spec.rb",
|
|
250
|
+
"spec/sinatra/spec/controller_brute_force_protection_spec.rb",
|
|
251
|
+
"spec/sinatra/spec/controller_http_basic_auth_spec.rb",
|
|
252
|
+
"spec/sinatra/spec/controller_oauth2_spec.rb",
|
|
253
|
+
"spec/sinatra/spec/controller_oauth_spec.rb",
|
|
254
|
+
"spec/sinatra/spec/controller_remember_me_spec.rb",
|
|
255
|
+
"spec/sinatra/spec/controller_session_timeout_spec.rb",
|
|
256
|
+
"spec/sinatra/spec/controller_spec.rb",
|
|
257
|
+
"spec/sinatra/spec/spec_helper.rb",
|
|
258
|
+
"spec/sinatra/spec/user_activation_spec.rb",
|
|
259
|
+
"spec/sinatra/spec/user_activity_logging_spec.rb",
|
|
260
|
+
"spec/sinatra/spec/user_brute_force_protection_spec.rb",
|
|
261
|
+
"spec/sinatra/spec/user_oauth_spec.rb",
|
|
262
|
+
"spec/sinatra/spec/user_remember_me_spec.rb",
|
|
263
|
+
"spec/sinatra/spec/user_reset_password_spec.rb",
|
|
264
|
+
"spec/sinatra/spec/user_spec.rb",
|
|
265
|
+
"spec/sinatra/user.rb",
|
|
178
266
|
"spec/sorcery_crypto_providers_spec.rb",
|
|
179
267
|
"spec/spec_helper.rb"
|
|
180
268
|
]
|
|
@@ -183,7 +271,10 @@ Gem::Specification.new do |s|
|
|
|
183
271
|
s.specification_version = 3
|
|
184
272
|
|
|
185
273
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
|
186
|
-
s.
|
|
274
|
+
s.add_runtime_dependency(%q<rails>, [">= 3.0.0"])
|
|
275
|
+
s.add_runtime_dependency(%q<json>, [">= 1.5.1"])
|
|
276
|
+
s.add_runtime_dependency(%q<oauth>, [">= 0.4.4"])
|
|
277
|
+
s.add_runtime_dependency(%q<oauth2>, [">= 0.1.1"])
|
|
187
278
|
s.add_development_dependency(%q<rspec>, ["~> 2.3.0"])
|
|
188
279
|
s.add_development_dependency(%q<rspec-rails>, [">= 0"])
|
|
189
280
|
s.add_development_dependency(%q<ruby-debug19>, [">= 0"])
|
|
@@ -193,8 +284,13 @@ Gem::Specification.new do |s|
|
|
|
193
284
|
s.add_development_dependency(%q<jeweler>, ["~> 1.5.2"])
|
|
194
285
|
s.add_development_dependency(%q<simplecov>, [">= 0.3.8"])
|
|
195
286
|
s.add_runtime_dependency(%q<bcrypt-ruby>, ["~> 2.1.4"])
|
|
287
|
+
s.add_runtime_dependency(%q<oauth>, [">= 0.4.4"])
|
|
288
|
+
s.add_runtime_dependency(%q<oauth2>, [">= 0.1.1"])
|
|
196
289
|
else
|
|
197
290
|
s.add_dependency(%q<rails>, [">= 3.0.0"])
|
|
291
|
+
s.add_dependency(%q<json>, [">= 1.5.1"])
|
|
292
|
+
s.add_dependency(%q<oauth>, [">= 0.4.4"])
|
|
293
|
+
s.add_dependency(%q<oauth2>, [">= 0.1.1"])
|
|
198
294
|
s.add_dependency(%q<rspec>, ["~> 2.3.0"])
|
|
199
295
|
s.add_dependency(%q<rspec-rails>, [">= 0"])
|
|
200
296
|
s.add_dependency(%q<ruby-debug19>, [">= 0"])
|
|
@@ -204,9 +300,14 @@ Gem::Specification.new do |s|
|
|
|
204
300
|
s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
|
|
205
301
|
s.add_dependency(%q<simplecov>, [">= 0.3.8"])
|
|
206
302
|
s.add_dependency(%q<bcrypt-ruby>, ["~> 2.1.4"])
|
|
303
|
+
s.add_dependency(%q<oauth>, [">= 0.4.4"])
|
|
304
|
+
s.add_dependency(%q<oauth2>, [">= 0.1.1"])
|
|
207
305
|
end
|
|
208
306
|
else
|
|
209
307
|
s.add_dependency(%q<rails>, [">= 3.0.0"])
|
|
308
|
+
s.add_dependency(%q<json>, [">= 1.5.1"])
|
|
309
|
+
s.add_dependency(%q<oauth>, [">= 0.4.4"])
|
|
310
|
+
s.add_dependency(%q<oauth2>, [">= 0.1.1"])
|
|
210
311
|
s.add_dependency(%q<rspec>, ["~> 2.3.0"])
|
|
211
312
|
s.add_dependency(%q<rspec-rails>, [">= 0"])
|
|
212
313
|
s.add_dependency(%q<ruby-debug19>, [">= 0"])
|
|
@@ -216,6 +317,8 @@ Gem::Specification.new do |s|
|
|
|
216
317
|
s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
|
|
217
318
|
s.add_dependency(%q<simplecov>, [">= 0.3.8"])
|
|
218
319
|
s.add_dependency(%q<bcrypt-ruby>, ["~> 2.1.4"])
|
|
320
|
+
s.add_dependency(%q<oauth>, [">= 0.4.4"])
|
|
321
|
+
s.add_dependency(%q<oauth2>, [">= 0.1.1"])
|
|
219
322
|
end
|
|
220
323
|
end
|
|
221
324
|
|
data/spec/Gemfile
CHANGED
|
@@ -2,8 +2,9 @@ source 'http://rubygems.org'
|
|
|
2
2
|
|
|
3
3
|
gem "rails", '3.0.3'
|
|
4
4
|
gem 'bcrypt-ruby', :require => 'bcrypt'
|
|
5
|
-
gem "sorcery", '0.
|
|
6
|
-
|
|
5
|
+
gem "sorcery", '0.3.0', :path => '../../../'
|
|
6
|
+
gem 'oauth', ">= 0.4.4"
|
|
7
|
+
gem 'oauth2', ">= 0.1.1"
|
|
7
8
|
group :development do
|
|
8
9
|
gem 'rspec'
|
|
9
10
|
gem 'ruby-debug19'
|
data/spec/Gemfile.lock
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: ../../../
|
|
3
3
|
specs:
|
|
4
|
-
sorcery (0.
|
|
4
|
+
sorcery (0.3.0)
|
|
5
5
|
|
|
6
6
|
GEM
|
|
7
7
|
remote: http://rubygems.org/
|
|
@@ -33,6 +33,7 @@ GEM
|
|
|
33
33
|
activemodel (= 3.0.3)
|
|
34
34
|
activesupport (= 3.0.3)
|
|
35
35
|
activesupport (3.0.3)
|
|
36
|
+
addressable (2.2.4)
|
|
36
37
|
archive-tar-minitar (0.5.2)
|
|
37
38
|
arel (2.0.6)
|
|
38
39
|
bcrypt-ruby (2.1.3)
|
|
@@ -41,6 +42,10 @@ GEM
|
|
|
41
42
|
diff-lcs (1.1.2)
|
|
42
43
|
erubis (2.6.6)
|
|
43
44
|
abstract (>= 1.0.0)
|
|
45
|
+
faraday (0.5.5)
|
|
46
|
+
addressable (~> 2.2.4)
|
|
47
|
+
multipart-post (~> 1.1.0)
|
|
48
|
+
rack (< 2, >= 1.1.0)
|
|
44
49
|
i18n (0.5.0)
|
|
45
50
|
linecache19 (0.5.11)
|
|
46
51
|
ruby_core_source (>= 0.1.4)
|
|
@@ -50,6 +55,12 @@ GEM
|
|
|
50
55
|
mime-types (~> 1.16)
|
|
51
56
|
treetop (~> 1.4.8)
|
|
52
57
|
mime-types (1.16)
|
|
58
|
+
multi_json (0.0.5)
|
|
59
|
+
multipart-post (1.1.0)
|
|
60
|
+
oauth (0.4.4)
|
|
61
|
+
oauth2 (0.1.1)
|
|
62
|
+
faraday (~> 0.5.0)
|
|
63
|
+
multi_json (~> 0.0.4)
|
|
53
64
|
polyglot (0.3.1)
|
|
54
65
|
rack (1.2.1)
|
|
55
66
|
rack-mount (0.6.13)
|
|
@@ -101,8 +112,10 @@ PLATFORMS
|
|
|
101
112
|
|
|
102
113
|
DEPENDENCIES
|
|
103
114
|
bcrypt-ruby
|
|
115
|
+
oauth (>= 0.4.4)
|
|
116
|
+
oauth2 (>= 0.1.1)
|
|
104
117
|
rails (= 3.0.3)
|
|
105
118
|
rspec
|
|
106
119
|
ruby-debug19
|
|
107
120
|
simplecov (>= 0.3.8)
|
|
108
|
-
sorcery (= 0.
|
|
121
|
+
sorcery (= 0.3.0)!
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
--colour
|
|
@@ -2,12 +2,12 @@ source 'http://rubygems.org'
|
|
|
2
2
|
|
|
3
3
|
gem 'rails', '3.0.3'
|
|
4
4
|
gem 'sqlite3-ruby', :require => 'sqlite3'
|
|
5
|
-
gem "sorcery", '0.
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
group :development do
|
|
5
|
+
gem "sorcery", '0.3.0', :path => '../../../'
|
|
6
|
+
|
|
7
|
+
group :development, :test do
|
|
9
8
|
gem 'rspec'
|
|
10
9
|
gem 'rspec-rails'
|
|
11
10
|
gem 'ruby-debug19'
|
|
12
11
|
gem 'simplecov', '>= 0.3.8', :require => false # Will install simplecov-html as a dependency
|
|
12
|
+
gem 'spork', '~> 0.9.0.rc'
|
|
13
13
|
end
|
|
@@ -1,7 +1,14 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: ../../../
|
|
3
3
|
specs:
|
|
4
|
-
sorcery (0.
|
|
4
|
+
sorcery (0.3.0)
|
|
5
|
+
bcrypt-ruby (~> 2.1.4)
|
|
6
|
+
json (>= 1.5.1)
|
|
7
|
+
oauth (>= 0.4.4)
|
|
8
|
+
oauth (>= 0.4.4)
|
|
9
|
+
oauth2 (>= 0.1.1)
|
|
10
|
+
oauth2 (>= 0.1.1)
|
|
11
|
+
rails (>= 3.0.0)
|
|
5
12
|
|
|
6
13
|
GEM
|
|
7
14
|
remote: http://rubygems.org/
|
|
@@ -33,6 +40,7 @@ GEM
|
|
|
33
40
|
activemodel (= 3.0.3)
|
|
34
41
|
activesupport (= 3.0.3)
|
|
35
42
|
activesupport (3.0.3)
|
|
43
|
+
addressable (2.2.4)
|
|
36
44
|
archive-tar-minitar (0.5.2)
|
|
37
45
|
arel (2.0.6)
|
|
38
46
|
bcrypt-ruby (2.1.4)
|
|
@@ -41,7 +49,12 @@ GEM
|
|
|
41
49
|
diff-lcs (1.1.2)
|
|
42
50
|
erubis (2.6.6)
|
|
43
51
|
abstract (>= 1.0.0)
|
|
52
|
+
faraday (0.5.5)
|
|
53
|
+
addressable (~> 2.2.4)
|
|
54
|
+
multipart-post (~> 1.1.0)
|
|
55
|
+
rack (< 2, >= 1.1.0)
|
|
44
56
|
i18n (0.5.0)
|
|
57
|
+
json (1.5.1)
|
|
45
58
|
linecache19 (0.5.11)
|
|
46
59
|
ruby_core_source (>= 0.1.4)
|
|
47
60
|
mail (2.2.13)
|
|
@@ -50,6 +63,12 @@ GEM
|
|
|
50
63
|
mime-types (~> 1.16)
|
|
51
64
|
treetop (~> 1.4.8)
|
|
52
65
|
mime-types (1.16)
|
|
66
|
+
multi_json (0.0.5)
|
|
67
|
+
multipart-post (1.1.0)
|
|
68
|
+
oauth (0.4.4)
|
|
69
|
+
oauth2 (0.1.1)
|
|
70
|
+
faraday (~> 0.5.0)
|
|
71
|
+
multi_json (~> 0.0.4)
|
|
53
72
|
polyglot (0.3.1)
|
|
54
73
|
rack (1.2.1)
|
|
55
74
|
rack-mount (0.6.13)
|
|
@@ -96,6 +115,7 @@ GEM
|
|
|
96
115
|
simplecov (0.3.9)
|
|
97
116
|
simplecov-html (>= 0.3.7)
|
|
98
117
|
simplecov-html (0.3.9)
|
|
118
|
+
spork (0.9.0.rc3)
|
|
99
119
|
sqlite3-ruby (1.3.2)
|
|
100
120
|
thor (0.14.6)
|
|
101
121
|
treetop (1.4.9)
|
|
@@ -106,11 +126,11 @@ PLATFORMS
|
|
|
106
126
|
ruby
|
|
107
127
|
|
|
108
128
|
DEPENDENCIES
|
|
109
|
-
bcrypt-ruby (~> 2.1.4)
|
|
110
129
|
rails (= 3.0.3)
|
|
111
130
|
rspec
|
|
112
131
|
rspec-rails
|
|
113
132
|
ruby-debug19
|
|
114
133
|
simplecov (>= 0.3.8)
|
|
115
|
-
sorcery (= 0.
|
|
134
|
+
sorcery (= 0.3.0)!
|
|
135
|
+
spork (~> 0.9.0.rc)
|
|
116
136
|
sqlite3-ruby
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
require 'oauth'
|
|
2
|
+
|
|
1
3
|
class ApplicationController < ActionController::Base
|
|
2
4
|
protect_from_forgery
|
|
3
5
|
|
|
@@ -18,6 +20,11 @@ class ApplicationController < ActionController::Base
|
|
|
18
20
|
render :text => ""
|
|
19
21
|
end
|
|
20
22
|
|
|
23
|
+
def test_return_to
|
|
24
|
+
@user = login(params[:username], params[:password])
|
|
25
|
+
return_or_redirect_to(:index, :notice => 'haha!')
|
|
26
|
+
end
|
|
27
|
+
|
|
21
28
|
def test_logout
|
|
22
29
|
logout
|
|
23
30
|
render :text => ""
|
|
@@ -43,7 +50,7 @@ class ApplicationController < ActionController::Base
|
|
|
43
50
|
end
|
|
44
51
|
|
|
45
52
|
def test_login_from_cookie
|
|
46
|
-
@user =
|
|
53
|
+
@user = current_user
|
|
47
54
|
render :text => ""
|
|
48
55
|
end
|
|
49
56
|
|
|
@@ -59,6 +66,40 @@ class ApplicationController < ActionController::Base
|
|
|
59
66
|
render :text => "HTTP Basic Auth"
|
|
60
67
|
end
|
|
61
68
|
|
|
69
|
+
def auth_at_provider_test
|
|
70
|
+
auth_at_provider(:twitter)
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
def auth_at_provider_test2
|
|
74
|
+
auth_at_provider(:facebook)
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
def test_login_from_access_token
|
|
78
|
+
if @user = login_from_access_token(:twitter)
|
|
79
|
+
redirect_to "bla", :notice => "Success!"
|
|
80
|
+
else
|
|
81
|
+
redirect_to "blu", :alert => "Failed!"
|
|
82
|
+
end
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
def test_login_from_access_token2
|
|
86
|
+
if @user = login_from_access_token(:facebook)
|
|
87
|
+
redirect_to "bla", :notice => "Success!"
|
|
88
|
+
else
|
|
89
|
+
redirect_to "blu", :alert => "Failed!"
|
|
90
|
+
end
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
def test_create_from_provider
|
|
94
|
+
provider = params[:provider]
|
|
95
|
+
login_from_access_token(provider)
|
|
96
|
+
if @user = create_from_provider!(provider)
|
|
97
|
+
redirect_to "bla", :notice => "Success!"
|
|
98
|
+
else
|
|
99
|
+
redirect_to "blu", :alert => "Failed!"
|
|
100
|
+
end
|
|
101
|
+
end
|
|
102
|
+
|
|
62
103
|
protected
|
|
63
104
|
|
|
64
105
|
|
|
@@ -38,9 +38,7 @@ module AppRoot
|
|
|
38
38
|
|
|
39
39
|
# Configure sensitive parameters which will be filtered from the log file.
|
|
40
40
|
config.filter_parameters += [:password]
|
|
41
|
-
|
|
42
|
-
config.root = File.expand_path('../..', __FILE__)
|
|
43
|
-
|
|
41
|
+
|
|
44
42
|
config.action_mailer.delivery_method = :test
|
|
45
43
|
|
|
46
44
|
config.active_support.deprecation = :stderr
|
|
@@ -1,14 +1,5 @@
|
|
|
1
1
|
AppRoot::Application.routes.draw do
|
|
2
2
|
root :to => "application#index"
|
|
3
|
-
match '/test_login', :to => "application#test_login"
|
|
4
|
-
match '/test_logout', :to => "application#test_logout"
|
|
5
|
-
match '/some_action', :to => "application#some_action"
|
|
6
|
-
match '/test_logout_with_remember', :to => "application#test_logout_with_remember"
|
|
7
|
-
match '/test_login_with_remember', :to => 'application#test_login_with_remember'
|
|
8
|
-
match '/test_login_with_remember_in_login', :to => 'application#test_login_with_remember_in_login'
|
|
9
|
-
match '/test_login_from_cookie', :to => 'application#test_login_from_cookie'
|
|
10
|
-
match '/test_should_be_logged_in', :to => 'application#test_should_be_logged_in'
|
|
11
|
-
match '/test_http_basic_auth', :to => 'application#test_http_basic_auth'
|
|
12
3
|
# The priority is based upon order of creation:
|
|
13
4
|
# first created -> highest priority.
|
|
14
5
|
|
|
@@ -64,5 +55,5 @@ AppRoot::Application.routes.draw do
|
|
|
64
55
|
|
|
65
56
|
# This is a legacy wild controller route that's not recommended for RESTful applications.
|
|
66
57
|
# Note: This route will make all actions in every controller accessible via GET requests.
|
|
67
|
-
|
|
58
|
+
match ':controller(/:action(/:id(.:format)))'
|
|
68
59
|
end
|
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
class AddActivationToUsers < ActiveRecord::Migration
|
|
2
2
|
def self.up
|
|
3
3
|
add_column :users, :activation_state, :string, :default => nil
|
|
4
|
-
add_column :users, :
|
|
4
|
+
add_column :users, :activation_token, :string, :default => nil
|
|
5
|
+
add_column :users, :activation_token_expires_at, :datetime, :default => nil
|
|
5
6
|
|
|
6
|
-
add_index :users, :
|
|
7
|
+
add_index :users, :activation_token
|
|
7
8
|
end
|
|
8
9
|
|
|
9
10
|
def self.down
|
|
10
|
-
remove_index :users, :
|
|
11
|
+
remove_index :users, :activation_token
|
|
11
12
|
|
|
12
|
-
remove_column :users, :
|
|
13
|
+
remove_column :users, :activation_token_expires_at
|
|
14
|
+
remove_column :users, :activation_token
|
|
13
15
|
remove_column :users, :activation_state
|
|
14
16
|
end
|
|
15
17
|
end
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
class CreateUsers < ActiveRecord::Migration
|
|
2
2
|
def self.up
|
|
3
3
|
create_table :users do |t|
|
|
4
|
-
t.string :username
|
|
5
|
-
t.string :email,
|
|
6
|
-
t.string :crypted_password
|
|
7
|
-
t.string :salt
|
|
4
|
+
t.string :username, :null => false
|
|
5
|
+
t.string :email, :default => nil
|
|
6
|
+
t.string :crypted_password, :default => nil
|
|
7
|
+
t.string :salt, :default => nil
|
|
8
8
|
|
|
9
9
|
t.timestamps
|
|
10
10
|
end
|