devise 3.0.0 → 4.8.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (242) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG.md +351 -0
  3. data/MIT-LICENSE +2 -1
  4. data/README.md +422 -130
  5. data/app/controllers/devise/confirmations_controller.rb +17 -6
  6. data/app/controllers/devise/omniauth_callbacks_controller.rb +12 -6
  7. data/app/controllers/devise/passwords_controller.rb +23 -8
  8. data/app/controllers/devise/registrations_controller.rb +70 -28
  9. data/app/controllers/devise/sessions_controller.rb +49 -17
  10. data/app/controllers/devise/unlocks_controller.rb +11 -4
  11. data/app/controllers/devise_controller.rb +74 -34
  12. data/app/helpers/devise_helper.rb +23 -18
  13. data/app/mailers/devise/mailer.rb +25 -10
  14. data/app/views/devise/confirmations/new.html.erb +9 -5
  15. data/app/views/devise/mailer/confirmation_instructions.html.erb +1 -1
  16. data/app/views/devise/mailer/email_changed.html.erb +7 -0
  17. data/app/views/devise/mailer/password_change.html.erb +3 -0
  18. data/app/views/devise/mailer/reset_password_instructions.html.erb +1 -1
  19. data/app/views/devise/mailer/unlock_instructions.html.erb +1 -1
  20. data/app/views/devise/passwords/edit.html.erb +16 -7
  21. data/app/views/devise/passwords/new.html.erb +9 -5
  22. data/app/views/devise/registrations/edit.html.erb +29 -15
  23. data/app/views/devise/registrations/new.html.erb +20 -9
  24. data/app/views/devise/sessions/new.html.erb +19 -10
  25. data/app/views/devise/shared/_error_messages.html.erb +15 -0
  26. data/app/views/devise/shared/{_links.erb → _links.html.erb} +10 -10
  27. data/app/views/devise/unlocks/new.html.erb +9 -5
  28. data/config/locales/en.yml +26 -20
  29. data/lib/devise/controllers/helpers.rb +122 -125
  30. data/lib/devise/controllers/rememberable.rb +14 -14
  31. data/lib/devise/controllers/scoped_views.rb +3 -1
  32. data/lib/devise/controllers/sign_in_out.rb +121 -0
  33. data/lib/devise/controllers/store_location.rb +76 -0
  34. data/lib/devise/controllers/url_helpers.rb +10 -8
  35. data/lib/devise/delegator.rb +2 -0
  36. data/lib/devise/encryptor.rb +24 -0
  37. data/lib/devise/failure_app.rb +132 -42
  38. data/lib/devise/hooks/activatable.rb +7 -6
  39. data/lib/devise/hooks/csrf_cleaner.rb +9 -0
  40. data/lib/devise/hooks/forgetable.rb +3 -1
  41. data/lib/devise/hooks/lockable.rb +5 -3
  42. data/lib/devise/hooks/proxy.rb +23 -0
  43. data/lib/devise/hooks/rememberable.rb +7 -4
  44. data/lib/devise/hooks/timeoutable.rb +18 -8
  45. data/lib/devise/hooks/trackable.rb +3 -1
  46. data/lib/devise/mailers/helpers.rb +15 -18
  47. data/lib/devise/mapping.rb +9 -3
  48. data/lib/devise/models/authenticatable.rb +102 -80
  49. data/lib/devise/models/confirmable.rb +154 -72
  50. data/lib/devise/models/database_authenticatable.rb +125 -25
  51. data/lib/devise/models/lockable.rb +50 -29
  52. data/lib/devise/models/omniauthable.rb +3 -1
  53. data/lib/devise/models/recoverable.rb +72 -50
  54. data/lib/devise/models/registerable.rb +4 -0
  55. data/lib/devise/models/rememberable.rb +65 -32
  56. data/lib/devise/models/timeoutable.rb +4 -8
  57. data/lib/devise/models/trackable.rb +20 -4
  58. data/lib/devise/models/validatable.rb +16 -9
  59. data/lib/devise/models.rb +6 -13
  60. data/lib/devise/modules.rb +12 -11
  61. data/lib/devise/omniauth/config.rb +2 -0
  62. data/lib/devise/omniauth/url_helpers.rb +14 -5
  63. data/lib/devise/omniauth.rb +4 -5
  64. data/lib/devise/orm/active_record.rb +5 -1
  65. data/lib/devise/orm/mongoid.rb +6 -2
  66. data/lib/devise/parameter_filter.rb +4 -0
  67. data/lib/devise/parameter_sanitizer.rb +144 -34
  68. data/lib/devise/rails/deprecated_constant_accessor.rb +39 -0
  69. data/lib/devise/rails/routes.rb +191 -127
  70. data/lib/devise/rails/warden_compat.rb +2 -1
  71. data/lib/devise/rails.rb +13 -20
  72. data/lib/devise/secret_key_finder.rb +27 -0
  73. data/lib/devise/strategies/authenticatable.rb +21 -22
  74. data/lib/devise/strategies/base.rb +3 -1
  75. data/lib/devise/strategies/database_authenticatable.rb +15 -4
  76. data/lib/devise/strategies/rememberable.rb +15 -3
  77. data/lib/devise/test/controller_helpers.rb +167 -0
  78. data/lib/devise/test/integration_helpers.rb +63 -0
  79. data/lib/devise/test_helpers.rb +7 -123
  80. data/lib/devise/time_inflector.rb +4 -2
  81. data/lib/devise/token_generator.rb +32 -0
  82. data/lib/devise/version.rb +3 -1
  83. data/lib/devise.rb +124 -78
  84. data/lib/generators/active_record/devise_generator.rb +64 -15
  85. data/lib/generators/active_record/templates/migration.rb +9 -8
  86. data/lib/generators/active_record/templates/migration_existing.rb +9 -8
  87. data/lib/generators/devise/controllers_generator.rb +46 -0
  88. data/lib/generators/devise/devise_generator.rb +10 -6
  89. data/lib/generators/devise/install_generator.rb +19 -1
  90. data/lib/generators/devise/orm_helpers.rb +17 -9
  91. data/lib/generators/devise/views_generator.rb +51 -28
  92. data/lib/generators/mongoid/devise_generator.rb +24 -24
  93. data/lib/generators/templates/README +13 -12
  94. data/lib/generators/templates/controllers/README +14 -0
  95. data/lib/generators/templates/controllers/confirmations_controller.rb +30 -0
  96. data/lib/generators/templates/controllers/omniauth_callbacks_controller.rb +30 -0
  97. data/lib/generators/templates/controllers/passwords_controller.rb +34 -0
  98. data/lib/generators/templates/controllers/registrations_controller.rb +62 -0
  99. data/lib/generators/templates/controllers/sessions_controller.rb +27 -0
  100. data/lib/generators/templates/controllers/unlocks_controller.rb +30 -0
  101. data/lib/generators/templates/devise.rb +118 -53
  102. data/lib/generators/templates/markerb/confirmation_instructions.markerb +1 -1
  103. data/lib/generators/templates/markerb/email_changed.markerb +7 -0
  104. data/lib/generators/templates/markerb/password_change.markerb +3 -0
  105. data/lib/generators/templates/markerb/reset_password_instructions.markerb +1 -1
  106. data/lib/generators/templates/markerb/unlock_instructions.markerb +1 -1
  107. data/lib/generators/templates/simple_form_for/confirmations/new.html.erb +6 -2
  108. data/lib/generators/templates/simple_form_for/passwords/edit.html.erb +12 -4
  109. data/lib/generators/templates/simple_form_for/passwords/new.html.erb +5 -2
  110. data/lib/generators/templates/simple_form_for/registrations/edit.html.erb +14 -6
  111. data/lib/generators/templates/simple_form_for/registrations/new.html.erb +12 -4
  112. data/lib/generators/templates/simple_form_for/sessions/new.html.erb +11 -6
  113. data/lib/generators/templates/simple_form_for/unlocks/new.html.erb +5 -2
  114. metadata +73 -294
  115. data/.gitignore +0 -10
  116. data/.travis.yml +0 -20
  117. data/.yardopts +0 -9
  118. data/CHANGELOG.rdoc +0 -941
  119. data/CONTRIBUTING.md +0 -14
  120. data/Gemfile +0 -31
  121. data/Gemfile.lock +0 -159
  122. data/Rakefile +0 -35
  123. data/app/views/devise/_links.erb +0 -3
  124. data/devise.gemspec +0 -26
  125. data/devise.png +0 -0
  126. data/gemfiles/Gemfile.rails-3.2.x +0 -31
  127. data/gemfiles/Gemfile.rails-3.2.x.lock +0 -156
  128. data/lib/devise/models/token_authenticatable.rb +0 -89
  129. data/lib/devise/strategies/token_authenticatable.rb +0 -91
  130. data/test/controllers/custom_strategy_test.rb +0 -62
  131. data/test/controllers/helpers_test.rb +0 -253
  132. data/test/controllers/internal_helpers_test.rb +0 -120
  133. data/test/controllers/passwords_controller_test.rb +0 -32
  134. data/test/controllers/sessions_controller_test.rb +0 -99
  135. data/test/controllers/url_helpers_test.rb +0 -59
  136. data/test/delegator_test.rb +0 -19
  137. data/test/devise_test.rb +0 -83
  138. data/test/failure_app_test.rb +0 -221
  139. data/test/generators/active_record_generator_test.rb +0 -73
  140. data/test/generators/devise_generator_test.rb +0 -39
  141. data/test/generators/install_generator_test.rb +0 -13
  142. data/test/generators/mongoid_generator_test.rb +0 -23
  143. data/test/generators/views_generator_test.rb +0 -67
  144. data/test/helpers/devise_helper_test.rb +0 -51
  145. data/test/integration/authenticatable_test.rb +0 -699
  146. data/test/integration/confirmable_test.rb +0 -299
  147. data/test/integration/database_authenticatable_test.rb +0 -84
  148. data/test/integration/http_authenticatable_test.rb +0 -115
  149. data/test/integration/lockable_test.rb +0 -242
  150. data/test/integration/omniauthable_test.rb +0 -133
  151. data/test/integration/recoverable_test.rb +0 -335
  152. data/test/integration/registerable_test.rb +0 -349
  153. data/test/integration/rememberable_test.rb +0 -165
  154. data/test/integration/timeoutable_test.rb +0 -150
  155. data/test/integration/token_authenticatable_test.rb +0 -205
  156. data/test/integration/trackable_test.rb +0 -92
  157. data/test/mailers/confirmation_instructions_test.rb +0 -111
  158. data/test/mailers/reset_password_instructions_test.rb +0 -92
  159. data/test/mailers/unlock_instructions_test.rb +0 -87
  160. data/test/mapping_test.rb +0 -127
  161. data/test/models/authenticatable_test.rb +0 -13
  162. data/test/models/confirmable_test.rb +0 -452
  163. data/test/models/database_authenticatable_test.rb +0 -226
  164. data/test/models/lockable_test.rb +0 -282
  165. data/test/models/omniauthable_test.rb +0 -7
  166. data/test/models/recoverable_test.rb +0 -222
  167. data/test/models/registerable_test.rb +0 -7
  168. data/test/models/rememberable_test.rb +0 -175
  169. data/test/models/serializable_test.rb +0 -49
  170. data/test/models/timeoutable_test.rb +0 -46
  171. data/test/models/token_authenticatable_test.rb +0 -55
  172. data/test/models/trackable_test.rb +0 -13
  173. data/test/models/validatable_test.rb +0 -127
  174. data/test/models_test.rb +0 -163
  175. data/test/omniauth/config_test.rb +0 -57
  176. data/test/omniauth/url_helpers_test.rb +0 -54
  177. data/test/orm/active_record.rb +0 -10
  178. data/test/orm/mongoid.rb +0 -13
  179. data/test/parameter_sanitizer_test.rb +0 -58
  180. data/test/rails_app/Rakefile +0 -6
  181. data/test/rails_app/app/active_record/admin.rb +0 -6
  182. data/test/rails_app/app/active_record/shim.rb +0 -2
  183. data/test/rails_app/app/active_record/user.rb +0 -6
  184. data/test/rails_app/app/controllers/admins/sessions_controller.rb +0 -6
  185. data/test/rails_app/app/controllers/admins_controller.rb +0 -11
  186. data/test/rails_app/app/controllers/application_controller.rb +0 -9
  187. data/test/rails_app/app/controllers/home_controller.rb +0 -25
  188. data/test/rails_app/app/controllers/publisher/registrations_controller.rb +0 -2
  189. data/test/rails_app/app/controllers/publisher/sessions_controller.rb +0 -2
  190. data/test/rails_app/app/controllers/users/omniauth_callbacks_controller.rb +0 -14
  191. data/test/rails_app/app/controllers/users_controller.rb +0 -31
  192. data/test/rails_app/app/helpers/application_helper.rb +0 -3
  193. data/test/rails_app/app/mailers/users/mailer.rb +0 -12
  194. data/test/rails_app/app/mongoid/admin.rb +0 -29
  195. data/test/rails_app/app/mongoid/shim.rb +0 -23
  196. data/test/rails_app/app/mongoid/user.rb +0 -42
  197. data/test/rails_app/app/views/admins/index.html.erb +0 -1
  198. data/test/rails_app/app/views/admins/sessions/new.html.erb +0 -2
  199. data/test/rails_app/app/views/home/admin_dashboard.html.erb +0 -1
  200. data/test/rails_app/app/views/home/index.html.erb +0 -1
  201. data/test/rails_app/app/views/home/join.html.erb +0 -1
  202. data/test/rails_app/app/views/home/private.html.erb +0 -1
  203. data/test/rails_app/app/views/home/user_dashboard.html.erb +0 -1
  204. data/test/rails_app/app/views/layouts/application.html.erb +0 -24
  205. data/test/rails_app/app/views/users/edit_form.html.erb +0 -1
  206. data/test/rails_app/app/views/users/index.html.erb +0 -1
  207. data/test/rails_app/app/views/users/mailer/confirmation_instructions.erb +0 -1
  208. data/test/rails_app/app/views/users/sessions/new.html.erb +0 -1
  209. data/test/rails_app/bin/bundle +0 -3
  210. data/test/rails_app/bin/rails +0 -4
  211. data/test/rails_app/bin/rake +0 -4
  212. data/test/rails_app/config/application.rb +0 -40
  213. data/test/rails_app/config/boot.rb +0 -8
  214. data/test/rails_app/config/database.yml +0 -18
  215. data/test/rails_app/config/environment.rb +0 -5
  216. data/test/rails_app/config/environments/development.rb +0 -34
  217. data/test/rails_app/config/environments/production.rb +0 -84
  218. data/test/rails_app/config/environments/test.rb +0 -36
  219. data/test/rails_app/config/initializers/backtrace_silencers.rb +0 -7
  220. data/test/rails_app/config/initializers/devise.rb +0 -178
  221. data/test/rails_app/config/initializers/inflections.rb +0 -2
  222. data/test/rails_app/config/initializers/secret_token.rb +0 -8
  223. data/test/rails_app/config/initializers/session_store.rb +0 -1
  224. data/test/rails_app/config/routes.rb +0 -104
  225. data/test/rails_app/config.ru +0 -4
  226. data/test/rails_app/db/migrate/20100401102949_create_tables.rb +0 -74
  227. data/test/rails_app/db/schema.rb +0 -52
  228. data/test/rails_app/lib/shared_admin.rb +0 -14
  229. data/test/rails_app/lib/shared_user.rb +0 -25
  230. data/test/rails_app/public/404.html +0 -26
  231. data/test/rails_app/public/422.html +0 -26
  232. data/test/rails_app/public/500.html +0 -26
  233. data/test/rails_app/public/favicon.ico +0 -0
  234. data/test/routes_test.rb +0 -250
  235. data/test/support/assertions.rb +0 -40
  236. data/test/support/helpers.rb +0 -91
  237. data/test/support/integration.rb +0 -92
  238. data/test/support/locale/en.yml +0 -4
  239. data/test/support/webrat/integrations/rails.rb +0 -24
  240. data/test/test_helper.rb +0 -34
  241. data/test/test_helpers_test.rb +0 -151
  242. data/test/test_models.rb +0 -26
@@ -1,178 +0,0 @@
1
- require "omniauth-facebook"
2
- require "omniauth-openid"
3
-
4
- # Use this hook to configure devise mailer, warden hooks and so forth. The first
5
- # four configuration values can also be set straight in your models.
6
- Devise.setup do |config|
7
- # ==> Mailer Configuration
8
- # Configure the e-mail address which will be shown in Devise::Mailer,
9
- # note that it will be overwritten if you use your own mailer class with default "from" parameter.
10
- config.mailer_sender = "please-change-me@config-initializers-devise.com"
11
-
12
- # Configure the class responsible to send e-mails.
13
- # config.mailer = "Devise::Mailer"
14
-
15
- # ==> ORM configuration
16
- # Load and configure the ORM. Supports :active_record (default) and
17
- # :mongoid (bson_ext recommended) by default. Other ORMs may be
18
- # available as additional gems.
19
- require "devise/orm/#{DEVISE_ORM}"
20
-
21
- # ==> Configuration for any authentication mechanism
22
- # Configure which keys are used when authenticating a user. By default is
23
- # just :email. You can configure it to use [:username, :subdomain], so for
24
- # authenticating a user, both parameters are required. Remember that those
25
- # parameters are used only when authenticating and not when retrieving from
26
- # session. If you need permissions, you should implement that in a before filter.
27
- # You can also supply hash where the value is a boolean expliciting if authentication
28
- # should be aborted or not if the value is not present. By default is empty.
29
- # config.authentication_keys = [ :email ]
30
-
31
- # Configure parameters from the request object used for authentication. Each entry
32
- # given should be a request method and it will automatically be passed to
33
- # find_for_authentication method and considered in your model lookup. For instance,
34
- # if you set :request_keys to [:subdomain], :subdomain will be used on authentication.
35
- # The same considerations mentioned for authentication_keys also apply to request_keys.
36
- # config.request_keys = []
37
-
38
- # Configure which authentication keys should be case-insensitive.
39
- # These keys will be downcased upon creating or modifying a user and when used
40
- # to authenticate or find a user. Default is :email.
41
- config.case_insensitive_keys = [ :email ]
42
-
43
- # Configure which authentication keys should have whitespace stripped.
44
- # These keys will have whitespace before and after removed upon creating or
45
- # modifying a user and when used to authenticate or find a user. Default is :email.
46
- config.strip_whitespace_keys = [ :email ]
47
-
48
- # Tell if authentication through request.params is enabled. True by default.
49
- # config.params_authenticatable = true
50
-
51
- # Tell if authentication through HTTP Basic Auth is enabled. False by default.
52
- config.http_authenticatable = true
53
-
54
- # If http headers should be returned for AJAX requests. True by default.
55
- # config.http_authenticatable_on_xhr = true
56
-
57
- # The realm used in Http Basic Authentication. "Application" by default.
58
- # config.http_authentication_realm = "Application"
59
-
60
- # ==> Configuration for :database_authenticatable
61
- # For bcrypt, this is the cost for hashing the password and defaults to 10. If
62
- # using other encryptors, it sets how many times you want the password re-encrypted.
63
- config.stretches = Rails.env.test? ? 1 : 10
64
-
65
- # ==> Configuration for :confirmable
66
- # The time you want to give your user to confirm his account. During this time
67
- # he will be able to access your application without confirming. Default is nil.
68
- # When allow_unconfirmed_access_for is zero, the user won't be able to sign in without confirming.
69
- # You can use this to let your user access some features of your application
70
- # without confirming the account, but blocking it after a certain period
71
- # (ie 2 days).
72
- # config.allow_unconfirmed_access_for = 2.days
73
-
74
- # Defines which key will be used when confirming an account
75
- # config.confirmation_keys = [ :email ]
76
-
77
- # ==> Configuration for :rememberable
78
- # The time the user will be remembered without asking for credentials again.
79
- # config.remember_for = 2.weeks
80
-
81
- # If true, a valid remember token can be re-used between multiple browsers.
82
- # config.remember_across_browsers = true
83
-
84
- # If true, extends the user's remember period when remembered via cookie.
85
- # config.extend_remember_period = false
86
-
87
- # ==> Configuration for :validatable
88
- # Range for password length. Default is 8..128.
89
- # config.password_length = 8..128
90
-
91
- # Regex to use to validate the email address
92
- # config.email_regexp = /^([\w\.%\+\-]+)@([\w\-]+\.)+([\w]{2,})$/i
93
-
94
- # ==> Configuration for :timeoutable
95
- # The time you want to timeout the user session without activity. After this
96
- # time the user will be asked for credentials again. Default is 30 minutes.
97
- # config.timeout_in = 30.minutes
98
-
99
- # ==> Configuration for :lockable
100
- # Defines which strategy will be used to lock an account.
101
- # :failed_attempts = Locks an account after a number of failed attempts to sign in.
102
- # :none = No lock strategy. You should handle locking by yourself.
103
- # config.lock_strategy = :failed_attempts
104
-
105
- # Defines which key will be used when locking and unlocking an account
106
- # config.unlock_keys = [ :email ]
107
-
108
- # Defines which strategy will be used to unlock an account.
109
- # :email = Sends an unlock link to the user email
110
- # :time = Re-enables login after a certain amount of time (see :unlock_in below)
111
- # :both = Enables both strategies
112
- # :none = No unlock strategy. You should handle unlocking by yourself.
113
- # config.unlock_strategy = :both
114
-
115
- # Number of authentication tries before locking an account if lock_strategy
116
- # is failed attempts.
117
- # config.maximum_attempts = 20
118
-
119
- # Time interval to unlock the account if :time is enabled as unlock_strategy.
120
- # config.unlock_in = 1.hour
121
-
122
- # ==> Configuration for :recoverable
123
- #
124
- # Defines which key will be used when recovering the password for an account
125
- # config.reset_password_keys = [ :email ]
126
-
127
- # Time interval you can reset your password with a reset password key.
128
- # Don't put a too small interval or your users won't have the time to
129
- # change their passwords.
130
- config.reset_password_within = 2.hours
131
-
132
- # Setup a pepper to generate the encrypted password.
133
- config.pepper = "d142367154e5beacca404b1a6a4f8bc52c6fdcfa3ccc3cf8eb49f3458a688ee6ac3b9fae488432a3bfca863b8a90008368a9f3a3dfbe5a962e64b6ab8f3a3a1a"
134
-
135
- # ==> Configuration for :token_authenticatable
136
- # Defines name of the authentication token params key
137
- # config.token_authentication_key = :auth_token
138
-
139
- # ==> Scopes configuration
140
- # Turn scoped views on. Before rendering "sessions/new", it will first check for
141
- # "users/sessions/new". It's turned off by default because it's slower if you
142
- # are using only default views.
143
- # config.scoped_views = false
144
-
145
- # Configure the default scope given to Warden. By default it's the first
146
- # devise role declared in your routes (usually :user).
147
- # config.default_scope = :user
148
-
149
- # Configure sign_out behavior.
150
- # Sign_out action can be scoped (i.e. /users/sign_out affects only :user scope).
151
- # The default is true, which means any logout action will sign out all active scopes.
152
- # config.sign_out_all_scopes = true
153
-
154
- # ==> Navigation configuration
155
- # Lists the formats that should be treated as navigational. Formats like
156
- # :html, should redirect to the sign in page when the user does not have
157
- # access, but formats like :xml or :json, should return 401.
158
- # If you have any extra navigational formats, like :iphone or :mobile, you
159
- # should add them to the navigational formats lists. Default is [:html]
160
- # config.navigational_formats = [:html, :iphone]
161
-
162
- # The default HTTP method used to sign out a resource. Default is :get.
163
- # config.sign_out_via = :get
164
-
165
- # ==> OmniAuth
166
- config.omniauth :facebook, 'APP_ID', 'APP_SECRET', :scope => 'email,offline_access'
167
- config.omniauth :openid
168
- config.omniauth :openid, :name => 'google', :identifier => 'https://www.google.com/accounts/o8/id'
169
-
170
- # ==> Warden configuration
171
- # If you want to use other strategies, that are not supported by Devise, or
172
- # change the failure app, you can configure them inside the config.warden block.
173
- #
174
- # config.warden do |manager|
175
- # manager.failure_app = AnotherApp
176
- # manager.default_strategies(:scope => :user).unshift :some_external_strategy
177
- # end
178
- end
@@ -1,2 +0,0 @@
1
- ActiveSupport::Inflector.inflections do |inflect|
2
- end
@@ -1,8 +0,0 @@
1
- config = Rails.application.config
2
-
3
- if Devise.rails4?
4
- config.secret_key_base = 'd588e99efff13a86461fd6ab82327823ad2f8feb5dc217ce652cdd9f0dfc5eb4b5a62a92d24d2574d7d51dfb1ea8dd453ea54e00cf672159a13104a135422a10'
5
- else
6
- config.secret_token = 'ea942c41850d502f2c8283e26bdc57829f471bb18224ddff0a192c4f32cdf6cb5aa0d82b3a7a7adbeb640c4b06f3aa1cd5f098162d8240f669b39d6b49680571'
7
- config.session_store :cookie_store, :key => "_my_app"
8
- end
@@ -1 +0,0 @@
1
- RailsApp::Application.config.session_store :cookie_store, key: '_rails_app_session'
@@ -1,104 +0,0 @@
1
- Rails.application.routes.draw do
2
- # Resources for testing
3
- resources :users, :only => [:index] do
4
- member do
5
- get :expire
6
- get :accept
7
- get :edit_form
8
- put :update_form
9
- end
10
-
11
- authenticate do
12
- post :exhibit, :on => :member
13
- end
14
- end
15
-
16
- resources :admins, :only => [:index] do
17
- get :expire, :on => :member
18
- end
19
-
20
- # Users scope
21
- devise_for :users, :controllers => { :omniauth_callbacks => "users/omniauth_callbacks" }
22
-
23
- as :user do
24
- get "/as/sign_in", :to => "devise/sessions#new"
25
- end
26
-
27
- get "/sign_in", :to => "devise/sessions#new"
28
-
29
- # Admin scope
30
- devise_for :admin, :path => "admin_area", :controllers => { :sessions => :"admins/sessions" }, :skip => :passwords
31
-
32
- get "/admin_area/home", :to => "admins#index", :as => :admin_root
33
- get "/anywhere", :to => "foo#bar", :as => :new_admin_password
34
-
35
- authenticate(:admin) do
36
- get "/private", :to => "home#private", :as => :private
37
- end
38
-
39
- authenticate(:admin, lambda { |admin| admin.active? }) do
40
- get "/private/active", :to => "home#private", :as => :private_active
41
- end
42
-
43
- authenticated :admin do
44
- get "/dashboard", :to => "home#admin_dashboard"
45
- end
46
-
47
- authenticated :admin, lambda { |admin| admin.active? } do
48
- get "/dashboard/active", :to => "home#admin_dashboard"
49
- end
50
-
51
- authenticated do
52
- get "/dashboard", :to => "home#user_dashboard"
53
- end
54
-
55
- unauthenticated do
56
- get "/join", :to => "home#join"
57
- end
58
-
59
- # Routes for constraints testing
60
- devise_for :headquarters_admin, :class_name => "Admin", :path => "headquarters", :constraints => {:host => /192\.168\.1\.\d\d\d/}
61
-
62
- constraints(:host => /192\.168\.1\.\d\d\d/) do
63
- devise_for :homebase_admin, :class_name => "Admin", :path => "homebase"
64
- end
65
-
66
- devise_for :skip_admin, :class_name => "Admin", :skip => :all
67
-
68
- # Routes for format=false testing
69
- devise_for :htmlonly_admin, :class_name => "Admin", :skip => [:confirmations, :unlocks], :path => "htmlonly_admin", :format => false, :skip_helpers => [:confirmations, :unlocks]
70
- devise_for :htmlonly_users, :class_name => "User", :only => [:confirmations, :unlocks], :path => "htmlonly_users", :format => false, :skip_helpers => true
71
-
72
- # Other routes for routing_test.rb
73
- devise_for :reader, :class_name => "User", :only => :passwords
74
-
75
- scope :host => "sub.example.com" do
76
- devise_for :sub_admin, :class_name => "Admin"
77
- end
78
-
79
- namespace :publisher, :path_names => { :sign_in => "i_dont_care", :sign_out => "get_out" } do
80
- devise_for :accounts, :class_name => "Admin", :path_names => { :sign_in => "get_in" }
81
- end
82
-
83
- scope ":locale", :module => :invalid do
84
- devise_for :accounts, :singular => "manager", :class_name => "Admin",
85
- :path_names => {
86
- :sign_in => "login", :sign_out => "logout",
87
- :password => "secret", :confirmation => "verification",
88
- :unlock => "unblock", :sign_up => "register",
89
- :registration => "management", :cancel => "giveup"
90
- }, :failure_app => lambda { |env| [404, {"Content-Type" => "text/plain"}, ["Oops, not found"]] }, :module => :devise
91
- end
92
-
93
- namespace :sign_out_via, :module => "devise" do
94
- devise_for :deletes, :sign_out_via => :delete, :class_name => "Admin"
95
- devise_for :posts, :sign_out_via => :post, :class_name => "Admin"
96
- devise_for :delete_or_posts, :sign_out_via => [:delete, :post], :class_name => "Admin"
97
- end
98
-
99
- get "/set", :to => "home#set"
100
- get "/unauthenticated", :to => "home#unauthenticated"
101
- get "/custom_strategy/new"
102
-
103
- root :to => "home#index", :via => [:get, :post]
104
- end
@@ -1,4 +0,0 @@
1
- # This file is used by Rack-based servers to start the application.
2
-
3
- require ::File.expand_path('../config/environment', __FILE__)
4
- run RailsApp::Application
@@ -1,74 +0,0 @@
1
- class CreateTables < ActiveRecord::Migration
2
- def self.up
3
- create_table :users do |t|
4
- t.string :username
5
- t.string :facebook_token
6
-
7
- ## Database authenticatable
8
- t.string :email, :null => false, :default => ""
9
- t.string :encrypted_password, :null => false, :default => ""
10
-
11
- ## Recoverable
12
- t.string :reset_password_token
13
- t.datetime :reset_password_sent_at
14
-
15
- ## Rememberable
16
- t.datetime :remember_created_at
17
-
18
- ## Trackable
19
- t.integer :sign_in_count, :default => 0
20
- t.datetime :current_sign_in_at
21
- t.datetime :last_sign_in_at
22
- t.string :current_sign_in_ip
23
- t.string :last_sign_in_ip
24
-
25
- ## Confirmable
26
- t.string :confirmation_token
27
- t.datetime :confirmed_at
28
- t.datetime :confirmation_sent_at
29
- # t.string :unconfirmed_email # Only if using reconfirmable
30
-
31
- ## Lockable
32
- t.integer :failed_attempts, :default => 0 # Only if lock strategy is :failed_attempts
33
- t.string :unlock_token # Only if unlock strategy is :email or :both
34
- t.datetime :locked_at
35
-
36
- ## Token authenticatable
37
- t.string :authentication_token
38
-
39
- t.timestamps
40
- end
41
-
42
- create_table :admins do |t|
43
- ## Database authenticatable
44
- t.string :email, :null => true
45
- t.string :encrypted_password, :null => true
46
-
47
- ## Recoverable
48
- t.string :reset_password_token
49
- t.datetime :reset_password_sent_at
50
-
51
- ## Rememberable
52
- t.datetime :remember_created_at
53
-
54
- ## Confirmable
55
- t.string :confirmation_token
56
- t.datetime :confirmed_at
57
- t.datetime :confirmation_sent_at
58
- t.string :unconfirmed_email # Only if using reconfirmable
59
-
60
- ## Lockable
61
- t.datetime :locked_at
62
-
63
- ## Attribute for testing route blocks
64
- t.boolean :active, :default => false
65
-
66
- t.timestamps
67
- end
68
- end
69
-
70
- def self.down
71
- drop_table :users
72
- drop_table :admins
73
- end
74
- end
@@ -1,52 +0,0 @@
1
- # This file is auto-generated from the current state of the database. Instead
2
- # of editing this file, please use the migrations feature of Active Record to
3
- # incrementally modify your database, and then regenerate this schema definition.
4
- #
5
- # Note that this schema.rb definition is the authoritative source for your
6
- # database schema. If you need to create the application database on another
7
- # system, you should be using db:schema:load, not running all the migrations
8
- # from scratch. The latter is a flawed and unsustainable approach (the more migrations
9
- # you'll amass, the slower it'll run and the greater likelihood for issues).
10
- #
11
- # It's strongly recommended to check this file into your version control system.
12
-
13
- ActiveRecord::Schema.define(:version => 20100401102949) do
14
-
15
- create_table "admins", :force => true do |t|
16
- t.string "email"
17
- t.string "encrypted_password", :limit => 128
18
- t.string "password_salt"
19
- t.string "remember_token"
20
- t.datetime "remember_created_at"
21
- t.string "reset_password_token"
22
- t.integer "failed_attempts", :default => 0
23
- t.string "unlock_token"
24
- t.datetime "locked_at"
25
- t.datetime "created_at"
26
- t.datetime "updated_at"
27
- end
28
-
29
- create_table "users", :force => true do |t|
30
- t.string "username"
31
- t.string "facebook_token"
32
- t.string "email", :default => "", :null => false
33
- t.string "encrypted_password", :limit => 128, :default => "", :null => false
34
- t.string "confirmation_token"
35
- t.datetime "confirmed_at"
36
- t.datetime "confirmation_sent_at"
37
- t.string "reset_password_token"
38
- t.datetime "remember_created_at"
39
- t.integer "sign_in_count", :default => 0
40
- t.datetime "current_sign_in_at"
41
- t.datetime "last_sign_in_at"
42
- t.string "current_sign_in_ip"
43
- t.string "last_sign_in_ip"
44
- t.integer "failed_attempts", :default => 0
45
- t.string "unlock_token"
46
- t.datetime "locked_at"
47
- t.string "authentication_token"
48
- t.datetime "created_at"
49
- t.datetime "updated_at"
50
- end
51
-
52
- end
@@ -1,14 +0,0 @@
1
- module SharedAdmin
2
- extend ActiveSupport::Concern
3
-
4
- included do
5
- devise :database_authenticatable, :registerable,
6
- :timeoutable, :recoverable, :lockable, :confirmable,
7
- :unlock_strategy => :time, :lock_strategy => :none,
8
- :allow_unconfirmed_access_for => 2.weeks, :reconfirmable => true
9
-
10
- validates_length_of :reset_password_token, :minimum => 3, :allow_blank => true
11
- validates_uniqueness_of :email, :allow_blank => true, :if => :email_changed?
12
- end
13
-
14
- end
@@ -1,25 +0,0 @@
1
- module SharedUser
2
- extend ActiveSupport::Concern
3
-
4
- included do
5
- devise :database_authenticatable, :confirmable, :lockable, :recoverable,
6
- :registerable, :rememberable, :timeoutable, :token_authenticatable,
7
- :trackable, :validatable, :omniauthable
8
-
9
- attr_accessor :other_key
10
-
11
- # They need to be included after Devise is called.
12
- extend ExtendMethods
13
- end
14
-
15
- module ExtendMethods
16
- def new_with_session(params, session)
17
- super.tap do |user|
18
- if data = session["devise.facebook_data"]
19
- user.email = data["email"]
20
- user.confirmed_at = Time.now
21
- end
22
- end
23
- end
24
- end
25
- end
@@ -1,26 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <title>The page you were looking for doesn't exist (404)</title>
5
- <style type="text/css">
6
- body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
7
- div.dialog {
8
- width: 25em;
9
- padding: 0 4em;
10
- margin: 4em auto 0 auto;
11
- border: 1px solid #ccc;
12
- border-right-color: #999;
13
- border-bottom-color: #999;
14
- }
15
- h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
16
- </style>
17
- </head>
18
-
19
- <body>
20
- <!-- This file lives in public/404.html -->
21
- <div class="dialog">
22
- <h1>The page you were looking for doesn't exist.</h1>
23
- <p>You may have mistyped the address or the page may have moved.</p>
24
- </div>
25
- </body>
26
- </html>
@@ -1,26 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <title>The change you wanted was rejected (422)</title>
5
- <style type="text/css">
6
- body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
7
- div.dialog {
8
- width: 25em;
9
- padding: 0 4em;
10
- margin: 4em auto 0 auto;
11
- border: 1px solid #ccc;
12
- border-right-color: #999;
13
- border-bottom-color: #999;
14
- }
15
- h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
16
- </style>
17
- </head>
18
-
19
- <body>
20
- <!-- This file lives in public/422.html -->
21
- <div class="dialog">
22
- <h1>The change you wanted was rejected.</h1>
23
- <p>Maybe you tried to change something you didn't have access to.</p>
24
- </div>
25
- </body>
26
- </html>
@@ -1,26 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <title>We're sorry, but something went wrong (500)</title>
5
- <style type="text/css">
6
- body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
7
- div.dialog {
8
- width: 25em;
9
- padding: 0 4em;
10
- margin: 4em auto 0 auto;
11
- border: 1px solid #ccc;
12
- border-right-color: #999;
13
- border-bottom-color: #999;
14
- }
15
- h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
16
- </style>
17
- </head>
18
-
19
- <body>
20
- <!-- This file lives in public/500.html -->
21
- <div class="dialog">
22
- <h1>We're sorry, but something went wrong.</h1>
23
- <p>We've been notified about this issue and we'll take a look at it shortly.</p>
24
- </div>
25
- </body>
26
- </html>
File without changes