devise_ennder 1.0.1.0.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (255) hide show
  1. data/CHANGELOG.rdoc +397 -0
  2. data/INSTALL +94 -0
  3. data/MIT-LICENSE +20 -0
  4. data/README.rdoc +272 -0
  5. data/Rakefile +53 -0
  6. data/TODO +2 -0
  7. data/app/controllers/confirmations_controller.rb +33 -0
  8. data/app/controllers/passwords_controller.rb +41 -0
  9. data/app/controllers/registrations_controller.rb +62 -0
  10. data/app/controllers/sessions_controller.rb +42 -0
  11. data/app/controllers/unlocks_controller.rb +41 -0
  12. data/app/models/devise_mailer.rb +68 -0
  13. data/app/models/user.rb +9 -0
  14. data/app/views/confirmations/new.html.erb +14 -0
  15. data/app/views/devise_mailer/confirmation_instructions.html.erb +6 -0
  16. data/app/views/devise_mailer/reset_password_instructions.html.erb +8 -0
  17. data/app/views/devise_mailer/unlock_instructions.html.erb +7 -0
  18. data/app/views/passwords/edit.html.erb +16 -0
  19. data/app/views/passwords/new.html.erb +12 -0
  20. data/app/views/registrations/edit.html.erb +25 -0
  21. data/app/views/registrations/new.html.erb +17 -0
  22. data/app/views/sessions/new.html.erb +17 -0
  23. data/app/views/shared/_devise_links.erb +19 -0
  24. data/app/views/shared/_user_nav.html.erb +15 -0
  25. data/app/views/unlocks/new.html.erb +12 -0
  26. data/config/locales/devise.en.yml +62 -0
  27. data/config/locales/devise.fr.yml +60 -0
  28. data/config/locales/en.yml +6 -0
  29. data/config/locales/fr.yml +18 -0
  30. data/config/routes.rb +4 -0
  31. data/db/migrate/20100506013336_devise_create_users.rb +23 -0
  32. data/lib/devise/controllers/helpers.rb +212 -0
  33. data/lib/devise/controllers/internal_helpers.rb +129 -0
  34. data/lib/devise/controllers/url_helpers.rb +41 -0
  35. data/lib/devise/encryptors/authlogic_sha512.rb +21 -0
  36. data/lib/devise/encryptors/base.rb +20 -0
  37. data/lib/devise/encryptors/bcrypt.rb +21 -0
  38. data/lib/devise/encryptors/clearance_sha1.rb +19 -0
  39. data/lib/devise/encryptors/restful_authentication_sha1.rb +22 -0
  40. data/lib/devise/encryptors/sha1.rb +27 -0
  41. data/lib/devise/encryptors/sha512.rb +27 -0
  42. data/lib/devise/failure_app.rb +70 -0
  43. data/lib/devise/hooks/activatable.rb +15 -0
  44. data/lib/devise/hooks/rememberable.rb +33 -0
  45. data/lib/devise/hooks/timeoutable.rb +18 -0
  46. data/lib/devise/hooks/trackable.rb +18 -0
  47. data/lib/devise/locales/en.yml +35 -0
  48. data/lib/devise/mapping.rb +130 -0
  49. data/lib/devise/models/activatable.rb +16 -0
  50. data/lib/devise/models/confirmable.rb +167 -0
  51. data/lib/devise/models/database_authenticatable.rb +144 -0
  52. data/lib/devise/models/http_authenticatable.rb +23 -0
  53. data/lib/devise/models/lockable.rb +150 -0
  54. data/lib/devise/models/recoverable.rb +80 -0
  55. data/lib/devise/models/registerable.rb +8 -0
  56. data/lib/devise/models/rememberable.rb +92 -0
  57. data/lib/devise/models/timeoutable.rb +28 -0
  58. data/lib/devise/models/token_authenticatable.rb +89 -0
  59. data/lib/devise/models/trackable.rb +16 -0
  60. data/lib/devise/models/validatable.rb +39 -0
  61. data/lib/devise/models.rb +117 -0
  62. data/lib/devise/orm/active_record.rb +41 -0
  63. data/lib/devise/orm/data_mapper.rb +83 -0
  64. data/lib/devise/orm/mongo_mapper.rb +52 -0
  65. data/lib/devise/rails/routes.rb +133 -0
  66. data/lib/devise/rails/warden_compat.rb +60 -0
  67. data/lib/devise/rails.rb +14 -0
  68. data/lib/devise/schema.rb +73 -0
  69. data/lib/devise/strategies/base.rb +16 -0
  70. data/lib/devise/strategies/database_authenticatable.rb +36 -0
  71. data/lib/devise/strategies/http_authenticatable.rb +59 -0
  72. data/lib/devise/strategies/rememberable.rb +37 -0
  73. data/lib/devise/strategies/token_authenticatable.rb +37 -0
  74. data/lib/devise/test_helpers.rb +90 -0
  75. data/lib/devise/version.rb +3 -0
  76. data/lib/devise.rb +269 -0
  77. data/lib/devise_ennder.rb +3 -0
  78. data/lib/tasks/devise_ennder_tasks.rake +11 -0
  79. data/test/controllers/helpers_test.rb +184 -0
  80. data/test/controllers/internal_helpers_test.rb +55 -0
  81. data/test/controllers/url_helpers_test.rb +47 -0
  82. data/test/devise_test.rb +74 -0
  83. data/test/encryptors_test.rb +31 -0
  84. data/test/failure_app_test.rb +44 -0
  85. data/test/integration/authenticatable_test.rb +332 -0
  86. data/test/integration/confirmable_test.rb +97 -0
  87. data/test/integration/http_authenticatable_test.rb +52 -0
  88. data/test/integration/lockable_test.rb +102 -0
  89. data/test/integration/rack_middleware_test.rb +47 -0
  90. data/test/integration/recoverable_test.rb +141 -0
  91. data/test/integration/registerable_test.rb +144 -0
  92. data/test/integration/rememberable_test.rb +72 -0
  93. data/test/integration/timeoutable_test.rb +68 -0
  94. data/test/integration/token_authenticatable_test.rb +55 -0
  95. data/test/integration/trackable_test.rb +64 -0
  96. data/test/mailers/confirmation_instructions_test.rb +86 -0
  97. data/test/mailers/reset_password_instructions_test.rb +68 -0
  98. data/test/mailers/unlock_instructions_test.rb +62 -0
  99. data/test/mapping_test.rb +158 -0
  100. data/test/models/authenticatable_test.rb +180 -0
  101. data/test/models/confirmable_test.rb +228 -0
  102. data/test/models/lockable_test.rb +202 -0
  103. data/test/models/recoverable_test.rb +138 -0
  104. data/test/models/rememberable_test.rb +135 -0
  105. data/test/models/timeoutable_test.rb +28 -0
  106. data/test/models/token_authenticatable_test.rb +51 -0
  107. data/test/models/trackable_test.rb +5 -0
  108. data/test/models/validatable_test.rb +106 -0
  109. data/test/models_test.rb +70 -0
  110. data/test/orm/active_record.rb +31 -0
  111. data/test/orm/mongo_mapper.rb +20 -0
  112. data/test/rails_app/app/active_record/admin.rb +7 -0
  113. data/test/rails_app/app/active_record/user.rb +7 -0
  114. data/test/rails_app/app/controllers/admins_controller.rb +6 -0
  115. data/test/rails_app/app/controllers/application_controller.rb +12 -0
  116. data/test/rails_app/app/controllers/home_controller.rb +4 -0
  117. data/test/rails_app/app/controllers/users_controller.rb +16 -0
  118. data/test/rails_app/app/helpers/application_helper.rb +3 -0
  119. data/test/rails_app/app/mongo_mapper/admin.rb +13 -0
  120. data/test/rails_app/app/mongo_mapper/user.rb +14 -0
  121. data/test/rails_app/config/boot.rb +110 -0
  122. data/test/rails_app/config/environment.rb +42 -0
  123. data/test/rails_app/config/environments/development.rb +17 -0
  124. data/test/rails_app/config/environments/production.rb +28 -0
  125. data/test/rails_app/config/environments/test.rb +28 -0
  126. data/test/rails_app/config/initializers/devise.rb +82 -0
  127. data/test/rails_app/config/initializers/inflections.rb +2 -0
  128. data/test/rails_app/config/initializers/new_rails_defaults.rb +24 -0
  129. data/test/rails_app/config/initializers/session_store.rb +15 -0
  130. data/test/rails_app/config/routes.rb +25 -0
  131. data/test/rails_app/vendor/plugins/devise/app/controllers/confirmations_controller.rb +33 -0
  132. data/test/rails_app/vendor/plugins/devise/app/controllers/passwords_controller.rb +41 -0
  133. data/test/rails_app/vendor/plugins/devise/app/controllers/registrations_controller.rb +53 -0
  134. data/test/rails_app/vendor/plugins/devise/app/controllers/sessions_controller.rb +42 -0
  135. data/test/rails_app/vendor/plugins/devise/app/controllers/unlocks_controller.rb +41 -0
  136. data/test/rails_app/vendor/plugins/devise/app/models/devise_mailer.rb +68 -0
  137. data/test/rails_app/vendor/plugins/devise/generators/devise/devise_generator.rb +15 -0
  138. data/test/rails_app/vendor/plugins/devise/generators/devise/lib/route_devise.rb +32 -0
  139. data/test/rails_app/vendor/plugins/devise/generators/devise/templates/migration.rb +23 -0
  140. data/test/rails_app/vendor/plugins/devise/generators/devise/templates/model.rb +9 -0
  141. data/test/rails_app/vendor/plugins/devise/generators/devise_install/devise_install_generator.rb +15 -0
  142. data/test/rails_app/vendor/plugins/devise/generators/devise_install/templates/devise.rb +105 -0
  143. data/test/rails_app/vendor/plugins/devise/generators/devise_views/devise_views_generator.rb +21 -0
  144. data/test/rails_app/vendor/plugins/devise/lib/devise/controllers/helpers.rb +212 -0
  145. data/test/rails_app/vendor/plugins/devise/lib/devise/controllers/internal_helpers.rb +129 -0
  146. data/test/rails_app/vendor/plugins/devise/lib/devise/controllers/url_helpers.rb +41 -0
  147. data/test/rails_app/vendor/plugins/devise/lib/devise/encryptors/authlogic_sha512.rb +21 -0
  148. data/test/rails_app/vendor/plugins/devise/lib/devise/encryptors/base.rb +20 -0
  149. data/test/rails_app/vendor/plugins/devise/lib/devise/encryptors/bcrypt.rb +21 -0
  150. data/test/rails_app/vendor/plugins/devise/lib/devise/encryptors/clearance_sha1.rb +19 -0
  151. data/test/rails_app/vendor/plugins/devise/lib/devise/encryptors/restful_authentication_sha1.rb +22 -0
  152. data/test/rails_app/vendor/plugins/devise/lib/devise/encryptors/sha1.rb +27 -0
  153. data/test/rails_app/vendor/plugins/devise/lib/devise/encryptors/sha512.rb +27 -0
  154. data/test/rails_app/vendor/plugins/devise/lib/devise/failure_app.rb +70 -0
  155. data/test/rails_app/vendor/plugins/devise/lib/devise/hooks/activatable.rb +15 -0
  156. data/test/rails_app/vendor/plugins/devise/lib/devise/hooks/rememberable.rb +33 -0
  157. data/test/rails_app/vendor/plugins/devise/lib/devise/hooks/timeoutable.rb +18 -0
  158. data/test/rails_app/vendor/plugins/devise/lib/devise/hooks/trackable.rb +18 -0
  159. data/test/rails_app/vendor/plugins/devise/lib/devise/mapping.rb +130 -0
  160. data/test/rails_app/vendor/plugins/devise/lib/devise/models/activatable.rb +16 -0
  161. data/test/rails_app/vendor/plugins/devise/lib/devise/models/confirmable.rb +167 -0
  162. data/test/rails_app/vendor/plugins/devise/lib/devise/models/database_authenticatable.rb +144 -0
  163. data/test/rails_app/vendor/plugins/devise/lib/devise/models/http_authenticatable.rb +23 -0
  164. data/test/rails_app/vendor/plugins/devise/lib/devise/models/lockable.rb +150 -0
  165. data/test/rails_app/vendor/plugins/devise/lib/devise/models/recoverable.rb +80 -0
  166. data/test/rails_app/vendor/plugins/devise/lib/devise/models/registerable.rb +8 -0
  167. data/test/rails_app/vendor/plugins/devise/lib/devise/models/rememberable.rb +92 -0
  168. data/test/rails_app/vendor/plugins/devise/lib/devise/models/timeoutable.rb +28 -0
  169. data/test/rails_app/vendor/plugins/devise/lib/devise/models/token_authenticatable.rb +89 -0
  170. data/test/rails_app/vendor/plugins/devise/lib/devise/models/trackable.rb +16 -0
  171. data/test/rails_app/vendor/plugins/devise/lib/devise/models/validatable.rb +39 -0
  172. data/test/rails_app/vendor/plugins/devise/lib/devise/models.rb +117 -0
  173. data/test/rails_app/vendor/plugins/devise/lib/devise/orm/active_record.rb +41 -0
  174. data/test/rails_app/vendor/plugins/devise/lib/devise/orm/data_mapper.rb +83 -0
  175. data/test/rails_app/vendor/plugins/devise/lib/devise/orm/mongo_mapper.rb +52 -0
  176. data/test/rails_app/vendor/plugins/devise/lib/devise/rails/routes.rb +133 -0
  177. data/test/rails_app/vendor/plugins/devise/lib/devise/rails/warden_compat.rb +60 -0
  178. data/test/rails_app/vendor/plugins/devise/lib/devise/rails.rb +14 -0
  179. data/test/rails_app/vendor/plugins/devise/lib/devise/schema.rb +73 -0
  180. data/test/rails_app/vendor/plugins/devise/lib/devise/strategies/base.rb +16 -0
  181. data/test/rails_app/vendor/plugins/devise/lib/devise/strategies/database_authenticatable.rb +36 -0
  182. data/test/rails_app/vendor/plugins/devise/lib/devise/strategies/http_authenticatable.rb +59 -0
  183. data/test/rails_app/vendor/plugins/devise/lib/devise/strategies/rememberable.rb +37 -0
  184. data/test/rails_app/vendor/plugins/devise/lib/devise/strategies/token_authenticatable.rb +37 -0
  185. data/test/rails_app/vendor/plugins/devise/lib/devise/test_helpers.rb +90 -0
  186. data/test/rails_app/vendor/plugins/devise/lib/devise/version.rb +3 -0
  187. data/test/rails_app/vendor/plugins/devise/lib/devise.rb +266 -0
  188. data/test/rails_app/vendor/plugins/devise/rails/init.rb +2 -0
  189. data/test/rails_app/vendor/plugins/devise/test/controllers/helpers_test.rb +184 -0
  190. data/test/rails_app/vendor/plugins/devise/test/controllers/internal_helpers_test.rb +55 -0
  191. data/test/rails_app/vendor/plugins/devise/test/controllers/url_helpers_test.rb +47 -0
  192. data/test/rails_app/vendor/plugins/devise/test/devise_test.rb +74 -0
  193. data/test/rails_app/vendor/plugins/devise/test/encryptors_test.rb +31 -0
  194. data/test/rails_app/vendor/plugins/devise/test/failure_app_test.rb +44 -0
  195. data/test/rails_app/vendor/plugins/devise/test/integration/authenticatable_test.rb +332 -0
  196. data/test/rails_app/vendor/plugins/devise/test/integration/confirmable_test.rb +97 -0
  197. data/test/rails_app/vendor/plugins/devise/test/integration/http_authenticatable_test.rb +52 -0
  198. data/test/rails_app/vendor/plugins/devise/test/integration/lockable_test.rb +102 -0
  199. data/test/rails_app/vendor/plugins/devise/test/integration/rack_middleware_test.rb +47 -0
  200. data/test/rails_app/vendor/plugins/devise/test/integration/recoverable_test.rb +141 -0
  201. data/test/rails_app/vendor/plugins/devise/test/integration/registerable_test.rb +144 -0
  202. data/test/rails_app/vendor/plugins/devise/test/integration/rememberable_test.rb +72 -0
  203. data/test/rails_app/vendor/plugins/devise/test/integration/timeoutable_test.rb +68 -0
  204. data/test/rails_app/vendor/plugins/devise/test/integration/token_authenticatable_test.rb +55 -0
  205. data/test/rails_app/vendor/plugins/devise/test/integration/trackable_test.rb +64 -0
  206. data/test/rails_app/vendor/plugins/devise/test/mailers/confirmation_instructions_test.rb +86 -0
  207. data/test/rails_app/vendor/plugins/devise/test/mailers/reset_password_instructions_test.rb +68 -0
  208. data/test/rails_app/vendor/plugins/devise/test/mailers/unlock_instructions_test.rb +62 -0
  209. data/test/rails_app/vendor/plugins/devise/test/mapping_test.rb +158 -0
  210. data/test/rails_app/vendor/plugins/devise/test/models/authenticatable_test.rb +180 -0
  211. data/test/rails_app/vendor/plugins/devise/test/models/confirmable_test.rb +228 -0
  212. data/test/rails_app/vendor/plugins/devise/test/models/lockable_test.rb +202 -0
  213. data/test/rails_app/vendor/plugins/devise/test/models/recoverable_test.rb +138 -0
  214. data/test/rails_app/vendor/plugins/devise/test/models/rememberable_test.rb +135 -0
  215. data/test/rails_app/vendor/plugins/devise/test/models/timeoutable_test.rb +28 -0
  216. data/test/rails_app/vendor/plugins/devise/test/models/token_authenticatable_test.rb +51 -0
  217. data/test/rails_app/vendor/plugins/devise/test/models/trackable_test.rb +5 -0
  218. data/test/rails_app/vendor/plugins/devise/test/models/validatable_test.rb +106 -0
  219. data/test/rails_app/vendor/plugins/devise/test/models_test.rb +70 -0
  220. data/test/rails_app/vendor/plugins/devise/test/orm/active_record.rb +31 -0
  221. data/test/rails_app/vendor/plugins/devise/test/orm/mongo_mapper.rb +20 -0
  222. data/test/rails_app/vendor/plugins/devise/test/rails_app/app/active_record/admin.rb +7 -0
  223. data/test/rails_app/vendor/plugins/devise/test/rails_app/app/active_record/user.rb +7 -0
  224. data/test/rails_app/vendor/plugins/devise/test/rails_app/app/controllers/admins_controller.rb +6 -0
  225. data/test/rails_app/vendor/plugins/devise/test/rails_app/app/controllers/application_controller.rb +12 -0
  226. data/test/rails_app/vendor/plugins/devise/test/rails_app/app/controllers/home_controller.rb +4 -0
  227. data/test/rails_app/vendor/plugins/devise/test/rails_app/app/controllers/users_controller.rb +16 -0
  228. data/test/rails_app/vendor/plugins/devise/test/rails_app/app/helpers/application_helper.rb +3 -0
  229. data/test/rails_app/vendor/plugins/devise/test/rails_app/app/mongo_mapper/admin.rb +13 -0
  230. data/test/rails_app/vendor/plugins/devise/test/rails_app/app/mongo_mapper/user.rb +14 -0
  231. data/test/rails_app/vendor/plugins/devise/test/rails_app/config/boot.rb +110 -0
  232. data/test/rails_app/vendor/plugins/devise/test/rails_app/config/environment.rb +42 -0
  233. data/test/rails_app/vendor/plugins/devise/test/rails_app/config/environments/development.rb +17 -0
  234. data/test/rails_app/vendor/plugins/devise/test/rails_app/config/environments/production.rb +28 -0
  235. data/test/rails_app/vendor/plugins/devise/test/rails_app/config/environments/test.rb +28 -0
  236. data/test/rails_app/vendor/plugins/devise/test/rails_app/config/initializers/devise.rb +82 -0
  237. data/test/rails_app/vendor/plugins/devise/test/rails_app/config/initializers/inflections.rb +2 -0
  238. data/test/rails_app/vendor/plugins/devise/test/rails_app/config/initializers/new_rails_defaults.rb +24 -0
  239. data/test/rails_app/vendor/plugins/devise/test/rails_app/config/initializers/session_store.rb +15 -0
  240. data/test/rails_app/vendor/plugins/devise/test/rails_app/config/routes.rb +25 -0
  241. data/test/rails_app/vendor/plugins/devise/test/routes_test.rb +131 -0
  242. data/test/rails_app/vendor/plugins/devise/test/support/assertions_helper.rb +37 -0
  243. data/test/rails_app/vendor/plugins/devise/test/support/integration_tests_helper.rb +71 -0
  244. data/test/rails_app/vendor/plugins/devise/test/support/test_silencer.rb +5 -0
  245. data/test/rails_app/vendor/plugins/devise/test/support/tests_helper.rb +39 -0
  246. data/test/rails_app/vendor/plugins/devise/test/test_helper.rb +21 -0
  247. data/test/rails_app/vendor/plugins/devise/test/test_helpers_test.rb +57 -0
  248. data/test/routes_test.rb +131 -0
  249. data/test/support/assertions_helper.rb +37 -0
  250. data/test/support/integration_tests_helper.rb +71 -0
  251. data/test/support/test_silencer.rb +5 -0
  252. data/test/support/tests_helper.rb +39 -0
  253. data/test/test_helper.rb +21 -0
  254. data/test/test_helpers_test.rb +57 -0
  255. metadata +515 -0
@@ -0,0 +1,16 @@
1
+ <h2>Change your password</h2>
2
+
3
+ <% form_for resource_name, resource, :url => password_path(resource_name), :html => { :method => :put } do |f| %>
4
+ <%= f.error_messages %>
5
+ <%= f.hidden_field :reset_password_token %>
6
+
7
+ <p><%= f.label :password %></p>
8
+ <p><%= f.password_field :password %></p>
9
+
10
+ <p><%= f.label :password_confirmation %></p>
11
+ <p><%= f.password_field :password_confirmation %></p>
12
+
13
+ <p><%= f.submit "Change my password" %></p>
14
+ <% end %>
15
+
16
+ <%= render :partial => "shared/devise_links" %>
@@ -0,0 +1,12 @@
1
+ <h2><%= t('devise.passwords.link') %></h2>
2
+
3
+ <% form_for resource_name, resource, :url => password_path(resource_name) do |f| %>
4
+ <%= f.error_messages %>
5
+
6
+ <p><%= f.label :email %></p>
7
+ <p><%= f.text_field :email %></p>
8
+
9
+ <p><%= f.submit t('devise.passwords.send_me_instructions') %></p>
10
+ <% end %>
11
+
12
+ <%= render :partial => "shared/devise_links" %>
@@ -0,0 +1,25 @@
1
+ <h2>Edit <%= resource_name.to_s.humanize %></h2>
2
+
3
+ <% form_for resource_name, resource, :url => registration_path(resource_name), :html => { :method => :put } do |f| -%>
4
+ <%= f.error_messages %>
5
+
6
+ <p><%= f.label :email %></p>
7
+ <p><%= f.text_field :email %></p>
8
+
9
+ <p><%= f.label :password %> <i>(leave blank if you don't want to change it)</i></p>
10
+ <p><%= f.password_field :password %></p>
11
+
12
+ <p><%= f.label :password_confirmation %></p>
13
+ <p><%= f.password_field :password_confirmation %></p>
14
+
15
+ <p><%= f.label :current_password %> <i>(we need your current password to confirm your changes)</i></p>
16
+ <p><%= f.password_field :current_password %></p>
17
+
18
+ <p><%= f.submit "Update" %></p>
19
+ <% end -%>
20
+
21
+ <h3>Cancel my account</h3>
22
+
23
+ <p>Unhappy? <%= link_to "Cancel my account", registration_path(resource_name), :confirm => "Are you sure?", :method => :delete %>.</p>
24
+
25
+ <%= render :partial => "shared/devise_links" %>
@@ -0,0 +1,17 @@
1
+ <h2><%= t('devise.registrations.link') %></h2>
2
+
3
+ <% form_for resource_name, resource, :url => registration_path(resource_name) do |f| -%>
4
+ <%= f.error_messages %>
5
+ <p><%= f.label :email %></p>
6
+ <p><%= f.text_field :email %></p>
7
+
8
+ <p><%= f.label :password %></p>
9
+ <p><%= f.password_field :password %></p>
10
+
11
+ <p><%= f.label :password_confirmation %></p>
12
+ <p><%= f.password_field :password_confirmation %></p>
13
+
14
+ <p><%= f.submit t('devise.registrations.self_link') %></p>
15
+ <% end -%>
16
+
17
+ <%= render :partial => "shared/devise_links" %>
@@ -0,0 +1,17 @@
1
+ <h2><%= t('devise.sessions.link') %></h2>
2
+
3
+ <% form_for resource_name, resource, :url => session_path(resource_name) do |f| -%>
4
+ <p><%= f.label :email %></p>
5
+ <p><%= f.text_field :email %></p>
6
+
7
+ <p><%= f.label :password %></p>
8
+ <p><%= f.password_field :password %></p>
9
+
10
+ <% if devise_mapping.rememberable? -%>
11
+ <p><%= f.check_box :remember_me %> <%= f.label :remember_me %></p>
12
+ <% end -%>
13
+
14
+ <p><%= f.submit t('devise.sessions.self_link') %></p>
15
+ <% end -%>
16
+
17
+ <%= render :partial => "shared/devise_links" %>
@@ -0,0 +1,19 @@
1
+ <%- if controller_name != 'sessions' %>
2
+ <%= link_to t('devise.sessions.link'), new_session_path(resource_name) %><br />
3
+ <% end -%>
4
+
5
+ <%- if devise_mapping.registerable? && controller_name != 'registrations' %>
6
+ <%= link_to t('devise.registrations.link'), new_registration_path(resource_name) %><br />
7
+ <% end -%>
8
+
9
+ <%- if devise_mapping.recoverable? && controller_name != 'passwords' %>
10
+ <%= link_to t('devise.passwords.link'), new_password_path(resource_name) %><br />
11
+ <% end -%>
12
+
13
+ <%- if devise_mapping.confirmable? && controller_name != 'confirmations' %>
14
+ <%= link_to t('devise.confirmations.link'), new_confirmation_path(resource_name) %><br />
15
+ <% end -%>
16
+
17
+ <%- if devise_mapping.lockable? && controller_name != 'unlocks' %>
18
+ <%= link_to t('devise.unlocks.link'), new_unlock_path(resource_name) %><br />
19
+ <% end -%>
@@ -0,0 +1,15 @@
1
+ <div id="user_nav" align="right">
2
+ <%
3
+ if user_signed_in?
4
+ %> <%= t('devise.sessions.signed_in_as') %> <b><%= current_user.email %></b>.&nbsp;&nbsp;&nbsp;<%= link_to t('devise.sessions.Logout'), destroy_user_session_path %>&nbsp;&nbsp;&nbsp;<%= link_to t('devise.registrations.edit'), edit_user_registration_path %><%
5
+ else
6
+ %> <%= link_to( t('devise.registrations.link'), new_user_registration_path ) %> <%= t('devise.sessions.or') %> <%= link_to( t('devise.sessions.link'), new_user_session_path ) %><%
7
+ end
8
+
9
+ if I18n.locale == :en
10
+ %> [&nbsp;en&nbsp;|&nbsp;<%= link_to 'fr', url_for(:locale => 'fr') %>&nbsp;]<%
11
+ else
12
+ %> [&nbsp;<%= link_to 'en', url_for(:locale => 'en') %>&nbsp;|&nbsp;fr&nbsp;]<%
13
+ end
14
+ %>
15
+ </div>
@@ -0,0 +1,12 @@
1
+ <h2>Resend unlock instructions</h2>
2
+
3
+ <% form_for resource_name, resource, :url => unlock_path(resource_name) do |f| %>
4
+ <%= f.error_messages %>
5
+
6
+ <p><%= f.label :email %></p>
7
+ <p><%= f.text_field :email %></p>
8
+
9
+ <p><%= f.submit "Resend unlock instructions" %></p>
10
+ <% end %>
11
+
12
+ <%= render :partial => "shared/devise_links" %>
@@ -0,0 +1,62 @@
1
+ en:
2
+ devise:
3
+ sessions:
4
+ link: 'Sign in'
5
+ #Ennder
6
+ self_link: 'Sign in'
7
+ #Ennder
8
+ or: 'or'
9
+ signed_in: 'Signed in successfully.'
10
+ #Ennder
11
+ signed_in_as: 'Signed in as'
12
+ signed_out: 'Signed out successfully.'
13
+ unauthenticated: 'You need to sign in or sign up before continuing.'
14
+ unconfirmed: 'You have to confirm your account before continuing.'
15
+ locked: 'Your account is locked.'
16
+ invalid: 'Invalid email or password.'
17
+ invalid_token: 'Invalid authentication token.'
18
+ timeout: 'Your session expired, please sign in again to continue.'
19
+ inactive: 'Your account was not activated yet.'
20
+ #Ennder
21
+ Logout: 'Logout'
22
+ #Ennder
23
+ Could_not_destroy_resource: 'Could not destroy User!'
24
+
25
+ passwords:
26
+ link: 'Forgot password?'
27
+ #Ennder
28
+ send_me_instructions: 'Send me reset password instructions'
29
+ send_instructions: 'You will receive an email with instructions about how to reset your password in a few minutes.'
30
+ updated: 'Your password was changed successfully. You are now signed in.'
31
+ confirmations:
32
+ link: "Didn't receive confirmation instructions?"
33
+ send_instructions: 'You will receive an email with instructions about how to confirm your account in a few minutes.'
34
+ confirmed: 'Your account was successfully confirmed. You are now signed in.'
35
+ registrations:
36
+ link: 'Sign up'
37
+ #Ennder
38
+ self_link: "Sign up"
39
+ #Ennder
40
+ edit: 'Edit my profile'
41
+ signed_up: 'You have signed up successfully. If enabled, a confirmation was sent to your e-mail.'
42
+ updated: 'You updated your account successfully.'
43
+ destroyed: 'Bye! Your account was successfully cancelled. We hope to see you again soon.'
44
+ #Ennder
45
+ confirm_link: 'You can confirm your account through the link below:'
46
+ unlocks:
47
+ link: "Didn't receive unlock instructions?"
48
+ send_instructions: 'You will receive an email with instructions about how to unlock your account in a few minutes.'
49
+ unlocked: 'Your account was successfully unlocked. You are now signed in.'
50
+ mailer:
51
+ confirmation_instructions: 'Confirmation instructions'
52
+ reset_password_instructions: 'Reset password instructions'
53
+ #Ennder
54
+ Change_my_password: 'Change my password'
55
+ #Ennder
56
+ Someone_requested_change_password: 'Someone has requested a link to change your password, and you can do this through the link below.'
57
+ #Ennder
58
+ If_you_didnt_request_this: "If you didn't request this, please ignore this email."
59
+ #Ennder
60
+ Your_password_wont_change_until: "Your password won't change until you access the link above and create a new one."
61
+ unlock_instructions: 'Unlock Instructions'
62
+
@@ -0,0 +1,60 @@
1
+ fr:
2
+ devise:
3
+ sessions:
4
+ link: 'Connexion'
5
+ self_link: 'Se connecter'
6
+ or: 'ou'
7
+ signed_in: 'Vous êtes Connecté.'
8
+ signed_in_as: 'Connecté en tant que'
9
+ signed_out: 'Vous avez été déconnecté.'
10
+ unauthenticated: 'Vous devez vous connecter ou vous enregistrer avant de continuer.'
11
+ unconfirmed: 'Vous devez vous connecter avant de continuer.'
12
+ locked: 'Votre compte est vérrouillé.'
13
+ invalid: 'Email ou mot-de-passe invalide.'
14
+ invalid_token: "Jeton d'identification invalide."
15
+ timeout: 'Votre session a expiré, veuiller vous re-connecter pour continuer.'
16
+ inactive: "Votre compte n'as pas encore été activé."
17
+ Logout: 'Déconnexion'
18
+ Could_not_destroy_resource: "Suppression de l'Utilisateur impossible!"
19
+
20
+ passwords:
21
+ link: 'Mot de passe oublié ?'
22
+ send_me_instructions: 'Envoyez-moi les instructions de ré-initialisation de mot de passe'
23
+ send_instructions: 'Vous allez recevoir dans quelques minutes un email avec les instructions vous indiquant comment réinitiliser votre mot de passe.'
24
+ updated: 'Votre mot de passe a été changé avec succès. Vous êtes maintenant connecté.'
25
+ confirmations:
26
+ link: "Vous n'avez pas reçu les instructions de confirmation ?"
27
+ send_instructions: 'Vous allez recevoir dans quelques minutes un email, avec les instructions vous permettant de confirmer votre compte.'
28
+ confirmed: 'Votre compte a été confirmé avec succès. Vous êtes maintenant connecté.'
29
+ registrations:
30
+ link: 'Enregistrement'
31
+ self_link: "S'enregistrer"
32
+ edit: 'Éditer mon profil'
33
+ signed_up: 'Vous vous êtes enregistré avec succès. Si activé, une confirmation a été envoyée à votre adresse e-mail.'
34
+ updated: 'Vous avez mis à jour votre compte avec succès.'
35
+ destroyed: 'Au revoir! Votre compte a été supprimé avec succès. Nous espérons vous revoir bientôt.'
36
+ confirm_link: 'Vous pouvez confirmer votre compte avec le lien suivant :'
37
+ unlocks:
38
+ link: "Vous n'avez pas reçu les instructions de dé-verrouillage?"
39
+ send_instructions: 'Vous allez recevoir dans quelques minutes un email, avec les instructions vous permettant de dé-verrouiller votre compte.'
40
+ unlocked: 'Votre compte a été dé-verouillé avec succès. Vous êtes maintenant connecté.'
41
+ mailer:
42
+ confirmation_instructions: 'Instructions de confirmation'
43
+ reset_password_instructions: 'Instructiond de ré-initialisation de mot de passe'
44
+ #Ennder
45
+ Change_my_password: 'Changer mon mot de passe'
46
+ #Ennder
47
+ Someone_requested_change_password: "Quelqu'un a demandé un lien pour changer votre mot de passe, ce que vous pouvez faire avec le lien ci-dessous."
48
+ #Ennder
49
+ If_you_didnt_request_this: "Si vous n'avez pas demandé ce changement, veuillez ignorer cet email."
50
+ #Ennder
51
+ Your_password_wont_change_until: "Votre mot de passe ne changera pas avant que vous n'accédiez au lien ci-dessous pour en créer un nouveau."
52
+ unlock_instructions: 'Instructions de dé-verrouillage'
53
+
54
+ #marche que pour Rails 3 ?
55
+ helpers:
56
+ label:
57
+ user:
58
+ password: 'Mot de passe(helpers.label.user)'
59
+ users:
60
+ password: 'Mot de passe(helpers.label.users)'
@@ -0,0 +1,6 @@
1
+ # Sample localization file for English. Add more files in this directory for other locales.
2
+ # See http://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points.
3
+
4
+ en:
5
+ #Au moins une traduction sinon ça plante
6
+ hello: "Hello world"
@@ -0,0 +1,18 @@
1
+ # Sample localization file for English. Add more files in this directory for other locales.
2
+ # See http://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points.
3
+
4
+ # du plugin devise_ennder
5
+
6
+ fr:
7
+ #Au moins une traduction sinon ça plante
8
+ hello: "Salut le monde"
9
+
10
+ activerecord:
11
+ models:
12
+ user: "Utilisateur"
13
+ attributes:
14
+ user:
15
+ password: 'Mot de passe'
16
+ email: 'Email'
17
+ remember_me: 'Garder ma session active'
18
+ password_confirmation: 'Confirmation du mot de passe'
data/config/routes.rb ADDED
@@ -0,0 +1,4 @@
1
+ ActionController::Routing::Routes.draw do |map|
2
+ Rails.logger.debug 'Routes Devise_ennder apportés par le Gem'
3
+ map.devise_for :users
4
+ end
@@ -0,0 +1,23 @@
1
+ class DeviseCreateUsers < ActiveRecord::Migration
2
+ def self.up
3
+ create_table(:users) do |t|
4
+ t.database_authenticatable :null => false
5
+ t.confirmable
6
+ t.recoverable
7
+ t.rememberable
8
+ t.trackable
9
+ # t.lockable
10
+
11
+ t.timestamps
12
+ end
13
+
14
+ add_index :users, :email, :unique => true
15
+ add_index :users, :confirmation_token, :unique => true
16
+ add_index :users, :reset_password_token, :unique => true
17
+ # add_index :users, :unlock_token, :unique => true
18
+ end
19
+
20
+ def self.down
21
+ drop_table :users
22
+ end
23
+ end
@@ -0,0 +1,212 @@
1
+ module Devise
2
+ module Controllers
3
+ # Those helpers are convenience methods added to ApplicationController.
4
+ module Helpers
5
+
6
+ def self.included(base)
7
+ base.class_eval do
8
+ helper_method :warden, :signed_in?, :devise_controller?, :anybody_signed_in?,
9
+ *Devise.mappings.keys.map { |m| [:"current_#{m}", :"#{m}_signed_in?", :"#{m}_session"] }.flatten
10
+
11
+ # Use devise default_url_options. We have to declare it here to overwrite
12
+ # default definitions.
13
+ def default_url_options(options=nil)
14
+ Devise::Mapping.default_url_options
15
+ end
16
+ end
17
+ end
18
+
19
+ # The main accessor for the warden proxy instance
20
+ def warden
21
+ request.env['warden']
22
+ end
23
+
24
+ # Return true if it's a devise_controller. false to all controllers unless
25
+ # the controllers defined inside devise. Useful if you want to apply a before
26
+ # filter to all controller, except the ones in devise:
27
+ #
28
+ # before_filter :my_filter, :unless => { |c| c.devise_controller? }
29
+ def devise_controller?
30
+ false
31
+ end
32
+
33
+ # Attempts to authenticate the given scope by running authentication hooks,
34
+ # but does not redirect in case of failures.
35
+ def authenticate(scope)
36
+ warden.authenticate(:scope => scope)
37
+ end
38
+
39
+ # Attempts to authenticate the given scope by running authentication hooks,
40
+ # redirecting in case of failures.
41
+ def authenticate!(scope)
42
+ warden.authenticate!(:scope => scope)
43
+ end
44
+
45
+ # Check if the given scope is signed in session, without running
46
+ # authentication hooks.
47
+ def signed_in?(scope)
48
+ warden.authenticate?(:scope => scope)
49
+ end
50
+
51
+ # Check if the any scope is signed in session, without running
52
+ # authentication hooks.
53
+ def anybody_signed_in?
54
+ Devise.mappings.keys.any? { |scope| signed_in?(scope) }
55
+ end
56
+
57
+ # Sign in an user that already was authenticated. This helper is useful for logging
58
+ # users in after sign up.
59
+ #
60
+ # Examples:
61
+ #
62
+ # sign_in :user, @user # sign_in(scope, resource)
63
+ # sign_in @user # sign_in(resource)
64
+ #
65
+ def sign_in(resource_or_scope, resource=nil)
66
+ scope = Devise::Mapping.find_scope!(resource_or_scope)
67
+ resource ||= resource_or_scope
68
+ warden.set_user(resource, :scope => scope)
69
+ @_session = request.session # Recalculate session
70
+ end
71
+
72
+ # Sign out a given user or scope. This helper is useful for signing out an user
73
+ # after deleting accounts.
74
+ #
75
+ # Examples:
76
+ #
77
+ # sign_out :user # sign_out(scope)
78
+ # sign_out @user # sign_out(resource)
79
+ #
80
+ def sign_out(resource_or_scope)
81
+ scope = Devise::Mapping.find_scope!(resource_or_scope)
82
+ warden.user(scope) # Without loading user here, before_logout hook is not called
83
+ warden.raw_session.inspect # Without this inspect here. The session does not clear.
84
+ warden.logout(scope)
85
+ end
86
+
87
+ # Returns and delete the url stored in the session for the given scope. Useful
88
+ # for giving redirect backs after sign up:
89
+ #
90
+ # Example:
91
+ #
92
+ # redirect_to stored_location_for(:user) || root_path
93
+ #
94
+ def stored_location_for(resource_or_scope)
95
+ scope = Devise::Mapping.find_scope!(resource_or_scope)
96
+ key = "#{scope}.return_to"
97
+ session.delete(key) || session.delete(key.to_sym)
98
+ end
99
+
100
+ # The default url to be used after signing in. This is used by all Devise
101
+ # controllers and you can overwrite it in your ApplicationController to
102
+ # provide a custom hook for a custom resource.
103
+ #
104
+ # By default, it first tries to find a resource_root_path, otherwise it
105
+ # uses the root path. For a user scope, you can define the default url in
106
+ # the following way:
107
+ #
108
+ # map.user_root '/users', :controller => 'users' # creates user_root_path
109
+ #
110
+ # map.namespace :user do |user|
111
+ # user.root :controller => 'users' # creates user_root_path
112
+ # end
113
+ #
114
+ #
115
+ # If the resource root path is not defined, root_path is used. However,
116
+ # if this default is not enough, you can customize it, for example:
117
+ #
118
+ # def after_sign_in_path_for(resource)
119
+ # if resource.is_a?(User) && resource.can_publish?
120
+ # publisher_url
121
+ # else
122
+ # super
123
+ # end
124
+ # end
125
+ #
126
+ def after_sign_in_path_for(resource_or_scope)
127
+ scope = Devise::Mapping.find_scope!(resource_or_scope)
128
+ home_path = "#{scope}_root_path"
129
+ respond_to?(home_path, true) ? send(home_path) : root_path
130
+ end
131
+
132
+ # Method used by sessions controller to sign out an user. You can overwrite
133
+ # it in your ApplicationController to provide a custom hook for a custom
134
+ # scope. Notice that differently from +after_sign_in_path_for+ this method
135
+ # receives a symbol with the scope, and not the resource.
136
+ #
137
+ # By default is the root_path.
138
+ def after_sign_out_path_for(resource_or_scope)
139
+ root_path
140
+ end
141
+
142
+ # Sign in an user and tries to redirect first to the stored location and
143
+ # then to the url specified by after_sign_in_path_for.
144
+ #
145
+ # If just a symbol is given, consider that the user was already signed in
146
+ # through other means and just perform the redirection.
147
+ def sign_in_and_redirect(resource_or_scope, resource=nil, skip=false)
148
+ scope = Devise::Mapping.find_scope!(resource_or_scope)
149
+ resource ||= resource_or_scope
150
+ if skip
151
+ @_session = request.session # Recalculate session
152
+ else
153
+ sign_in(scope, resource)
154
+ end
155
+ redirect_to stored_location_for(scope) || after_sign_in_path_for(resource)
156
+ end
157
+
158
+ # Sign out an user and tries to redirect to the url specified by
159
+ # after_sign_out_path_for.
160
+ def sign_out_and_redirect(resource_or_scope)
161
+ scope = Devise::Mapping.find_scope!(resource_or_scope)
162
+ sign_out(scope)
163
+ redirect_to after_sign_out_path_for(scope)
164
+ end
165
+
166
+ # Define authentication filters and accessor helpers based on mappings.
167
+ # These filters should be used inside the controllers as before_filters,
168
+ # so you can control the scope of the user who should be signed in to
169
+ # access that specific controller/action.
170
+ # Example:
171
+ #
172
+ # Maps:
173
+ # User => :authenticatable
174
+ # Admin => :authenticatable
175
+ #
176
+ # Generated methods:
177
+ # authenticate_user! # Signs user in or redirect
178
+ # authenticate_admin! # Signs admin in or redirect
179
+ # user_signed_in? # Checks whether there is an user signed in or not
180
+ # admin_signed_in? # Checks whether there is an admin signed in or not
181
+ # current_user # Current signed in user
182
+ # current_admin # Current signed in admin
183
+ # user_session # Session data available only to the user scope
184
+ # admin_session # Session data available only to the admin scope
185
+ #
186
+ # Use:
187
+ # before_filter :authenticate_user! # Tell devise to use :user map
188
+ # before_filter :authenticate_admin! # Tell devise to use :admin map
189
+ #
190
+ Devise.mappings.each_key do |mapping|
191
+ class_eval <<-METHODS, __FILE__, __LINE__ + 1
192
+ def authenticate_#{mapping}!
193
+ warden.authenticate!(:scope => :#{mapping})
194
+ end
195
+
196
+ def #{mapping}_signed_in?
197
+ warden.authenticate?(:scope => :#{mapping})
198
+ end
199
+
200
+ def current_#{mapping}
201
+ @current_#{mapping} ||= warden.authenticate(:scope => :#{mapping})
202
+ end
203
+
204
+ def #{mapping}_session
205
+ current_#{mapping} && warden.session(:#{mapping})
206
+ end
207
+ METHODS
208
+ end
209
+
210
+ end
211
+ end
212
+ end
@@ -0,0 +1,129 @@
1
+ module Devise
2
+ module Controllers
3
+ # Those helpers are used only inside Devise controllers and should not be
4
+ # included in ApplicationController since they all depend on the url being
5
+ # accessed.
6
+ module InternalHelpers #:nodoc:
7
+
8
+ def self.included(base)
9
+ base.class_eval do
10
+ extend ScopedViews
11
+ unloadable
12
+
13
+ helper_method :resource, :scope_name, :resource_name, :resource_class, :devise_mapping, :devise_controller?
14
+ hide_action :resource, :scope_name, :resource_name, :resource_class, :devise_mapping, :devise_controller?
15
+
16
+ skip_before_filter *Devise.mappings.keys.map { |m| :"authenticate_#{m}!" }
17
+ prepend_before_filter :is_devise_resource?
18
+ end
19
+ end
20
+
21
+ module ScopedViews
22
+ def scoped_views
23
+ defined?(@scoped_views) ? @scoped_views : Devise.scoped_views
24
+ end
25
+
26
+ def scoped_views=(value)
27
+ @scoped_views = value
28
+ end
29
+ end
30
+
31
+ # Gets the actual resource stored in the instance variable
32
+ def resource
33
+ instance_variable_get(:"@#{resource_name}")
34
+ end
35
+
36
+ # Proxy to devise map name
37
+ def resource_name
38
+ devise_mapping.name
39
+ end
40
+ alias :scope_name :resource_name
41
+
42
+ # Proxy to devise map class
43
+ def resource_class
44
+ devise_mapping.to
45
+ end
46
+
47
+ # Attempt to find the mapped route for devise based on request path
48
+ def devise_mapping
49
+ @devise_mapping ||= begin
50
+ mapping = Devise::Mapping.find_by_path(request.path)
51
+ mapping ||= Devise.mappings[Devise.default_scope] if Devise.use_default_scope
52
+ mapping
53
+ end
54
+ end
55
+
56
+ # Overwrites devise_controller? to return true
57
+ def devise_controller?
58
+ true
59
+ end
60
+
61
+ protected
62
+
63
+ # Checks whether it's a devise mapped resource or not.
64
+ def is_devise_resource? #:nodoc:
65
+ raise ActionController::UnknownAction unless devise_mapping && devise_mapping.allows?(controller_name)
66
+ end
67
+
68
+ # Sets the resource creating an instance variable
69
+ def resource=(new_resource)
70
+ instance_variable_set(:"@#{resource_name}", new_resource)
71
+ end
72
+
73
+ # Build a devise resource.
74
+ def build_resource
75
+ self.resource ||= resource_class.new(params[resource_name] || {})
76
+ end
77
+
78
+ # Helper for use in before_filters where no authentication is required.
79
+ #
80
+ # Example:
81
+ # before_filter :require_no_authentication, :only => :new
82
+ def require_no_authentication
83
+ redirect_to after_sign_in_path_for(resource_name) if warden.authenticated?(resource_name)
84
+ end
85
+
86
+ # Sets the flash message with :key, using I18n. By default you are able
87
+ # to setup your messages using specific resource scope, and if no one is
88
+ # found we look to default scope.
89
+ # Example (i18n locale file):
90
+ #
91
+ # en:
92
+ # devise:
93
+ # passwords:
94
+ # #default_scope_messages - only if resource_scope is not found
95
+ # user:
96
+ # #resource_scope_messages
97
+ #
98
+ # Please refer to README or en.yml locale file to check what messages are
99
+ # available.
100
+ def set_flash_message(key, kind, now=false)
101
+ flash_hash = now ? flash.now : flash
102
+ flash_hash[key] = I18n.t(:"#{resource_name}.#{kind}",
103
+ :scope => [:devise, controller_name.to_sym], :default => kind)
104
+ end
105
+
106
+ # Shortcut to set flash.now message. Same rules applied from set_flash_message
107
+ def set_now_flash_message(key, kind)
108
+ set_flash_message(key, kind, true)
109
+ end
110
+
111
+ # Render a view for the specified scope. Turned off by default.
112
+ # Accepts just :controller as option.
113
+ def render_with_scope(action, options={})
114
+ controller_name = options.delete(:controller) || self.controller_name
115
+
116
+ if self.class.scoped_views
117
+ begin
118
+ render :template => "#{controller_name}/#{devise_mapping.as}/#{action}"
119
+ rescue ActionView::MissingTemplate
120
+ render action, :controller => controller_name
121
+ end
122
+ else
123
+ render action, :controller => controller_name
124
+ end
125
+ end
126
+
127
+ end
128
+ end
129
+ end