parlement 0.14 → 0.17

Sign up to get free protection for your applications and to get access to all the features.
Files changed (205) hide show
  1. data/CHANGES +41 -1
  2. data/MEMORY +66 -5
  3. data/README +10 -5
  4. data/Rakefile +15 -23
  5. data/app/controllers/account_controller.rb +48 -43
  6. data/app/controllers/{application.rb → application_controller.rb} +15 -12
  7. data/app/controllers/elt_controller.rb +77 -32
  8. data/app/controllers/subscriber_controller.rb +11 -10
  9. data/app/helpers/application_helper.rb +14 -1
  10. data/app/helpers/elt_helper.rb +9 -7
  11. data/app/models/elt.rb +25 -24
  12. data/app/models/mail.rb +44 -47
  13. data/app/models/person_notify.rb +2 -2
  14. data/app/models/user.rb +128 -2
  15. data/app/models/user_notify.rb +15 -15
  16. data/app/views/account/_login.rhtml +39 -39
  17. data/app/views/account/_show.rhtml +22 -30
  18. data/app/views/account/signup.rhtml +2 -2
  19. data/app/views/elt/_choice.rhtml +6 -6
  20. data/app/views/elt/_elt.rhtml +27 -32
  21. data/app/views/elt/choices.rhtml +16 -18
  22. data/app/views/elt/list/_byDate.rhtml +14 -14
  23. data/app/views/elt/list/_byVote.rhtml +15 -15
  24. data/app/views/elt/list/_children.rhtml +48 -40
  25. data/app/views/elt/list/_subscribers.rhtml +1 -1
  26. data/app/views/elt/new.rhtml +22 -21
  27. data/app/views/elt/rss.rxml +4 -11
  28. data/app/views/elt/show.rhtml +65 -61
  29. data/app/views/elt/vote_rss.rxml +4 -11
  30. data/app/views/layouts/top.rhtml +39 -50
  31. data/app/views/person/_listElts.rhtml +1 -1
  32. data/app/views/person/show.rhtml +1 -1
  33. data/{vendor/plugins/login_engine/app → app}/views/user_notify/change_password.rhtml +0 -0
  34. data/{vendor/plugins/login_engine/app → app}/views/user_notify/delete.rhtml +0 -0
  35. data/{vendor/plugins/login_engine/app → app}/views/user_notify/forgot_password.rhtml +0 -0
  36. data/{vendor/plugins/login_engine/app → app}/views/user_notify/pending_delete.rhtml +0 -0
  37. data/{vendor/plugins/login_engine/app → app}/views/user_notify/signup.rhtml +0 -0
  38. data/config/boot.rb +97 -32
  39. data/config/environment.rb +37 -35
  40. data/config/environments/development.rb +2 -3
  41. data/config/environments/production.rb +3 -0
  42. data/config/initializers/string_ruby_1.8.rb +10 -0
  43. data/config/routes.rb +17 -22
  44. data/db/schema.rb +102 -74
  45. data/lib/tasks/rspec.rake +167 -0
  46. data/public/404.html +25 -7
  47. data/public/500.html +26 -7
  48. data/public/dispatch.cgi +0 -0
  49. data/public/dispatch.fcgi +0 -0
  50. data/public/dispatch.rb +0 -0
  51. data/public/images/live_tree_branch_collapsed_icon.gif +0 -0
  52. data/public/images/live_tree_branch_expanded_icon.gif +0 -0
  53. data/public/images/live_tree_leaf_icon.gif +0 -0
  54. data/public/javascripts/application.js +258 -0
  55. data/public/javascripts/controls.js +544 -414
  56. data/public/javascripts/dragdrop.js +229 -198
  57. data/public/javascripts/effects.js +499 -459
  58. data/public/javascripts/prototype.js +2926 -1121
  59. data/public/javascripts/shadedborder.js +68 -50
  60. data/public/stylesheets/default.css +34 -34
  61. data/public/stylesheets/live_tree.css +0 -0
  62. data/public/stylesheets/scaffold.css +6 -6
  63. data/script/about +0 -0
  64. data/script/autospec +6 -0
  65. data/script/benchmarker +0 -0
  66. data/script/breakpointer +0 -0
  67. data/script/console +0 -0
  68. data/script/dbconsole +3 -0
  69. data/script/destroy +0 -0
  70. data/script/generate +0 -0
  71. data/script/plugin +0 -0
  72. data/script/profiler +0 -0
  73. data/script/runner +0 -0
  74. data/script/server +0 -0
  75. data/script/spec +10 -0
  76. data/script/spec_server +9 -0
  77. data/test/unit/attachment_test.rb +4 -4
  78. data/test/unit/choice_test.rb +1 -1
  79. data/test/unit/elt_test.rb +9 -9
  80. data/test/unit/mail_notify_test.rb +2 -2
  81. data/test/unit/mail_test.rb +18 -11
  82. data/test/unit/person_notify_test.rb +1 -1
  83. data/test/unit/person_test.rb +1 -1
  84. data/test/unit/subscriber_test.rb +1 -1
  85. data/test/unit/user_test.rb +81 -0
  86. data/test/unit/visit_test.rb +6 -6
  87. data/vendor/plugins/activerecord_foreign_key_extensions/init.rb +2 -0
  88. data/vendor/plugins/activerecord_foreign_key_extensions/lib/active_record_extensions.rb +182 -0
  89. data/vendor/plugins/activerecord_text_id_extensions/init.rb +2 -0
  90. data/vendor/plugins/activerecord_text_id_extensions/lib/active_record_extensions.rb +24 -0
  91. data/vendor/plugins/acts_as_nested_set/README +15 -0
  92. data/vendor/plugins/acts_as_nested_set/init.rb +1 -0
  93. data/vendor/plugins/acts_as_nested_set/lib/active_record/acts/nested_set.rb +210 -0
  94. data/vendor/plugins/acts_as_nested_set/test/nested_set_test.rb +269 -0
  95. data/vendor/plugins/acts_as_tree/README +26 -0
  96. data/vendor/plugins/acts_as_tree/Rakefile +22 -0
  97. data/vendor/plugins/acts_as_tree/init.rb +1 -0
  98. data/vendor/plugins/acts_as_tree/lib/active_record/acts/tree.rb +96 -0
  99. data/vendor/plugins/{output_compression/CHANGELOG → acts_as_tree/test/abstract_unit.rb} +0 -0
  100. data/vendor/plugins/acts_as_tree/test/acts_as_tree_test.rb +219 -0
  101. data/vendor/plugins/acts_as_tree/test/database.yml +0 -0
  102. data/vendor/plugins/acts_as_tree/test/fixtures/mixin.rb +0 -0
  103. data/vendor/plugins/acts_as_tree/test/fixtures/mixins.yml +0 -0
  104. data/vendor/plugins/acts_as_tree/test/schema.rb +0 -0
  105. data/vendor/plugins/classic_pagination/CHANGELOG +152 -0
  106. data/vendor/plugins/classic_pagination/README +18 -0
  107. data/vendor/plugins/{output_compression/rakefile → classic_pagination/Rakefile} +22 -22
  108. data/vendor/plugins/classic_pagination/init.rb +33 -0
  109. data/vendor/plugins/classic_pagination/install.rb +1 -0
  110. data/vendor/plugins/classic_pagination/lib/pagination.rb +405 -0
  111. data/vendor/plugins/classic_pagination/lib/pagination_helper.rb +135 -0
  112. data/vendor/plugins/classic_pagination/test/fixtures/companies.yml +24 -0
  113. data/vendor/plugins/classic_pagination/test/fixtures/company.rb +9 -0
  114. data/vendor/plugins/classic_pagination/test/fixtures/developer.rb +7 -0
  115. data/vendor/plugins/classic_pagination/test/fixtures/developers.yml +21 -0
  116. data/vendor/plugins/classic_pagination/test/fixtures/developers_projects.yml +13 -0
  117. data/vendor/plugins/classic_pagination/test/fixtures/project.rb +3 -0
  118. data/vendor/plugins/classic_pagination/test/fixtures/projects.yml +7 -0
  119. data/vendor/plugins/classic_pagination/test/fixtures/replies.yml +13 -0
  120. data/vendor/plugins/classic_pagination/test/fixtures/reply.rb +5 -0
  121. data/vendor/plugins/classic_pagination/test/fixtures/schema.sql +42 -0
  122. data/vendor/plugins/classic_pagination/test/fixtures/topic.rb +3 -0
  123. data/vendor/plugins/classic_pagination/test/fixtures/topics.yml +22 -0
  124. data/vendor/plugins/classic_pagination/test/helper.rb +117 -0
  125. data/vendor/plugins/classic_pagination/test/pagination_helper_test.rb +38 -0
  126. data/vendor/plugins/classic_pagination/test/pagination_test.rb +177 -0
  127. data/vendor/plugins/file_column/lib/file_column.rb +1 -1
  128. data/vendor/plugins/file_column/test/file_column_test.rb +0 -0
  129. metadata +151 -197
  130. data/app/helpers/live_tree.rb +0 -238
  131. data/app/views/elt/_form.rhtml +0 -31
  132. data/app/views/elt/show_tree.rhtml +0 -8
  133. data/config/environments/user_environment.rb +0 -1
  134. data/db/ROOT/Titemagli.txt +0 -3
  135. data/db/ROOT/titemagli.txt +0 -9
  136. data/public/javascripts/behaviour.js +0 -254
  137. data/public/javascripts/ie7-load.htc +0 -1
  138. data/public/javascripts/ie7.js +0 -6
  139. data/public/javascripts/live_tree.js +0 -749
  140. data/public/javascripts/mybehaviour.js +0 -225
  141. data/public/javascripts/scriptaculous.js +0 -47
  142. data/public/javascripts/slider.js +0 -283
  143. data/public/stylesheets/blue.css +0 -471
  144. data/vendor/plugins/engines/CHANGELOG +0 -241
  145. data/vendor/plugins/engines/MIT-LICENSE +0 -21
  146. data/vendor/plugins/engines/README +0 -64
  147. data/vendor/plugins/engines/Rakefile +0 -32
  148. data/vendor/plugins/engines/UPGRADING +0 -93
  149. data/vendor/plugins/engines/about.yml +0 -7
  150. data/vendor/plugins/engines/generators/plugin_migration/USAGE +0 -45
  151. data/vendor/plugins/engines/generators/plugin_migration/plugin_migration_generator.rb +0 -79
  152. data/vendor/plugins/engines/generators/plugin_migration/templates/plugin_migration.erb +0 -13
  153. data/vendor/plugins/engines/init.rb +0 -40
  154. data/vendor/plugins/engines/install.rb +0 -32
  155. data/vendor/plugins/engines/lib/engines.rb +0 -323
  156. data/vendor/plugins/engines/lib/engines/deprecated_config_support.rb +0 -135
  157. data/vendor/plugins/engines/lib/engines/plugin.rb +0 -214
  158. data/vendor/plugins/engines/lib/engines/plugin_list.rb +0 -31
  159. data/vendor/plugins/engines/lib/engines/plugin_migrator.rb +0 -60
  160. data/vendor/plugins/engines/lib/engines/rails_extensions.rb +0 -6
  161. data/vendor/plugins/engines/lib/engines/rails_extensions/active_record.rb +0 -19
  162. data/vendor/plugins/engines/lib/engines/rails_extensions/dependencies.rb +0 -143
  163. data/vendor/plugins/engines/lib/engines/rails_extensions/migrations.rb +0 -155
  164. data/vendor/plugins/engines/lib/engines/rails_extensions/public_asset_helpers.rb +0 -116
  165. data/vendor/plugins/engines/lib/engines/rails_extensions/rails.rb +0 -20
  166. data/vendor/plugins/engines/lib/engines/rails_extensions/rails_initializer.rb +0 -86
  167. data/vendor/plugins/engines/lib/engines/rails_extensions/routing.rb +0 -77
  168. data/vendor/plugins/engines/lib/engines/rails_extensions/templates.rb +0 -140
  169. data/vendor/plugins/engines/lib/engines/testing.rb +0 -87
  170. data/vendor/plugins/engines/tasks/engines.rake +0 -149
  171. data/vendor/plugins/login_engine/CHANGELOG +0 -22
  172. data/vendor/plugins/login_engine/README +0 -344
  173. data/vendor/plugins/login_engine/app/controllers/user_controller.rb +0 -262
  174. data/vendor/plugins/login_engine/app/helpers/user_helper.rb +0 -88
  175. data/vendor/plugins/login_engine/app/models/user.rb +0 -7
  176. data/vendor/plugins/login_engine/app/models/user_notify.rb +0 -75
  177. data/vendor/plugins/login_engine/app/views/user/_edit.rhtml +0 -11
  178. data/vendor/plugins/login_engine/app/views/user/_password.rhtml +0 -9
  179. data/vendor/plugins/login_engine/app/views/user/change_password.rhtml +0 -17
  180. data/vendor/plugins/login_engine/app/views/user/edit.rhtml +0 -23
  181. data/vendor/plugins/login_engine/app/views/user/forgot_password.rhtml +0 -18
  182. data/vendor/plugins/login_engine/app/views/user/home.rhtml +0 -7
  183. data/vendor/plugins/login_engine/app/views/user/login.rhtml +0 -17
  184. data/vendor/plugins/login_engine/app/views/user/logout.rhtml +0 -8
  185. data/vendor/plugins/login_engine/app/views/user/signup.rhtml +0 -17
  186. data/vendor/plugins/login_engine/db/migrate/001_initial_schema.rb +0 -25
  187. data/vendor/plugins/login_engine/init_engine.rb +0 -11
  188. data/vendor/plugins/login_engine/install.rb +0 -4
  189. data/vendor/plugins/login_engine/lib/login_engine.rb +0 -62
  190. data/vendor/plugins/login_engine/lib/login_engine/authenticated_system.rb +0 -113
  191. data/vendor/plugins/login_engine/lib/login_engine/authenticated_user.rb +0 -155
  192. data/vendor/plugins/login_engine/public/stylesheets/login_engine.css +0 -81
  193. data/vendor/plugins/login_engine/test/fixtures/users.yml +0 -41
  194. data/vendor/plugins/login_engine/test/functional/user_controller_test.rb +0 -536
  195. data/vendor/plugins/login_engine/test/mocks/mail.rb +0 -14
  196. data/vendor/plugins/login_engine/test/mocks/time.rb +0 -19
  197. data/vendor/plugins/login_engine/test/test_helper.rb +0 -11
  198. data/vendor/plugins/login_engine/test/unit/user_test.rb +0 -114
  199. data/vendor/plugins/output_compression/MIT-LICENSE +0 -20
  200. data/vendor/plugins/output_compression/README +0 -4
  201. data/vendor/plugins/output_compression/init.rb +0 -1
  202. data/vendor/plugins/output_compression/lib/output_compression.rb +0 -84
  203. data/vendor/plugins/output_compression/test/output_test.rb +0 -11
  204. data/vendor/plugins/output_compression/test/test_controller.rb +0 -3
  205. data/vendor/plugins/output_compression/test/test_helper.rb +0 -14
@@ -1,88 +0,0 @@
1
- module UserHelper
2
-
3
- # Abstraction to make views a little cleaner
4
- def form_input(helper_method, prompt, field_name=nil, options = {}, form_name = nil)
5
- form_name = "user" if form_name.nil?
6
- case helper_method.to_s
7
- when 'hidden_field'
8
- self.hidden_field(form_name, field_name, options)
9
- when /^.*button$/
10
- #prompt = l(:"#{@controller.controller_name}_#{field_name}_button")
11
- <<-EOL
12
- <tr><td class="button" colspan="2">
13
- #{self.send(helper_method, form_name, prompt, options)}
14
- </td></tr>
15
- EOL
16
- else
17
- field = (
18
- case helper_method
19
- when :select
20
- self.send(helper_method, form_name, field_name, options.delete('values'), options)
21
- when :password_field
22
- options[:value] = ""
23
- self.send(helper_method, form_name, field_name, options)
24
- else
25
- self.send(helper_method, form_name, field_name, options)
26
- end)
27
- # lname = "#{form_name}_#{field_name}_form"
28
- # prompt = l(:"#{lname}")
29
- if LoginEngine.config(:two_column_input)
30
- <<-EOL
31
- <tr class="two_columns">
32
- <td class="prompt"><label>#{prompt}:</label></td>
33
- <td class="value">#{field}</td>
34
- </tr>
35
- EOL
36
- else
37
- <<-EOL
38
- <tr><td class="prompt"><label>#{prompt}:</label></td></tr>
39
- <tr><td class="value">#{field}</td></tr>
40
- EOL
41
- end
42
- end
43
- end
44
-
45
- # def button_helper(name, options = {})
46
- # label = l(:"#{@controller.controller_name}_#{name}_button")
47
- # "#{self.send(:submit_tag, label, options)}"
48
- # end
49
-
50
- # def link_helper(name, options = {})
51
- # raise ArgumentError if name.nil?
52
- # label = l(:"#{@controller.controller_name}_#{name}_link")
53
- # "#{self.send(:link_to, label, options)}"
54
- # end
55
-
56
- def title_helper
57
- "#{@controller.controller_class_name} #{@controller.action_name}"
58
- end
59
-
60
- # def message_helper(name)
61
- # l(:"#{@controller.controller_name}_#{name}_message")
62
- # end
63
-
64
- def start_form_tag_helper(options = {})
65
- url = url_for(:action => "#{@controller.action_name}")
66
- "#{self.send(:start_form_tag, url, options)}"
67
- end
68
-
69
- def attributes(hash)
70
- hash.keys.inject("") { |attrs, key| attrs + %{#{key}="#{h(hash[key])}" } }
71
- end
72
-
73
- def read_only_field(form_name, field_name, html_options)
74
- "<span #{attributes(html_options)}>#{instance_variable_get('@' + form_name)[field_name]}</span>"
75
- end
76
-
77
- def submit_button(form_name, prompt, html_options)
78
- %{<input name="submit" type="submit" value="#{prompt}" />}
79
- end
80
-
81
- def changeable(user, field)
82
- if user.new_record? or LoginEngine.config(:changeable_fields).include?(field)
83
- :text_field
84
- else
85
- :read_only_field
86
- end
87
- end
88
- end
@@ -1,7 +0,0 @@
1
- class User < ActiveRecord::Base
2
- include LoginEngine::AuthenticatedUser
3
-
4
- # all logic has been moved into login_engine/lib/login_engine/authenticated_user.rb
5
-
6
- end
7
-
@@ -1,75 +0,0 @@
1
- class UserNotify < ActionMailer::Base
2
- def signup(user, password, url=nil)
3
- setup_email(user)
4
-
5
- # Email header info
6
- @subject += "Welcome to #{LoginEngine.config(:app_name)}!"
7
-
8
- # Email body substitutions
9
- @body["name"] = "#{user.firstname} #{user.lastname}"
10
- @body["login"] = user.login
11
- @body["password"] = password
12
- @body["url"] = url || LoginEngine.config(:app_url).to_s
13
- @body["app_name"] = LoginEngine.config(:app_name).to_s
14
- end
15
-
16
- def forgot_password(user, url=nil)
17
- setup_email(user)
18
-
19
- # Email header info
20
- @subject += "Forgotten password notification"
21
-
22
- # Email body substitutions
23
- @body["name"] = "#{user.firstname} #{user.lastname}"
24
- @body["login"] = user.login
25
- @body["url"] = url || LoginEngine.config(:app_url).to_s
26
- @body["app_name"] = LoginEngine.config(:app_name).to_s
27
- end
28
-
29
- def change_password(user, password, url=nil)
30
- setup_email(user)
31
-
32
- # Email header info
33
- @subject += "Changed password notification"
34
-
35
- # Email body substitutions
36
- @body["name"] = "#{user.firstname} #{user.lastname}"
37
- @body["login"] = user.login
38
- @body["password"] = password
39
- @body["url"] = url || LoginEngine.config(:app_url).to_s
40
- @body["app_name"] = LoginEngine.config(:app_name).to_s
41
- end
42
-
43
- def pending_delete(user, url=nil)
44
- setup_email(user)
45
-
46
- # Email header info
47
- @subject += "Delete user notification"
48
-
49
- # Email body substitutions
50
- @body["name"] = "#{user.firstname} #{user.lastname}"
51
- @body["url"] = url || LoginEngine.config(:app_url).to_s
52
- @body["app_name"] = LoginEngine.config(:app_name).to_s
53
- @body["days"] = LoginEngine.config(:delayed_delete_days).to_s
54
- end
55
-
56
- def delete(user, url=nil)
57
- setup_email(user)
58
-
59
- # Email header info
60
- @subject += "Delete user notification"
61
-
62
- # Email body substitutions
63
- @body["name"] = "#{user.firstname} #{user.lastname}"
64
- @body["url"] = url || LoginEngine.config(:app_url).to_s
65
- @body["app_name"] = LoginEngine.config(:app_name).to_s
66
- end
67
-
68
- def setup_email(user)
69
- @recipients = "#{user.email}"
70
- @from = LoginEngine.config(:email_from).to_s
71
- @subject = "[#{LoginEngine.config(:app_name)}] "
72
- @sent_on = Time.now
73
- @headers['Content-Type'] = "text/plain; charset=#{LoginEngine.config(:mail_charset)}; format=flowed"
74
- end
75
- end
@@ -1,11 +0,0 @@
1
- <div class="user_edit">
2
- <table>
3
- <%= form_input changeable(user, "firstname"), "First Name", "firstname" %>
4
- <%= form_input changeable(user, "lastname"), "Last Name","lastname" %>
5
- <%= form_input changeable(user, "login"), "Login ID", "login", :size => 30 %><br/>
6
- <%= form_input changeable(user, "email"), "Email", "email" %>
7
- <% if submit %>
8
- <%= form_input :submit_button, (user.new_record? ? 'Signup' : 'Change Settings'), :class => 'two_columns' %>
9
- <% end %>
10
- </table>
11
- </div>
@@ -1,9 +0,0 @@
1
- <div class="user_password">
2
- <table>
3
- <%= form_input :password_field, "Password", "password", :size => 30 %>
4
- <%= form_input :password_field, "Password Confirmation", "password_confirmation", :size => 30 %>
5
- <% if submit %>
6
- <%= form_input :submit_button, 'Change password' %>
7
- <% end %>
8
- </table>
9
- </div>
@@ -1,17 +0,0 @@
1
- <div title="<%= title_helper %>" class="form">
2
- <h3>Change Password</h3>
3
-
4
- <%= error_messages_for 'user' %>
5
-
6
- <div class="form-padding">
7
- <p>Enter your new password in the fields below and click 'Change Password' to have a new password sent to your email inbox.</p>
8
-
9
- <%= start_form_tag :action => 'change_password' %>
10
- <%= render_partial 'password', :user => @user, :submit => false %>
11
- <div class="button-bar">
12
- <%= submit_tag 'Change password' %>
13
- <%= link_to 'Cancel', :action => 'home' %>
14
- </div>
15
- <%= end_form_tag %>
16
- </div>
17
- </div>
@@ -1,23 +0,0 @@
1
- <div title="<%= title_helper %>" class="form">
2
- <h3>Edit user</h3>
3
-
4
- <%= error_messages_for 'user' %>
5
-
6
- <%= start_form_tag :action => 'edit' %>
7
- <%= render_partial 'edit', :user => @user, :submit => true %>
8
- <%= end_form_tag %>
9
- <br/>
10
- <%= start_form_tag :action => 'change_password' %>
11
- <%= hidden_field_tag "back_to", "edit" %>
12
- <%= render_partial 'password', :submit => true %>
13
- <%= end_form_tag %>
14
-
15
- <%= start_form_tag :action => 'delete' %>
16
- <div class="user_delete">
17
- <%= hidden_field 'user', 'form', :value => 'delete' %>
18
-
19
- <%= form_input :submit_button, 'Delete Account' %>
20
- </div>
21
- <%= end_form_tag %>
22
- </div>
23
- </div>
@@ -1,18 +0,0 @@
1
- <div title="<%= title_helper %>" class="form">
2
- <h3>Forgotten Password</h3>
3
-
4
- <%= error_messages_for 'user' %>
5
-
6
- <div class="form-padding">
7
- <p>Enter your email address in the field below and click 'Reset Password' to have instructions on how to retrieve your forgotten password emailed to you.</p>
8
-
9
- <%= start_form_tag_helper %>
10
- <label>Email Address:</label> <%= text_field("user", "email", "size" => 30) %>
11
-
12
- <div class="button-bar">
13
- <%= submit_tag 'Reset Password' %>
14
- <%= link_to 'Cancel', :action => 'login' %>
15
- </div>
16
- <%= end_form_tag %>
17
- </div>
18
- </div>
@@ -1,7 +0,0 @@
1
- <div title="<%= title_helper %>" class="memo">
2
- <h3>Welcome</h3>
3
- <p>You are now logged into the system, <%= @fullname %>...</p>
4
- <p>Since you are here it's safe to assume the application never called store_location, otherwise you would have been redirected somewhere else after a successful login.</p>
5
-
6
- <%= link_to '&#171; logout', :action => 'logout' %>
7
- </div>
@@ -1,17 +0,0 @@
1
- <div title="<%= title_helper %>" class="form">
2
- <h3>Please Login</h3>
3
-
4
- <div class="form-padding">
5
- <%= start_form_tag :action => 'login' %>
6
- <table>
7
- <%= form_input :text_field, "Login ID", "login", :size => 30 %><br/>
8
- <%= form_input :password_field, "Password", "password", :size => 30 %><br/>
9
- </table>
10
-
11
- <div class="button-bar">
12
- <%= submit_tag 'Login' %>
13
- <%= link_to 'Register for an account', :action => 'signup' %> |
14
- <%= link_to 'Forgot my password', :action => 'forgot_password' %> </div>
15
- <%= end_form_tag %>
16
- </div>
17
- </div>
@@ -1,8 +0,0 @@
1
- <div title="<%= title_helper %>" class="memo">
2
- <h3>Logoff</h3>
3
-
4
- <p>You are now logged out of the system...</p>
5
-
6
- <%= link_to '&#171; login', :action => 'login' %>
7
- </div>
8
-
@@ -1,17 +0,0 @@
1
- <div title="<%= title_helper %>" class="form">
2
- <h3>Signup</h3>
3
-
4
- <%= error_messages_for 'user' %>
5
-
6
- <div class="form-padding">
7
- <%= start_form_tag :action => 'signup' %>
8
- <%= render_partial 'edit', :user => @user, :submit => false %><br/>
9
- <%= render_partial 'password', :submit => false %>
10
-
11
- <div class="button-bar">
12
- <%= submit_tag 'Signup' %>
13
- <%= link_to 'Cancel', :action => 'login' %>
14
- </div>
15
- <%= end_form_tag %>
16
- </div>
17
- </div>
@@ -1,25 +0,0 @@
1
- class InitialSchema < ActiveRecord::Migration
2
- def self.up
3
- create_table LoginEngine.config(:user_table), :force => true do |t|
4
- t.column "login", :string, :limit => 80, :default => "", :null => false
5
- t.column "salted_password", :string, :limit => 40, :default => "", :null => false
6
- t.column "email", :string, :limit => 60, :default => "", :null => false
7
- t.column "firstname", :string, :limit => 40
8
- t.column "lastname", :string, :limit => 40
9
- t.column "salt", :string, :limit => 40, :default => "", :null => false
10
- t.column "verified", :integer, :default => 0
11
- t.column "role", :string, :limit => 40
12
- t.column "security_token", :string, :limit => 40
13
- t.column "token_expiry", :datetime
14
- t.column "created_at", :datetime
15
- t.column "updated_at", :datetime
16
- t.column "logged_in_at", :datetime
17
- t.column "deleted", :integer, :default => 0
18
- t.column "delete_after", :datetime
19
- end
20
- end
21
-
22
- def self.down
23
- drop_table LoginEngine.config(:user_table)
24
- end
25
- end
@@ -1,11 +0,0 @@
1
- # load up all the required files we need...
2
-
3
- require 'login_engine'
4
-
5
- module LoginEngine::Version
6
- Major = 1
7
- Minor = 0
8
- Release = 2
9
- end
10
-
11
- Engines.current.version = LoginEngine::Version
@@ -1,4 +0,0 @@
1
- # Install the engines plugin if it has been already
2
- unless File.exist?(File.dirname(__FILE__) + "/../engines")
3
- Commands::Plugin.parse!(['install', 'http://svn.rails-engines.org/plugins/engines'])
4
- end
@@ -1,62 +0,0 @@
1
- require 'login_engine/authenticated_user'
2
- require 'login_engine/authenticated_system'
3
-
4
- module LoginEngine
5
- include AuthenticatedSystem # re-include the helper module
6
-
7
- #--
8
- # Define the configuration values. config sets the value of the
9
- # constant ONLY if it has not already been set, i.e. by the user in
10
- # environment.rb
11
- #++
12
-
13
- # Source address for user emails
14
- config :email_from, 'webmaster@your.company'
15
-
16
- # Destination email for system errors
17
- config :admin_email, 'webmaster@your.company'
18
-
19
- # Sent in emails to users
20
- config :app_url, 'http://localhost:3000/'
21
-
22
- # Sent in emails to users
23
- config :app_name, 'TestApp'
24
-
25
- # Email charset
26
- config :mail_charset, 'utf-8'
27
-
28
- # Security token lifetime in hours
29
- config :security_token_life_hours, 24
30
-
31
- # Two column form input
32
- config :two_column_input, true
33
-
34
- # Add all changeable user fields to this array.
35
- # They will then be able to be edited from the edit action. You
36
- # should NOT include the email field in this array.
37
- config :changeable_fields, [ 'firstname', 'lastname' ]
38
-
39
- # Set to true to allow delayed deletes (i.e., delete of record
40
- # doesn't happen immediately after user selects delete account,
41
- # but rather after some expiration of time to allow this action
42
- # to be reverted).
43
- config :delayed_delete, false
44
-
45
- # Default is one week
46
- config :delayed_delete_days, 7
47
-
48
- # the table to store user information in
49
- if ActiveRecord::Base.pluralize_table_names
50
- config :user_table, "users"
51
- else
52
- config :user_table, "user"
53
- end
54
-
55
- # controls whether or not email is used
56
- config :use_email_notification, true
57
-
58
- # Controls whether accounts must be confirmed after signing up
59
- # ONLY if this and use_email_notification are both true
60
- config :confirm_account, true
61
-
62
- end
@@ -1,113 +0,0 @@
1
- module LoginEngine
2
- module AuthenticatedSystem
3
-
4
- protected
5
-
6
- # overwrite this if you want to restrict access to only a few actions
7
- # or if you want to check if the user has the correct rights
8
- # example:
9
- #
10
- # # only allow nonbobs
11
- # def authorize?(user)
12
- # user.login != "bob"
13
- # end
14
- def authorize?(user)
15
- true
16
- end
17
-
18
- # overwrite this method if you only want to protect certain actions of the controller
19
- # example:
20
- #
21
- # # don't protect the login and the about method
22
- # def protect?(action)
23
- # if ['action', 'about'].include?(action)
24
- # return false
25
- # else
26
- # return true
27
- # end
28
- # end
29
- def protect?(action)
30
- true
31
- end
32
-
33
- # login_required filter. add
34
- #
35
- # before_filter :login_required
36
- #
37
- # if the controller should be under any rights management.
38
- # for finer access control you can overwrite
39
- #
40
- # def authorize?(user)
41
- #
42
- def login_required
43
- if not protect?(action_name)
44
- return true
45
- end
46
-
47
- if user? and authorize?(session[:user])
48
- return true
49
- end
50
-
51
- # store current location so that we can
52
- # come back after the user logged in
53
- store_location
54
-
55
- # call overwriteable reaction to unauthorized access
56
- access_denied
57
- end
58
-
59
- # overwrite if you want to have special behavior in case the user is not authorized
60
- # to access the current operation.
61
- # the default action is to redirect to the login screen
62
- # example use :
63
- # a popup window might just close itself for instance
64
- def access_denied
65
- redirect_to :controller => "/user", :action => "login"
66
- end
67
-
68
- # store current uri in the session.
69
- # we can return to this location by calling return_location
70
- def store_location
71
- session['return-to'] = request.request_uri
72
- end
73
-
74
- # move to the last store_location call or to the passed default one
75
- def redirect_to_stored_or_default(default=nil)
76
- if session['return-to'].nil?
77
- redirect_to default
78
- else
79
- redirect_to_url session['return-to']
80
- session['return-to'] = nil
81
- end
82
- end
83
-
84
- def redirect_back_or_default(default=nil)
85
- if request.env["HTTP_REFERER"].nil?
86
- redirect_to default
87
- else
88
- redirect_to(request.env["HTTP_REFERER"]) # same as redirect_to :back
89
- end
90
- end
91
-
92
- def user?
93
- # First, is the user already authenticated?
94
- return true if not session[:user].nil?
95
-
96
- # If not, is the user being authenticated by a token?
97
- id = params[:user_id]
98
- key = params[:key]
99
- if id and key
100
- session[:user] = User.authenticate_by_token(id, key)
101
- return true if not session[:user].nil?
102
- end
103
-
104
- # Everything failed
105
- return false
106
- end
107
-
108
- # Returns the current user from the session, if any exists
109
- def current_user
110
- session[:user]
111
- end
112
- end
113
- end