parlement 0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (162) hide show
  1. data/CHANGES +709 -0
  2. data/COPYING +223 -0
  3. data/README +20 -0
  4. data/Rakefile +136 -0
  5. data/app/controllers/account_controller.rb +181 -0
  6. data/app/controllers/application.rb +30 -0
  7. data/app/controllers/elt_controller.rb +83 -0
  8. data/app/helpers/account_helper.rb +2 -0
  9. data/app/helpers/application_helper.rb +4 -0
  10. data/app/helpers/elt_helper.rb +37 -0
  11. data/app/helpers/live_tree.rb +238 -0
  12. data/app/helpers/mailman.rb +96 -0
  13. data/app/models/attachment.rb +4 -0
  14. data/app/models/elt.rb +17 -0
  15. data/app/models/mail.rb +4 -0
  16. data/app/models/notifier.rb +13 -0
  17. data/app/models/person.rb +9 -0
  18. data/app/models/user.rb +7 -0
  19. data/app/models/user_notify.rb +75 -0
  20. data/app/views/account/_help.rhtml +23 -0
  21. data/app/views/account/_login.rhtml +57 -0
  22. data/app/views/account/_show.rhtml +31 -0
  23. data/app/views/account/logout.rhtml +10 -0
  24. data/app/views/account/signup.rhtml +17 -0
  25. data/app/views/account/welcome.rhtml +13 -0
  26. data/app/views/elt/_elt.rhtml +105 -0
  27. data/app/views/elt/_form.rhtml +31 -0
  28. data/app/views/elt/_list.rhtml +28 -0
  29. data/app/views/elt/new.rhtml +102 -0
  30. data/app/views/elt/rss.rxml +31 -0
  31. data/app/views/elt/show.rhtml +46 -0
  32. data/app/views/elt/show_tree.rhtml +8 -0
  33. data/app/views/layouts/scaffold.rhtml +13 -0
  34. data/app/views/layouts/top.rhtml +45 -0
  35. data/app/views/notifier/changeEmail.rhtml +10 -0
  36. data/config/boot.rb +17 -0
  37. data/config/database.yml +82 -0
  38. data/config/environment.rb +92 -0
  39. data/config/environments/development.rb +17 -0
  40. data/config/environments/production.rb +17 -0
  41. data/config/environments/test.rb +17 -0
  42. data/config/environments/user_environment.rb +1 -0
  43. data/config/routes.rb +28 -0
  44. data/db/ROOT/CV.txt +166 -0
  45. data/db/ROOT/IP.txt +3 -0
  46. data/db/ROOT/parleR.txt +3 -0
  47. data/db/ROOT/parlement/security.txt +34 -0
  48. data/db/ROOT/parlement/test.txt +4 -0
  49. data/db/ROOT/parlement.txt +51 -0
  50. data/db/ROOT/perso.txt +215 -0
  51. data/db/schema.sql +127 -0
  52. data/lib/data_import.rb +54 -0
  53. data/lib/file_column.rb +263 -0
  54. data/lib/file_column_helper.rb +45 -0
  55. data/lib/localization.rb +88 -0
  56. data/lib/localizer.rb +88 -0
  57. data/lib/login_system.rb +87 -0
  58. data/lib/rails_file_column.rb +19 -0
  59. data/lib/user_system.rb +101 -0
  60. data/public/404.html +8 -0
  61. data/public/500.html +8 -0
  62. data/public/dispatch.cgi +10 -0
  63. data/public/dispatch.fcgi +24 -0
  64. data/public/dispatch.rb +10 -0
  65. data/public/engine_files/README +5 -0
  66. data/public/engine_files/login_engine/stylesheets/login_engine.css +81 -0
  67. data/public/favicon.ico +0 -0
  68. data/public/favicon.png +0 -0
  69. data/public/images/live_tree_branch_collapsed_icon.gif +0 -0
  70. data/public/images/live_tree_branch_expanded_icon.gif +0 -0
  71. data/public/images/live_tree_leaf_icon.gif +0 -0
  72. data/public/images/live_tree_loading_spinner.gif +0 -0
  73. data/public/images/webfeed.gif +0 -0
  74. data/public/javascripts/controls.js +721 -0
  75. data/public/javascripts/dragdrop.js +519 -0
  76. data/public/javascripts/effects.js +992 -0
  77. data/public/javascripts/live_tree.js +749 -0
  78. data/public/javascripts/prototype.js +1726 -0
  79. data/public/javascripts/scriptaculous.js +47 -0
  80. data/public/javascripts/slider.js +258 -0
  81. data/public/oldREADME +190 -0
  82. data/public/oldindex.html +78 -0
  83. data/public/robots.txt +1 -0
  84. data/public/stylesheets/default.css +238 -0
  85. data/public/stylesheets/live_tree.css +62 -0
  86. data/public/stylesheets/scaffold.css +74 -0
  87. data/script/about +3 -0
  88. data/script/benchmarker +19 -0
  89. data/script/breakpointer +3 -0
  90. data/script/console +3 -0
  91. data/script/create_db +7 -0
  92. data/script/destroy +3 -0
  93. data/script/generate +3 -0
  94. data/script/performance/benchmarker +3 -0
  95. data/script/performance/profiler +3 -0
  96. data/script/plugin +3 -0
  97. data/script/process/reaper +3 -0
  98. data/script/process/spawner +3 -0
  99. data/script/process/spinner +3 -0
  100. data/script/profiler +34 -0
  101. data/script/runner +3 -0
  102. data/script/server +3 -0
  103. data/test/fixtures/attachments.yml +10 -0
  104. data/test/fixtures/elts.yml +15 -0
  105. data/test/fixtures/mails.yml +7 -0
  106. data/test/fixtures/people.yml +49 -0
  107. data/test/fixtures/users.yml +41 -0
  108. data/test/functional/account_controller_test.rb +239 -0
  109. data/test/functional/elt_controller_test.rb +18 -0
  110. data/test/mocks/test/time.rb +17 -0
  111. data/test/mocks/test/user_notify.rb +16 -0
  112. data/test/test_helper.rb +28 -0
  113. data/test/unit/attachment_test.rb +14 -0
  114. data/test/unit/elt_test.rb +14 -0
  115. data/test/unit/mail_test.rb +14 -0
  116. data/test/unit/notifier_test.rb +31 -0
  117. data/test/unit/person_test.rb +24 -0
  118. data/test/unit/user_test.rb +94 -0
  119. data/vendor/plugins/engines/CHANGELOG +7 -0
  120. data/vendor/plugins/engines/README +128 -0
  121. data/vendor/plugins/engines/init.rb +33 -0
  122. data/vendor/plugins/engines/lib/action_mailer_extensions.rb +160 -0
  123. data/vendor/plugins/engines/lib/action_view_extensions.rb +130 -0
  124. data/vendor/plugins/engines/lib/dependencies_extensions.rb +56 -0
  125. data/vendor/plugins/engines/lib/engines.rb +292 -0
  126. data/vendor/plugins/engines/lib/ruby_extensions.rb +127 -0
  127. data/vendor/plugins/engines/lib/testing_extensions.rb +33 -0
  128. data/vendor/plugins/engines/test/ruby_extensions_test.rb +94 -0
  129. data/vendor/plugins/login_engine/README +258 -0
  130. data/vendor/plugins/login_engine/app/controllers/user_controller.rb +248 -0
  131. data/vendor/plugins/login_engine/app/helpers/user_helper.rb +88 -0
  132. data/vendor/plugins/login_engine/app/models/user.rb +7 -0
  133. data/vendor/plugins/login_engine/app/models/user_notify.rb +75 -0
  134. data/vendor/plugins/login_engine/app/views/user/_edit.rhtml +11 -0
  135. data/vendor/plugins/login_engine/app/views/user/_password.rhtml +9 -0
  136. data/vendor/plugins/login_engine/app/views/user/change_password.rhtml +17 -0
  137. data/vendor/plugins/login_engine/app/views/user/edit.rhtml +23 -0
  138. data/vendor/plugins/login_engine/app/views/user/forgot_password.rhtml +18 -0
  139. data/vendor/plugins/login_engine/app/views/user/home.rhtml +7 -0
  140. data/vendor/plugins/login_engine/app/views/user/login.rhtml +17 -0
  141. data/vendor/plugins/login_engine/app/views/user/logout.rhtml +8 -0
  142. data/vendor/plugins/login_engine/app/views/user/signup.rhtml +17 -0
  143. data/vendor/plugins/login_engine/app/views/user_notify/change_password.rhtml +10 -0
  144. data/vendor/plugins/login_engine/app/views/user_notify/delete.rhtml +5 -0
  145. data/vendor/plugins/login_engine/app/views/user_notify/forgot_password.rhtml +11 -0
  146. data/vendor/plugins/login_engine/app/views/user_notify/pending_delete.rhtml +9 -0
  147. data/vendor/plugins/login_engine/app/views/user_notify/signup.rhtml +12 -0
  148. data/vendor/plugins/login_engine/db/schema.rb +25 -0
  149. data/vendor/plugins/login_engine/init_engine.rb +10 -0
  150. data/vendor/plugins/login_engine/lib/login_engine/authenticated_system.rb +107 -0
  151. data/vendor/plugins/login_engine/lib/login_engine/authenticated_user.rb +149 -0
  152. data/vendor/plugins/login_engine/lib/login_engine.rb +58 -0
  153. data/vendor/plugins/login_engine/public/stylesheets/login_engine.css +81 -0
  154. data/vendor/plugins/login_engine/tasks/tasks.rake +4 -0
  155. data/vendor/plugins/login_engine/test/fixtures/templates/users.yml +41 -0
  156. data/vendor/plugins/login_engine/test/fixtures/users.yml +41 -0
  157. data/vendor/plugins/login_engine/test/functional/user_controller_test.rb +533 -0
  158. data/vendor/plugins/login_engine/test/mocks/mail.rb +14 -0
  159. data/vendor/plugins/login_engine/test/mocks/time.rb +19 -0
  160. data/vendor/plugins/login_engine/test/test_helper.rb +15 -0
  161. data/vendor/plugins/login_engine/test/unit/user_test.rb +94 -0
  162. metadata +276 -0
@@ -0,0 +1,248 @@
1
+ class UserController < ApplicationController
2
+ model :user
3
+
4
+ # Override this function in your own application to define a custom home action.
5
+ def home
6
+ if user?
7
+ @fullname = "#{current_user.firstname} #{current_user.lastname}"
8
+ else
9
+ @fullname = "Not logged in..."
10
+ end # this is a bit of a hack since the home action is used to verify user
11
+ # keys, where noone is logged in. We should probably create a unique
12
+ # 'validate_key' action instead.
13
+ end
14
+
15
+ def login
16
+ return if generate_blank
17
+ @user = User.new(params[:user]) # what does this achieve?
18
+ if session[:user] = User.authenticate(params[:user][:login], params[:user][:password])
19
+ session[:user].logged_in_at = Time.now
20
+ session[:user].save
21
+ flash[:notice] = 'Login successful'
22
+ redirect_back_or_default :action => 'home'
23
+ else
24
+ @login = params[:user][:login]
25
+ flash.now[:warning] = 'Login unsuccessful'
26
+ end
27
+ end
28
+
29
+ def signup
30
+ return if generate_blank
31
+ params[:user].delete('form')
32
+ @user = User.new(params[:user])
33
+ begin
34
+ User.transaction(@user) do
35
+ @user.new_password = true
36
+ unless LoginEngine.config(:use_email_notification)
37
+ @user.verified = 1
38
+ end
39
+ if @user.save
40
+ key = @user.generate_security_token
41
+ url = url_for(:action => 'home', 'user[id]' => @user.id, :key => key)
42
+ flash[:notice] = 'Signup successful!'
43
+ if LoginEngine.config(:use_email_notification)
44
+ UserNotify.deliver_signup(@user, params[:user][:password], url)
45
+ flash[:notice] << ' Please check your registered email account to verify your account registration and continue with the login.'
46
+ end
47
+ redirect_to :action => 'login'
48
+ end
49
+ end
50
+ rescue Exception => e
51
+ flash.now[:notice] = nil
52
+ flash.now[:warning] = 'Error creating account: confirmation email not sent'
53
+ logger.error e
54
+ end
55
+ end
56
+
57
+ def logout
58
+ session[:user] = nil
59
+ redirect_to :action => 'login'
60
+ end
61
+
62
+ def change_password
63
+ return if generate_filled_in
64
+ #puts "original password: #{@user.salted_password}"
65
+ do_change_password_for(@user)
66
+ #@user.reload
67
+ #puts "final password value: #{@user.salted_password}"
68
+ end
69
+
70
+ protected
71
+ def do_change_password_for(user)
72
+ begin
73
+ User.transaction(user) do
74
+ user.change_password(params[:user][:password], params[:user][:password_confirmation])
75
+ if user.save
76
+ #@user.reload
77
+ #puts "changed password: #{@user.salted_password}"
78
+ if LoginEngine.config(:use_email_notification)
79
+ UserNotify.deliver_change_password(user, params[:user][:password])
80
+ flash[:notice] = "Updated password emailed to #{@user.email}"
81
+ else
82
+ flash[:notice] = "Password updated."
83
+ end
84
+ # since sometimes we're changing the password from within another action/template...
85
+ redirect_to :action => params[:back_to] if params[:back_to]
86
+ else
87
+ end
88
+ end
89
+ rescue
90
+ flash[:warning] = 'Password could not be changed at this time. Please retry.'
91
+ end
92
+ end
93
+
94
+ public
95
+
96
+
97
+ def forgot_password
98
+ # Always redirect if logged in
99
+ if user?
100
+ flash[:message] = 'You are currently logged in. You may change your password now.'
101
+ redirect_to :action => 'change_password'
102
+ return
103
+ end
104
+
105
+ # Email disabled... we are unable to provide the password
106
+ if !LoginEngine.config(:use_email_notification)
107
+ flash[:message] = "Please contact the system admin at #{LoginEngine.config(:admin_email)} to retrieve your password."
108
+ redirect_back_or_default :action => 'login'
109
+ return
110
+ end
111
+
112
+ # Render on :get and render
113
+ return if generate_blank
114
+
115
+ # Handle the :post
116
+ if params[:user][:email].empty?
117
+ flash.now[:warning] = 'Please enter a valid email address.'
118
+ elsif (user = User.find_by_email(params[:user][:email])).nil?
119
+ flash.now[:warning] = "We could not find a user with the email address #{params[:user][:email]}"
120
+ else
121
+ begin
122
+ User.transaction(user) do
123
+ key = user.generate_security_token
124
+ url = url_for(:action => 'change_password', 'user[id]' => user.id, :key => key)
125
+ UserNotify.deliver_forgot_password(user, url)
126
+ flash[:notice] = "Instructions on resetting your password have been emailed to #{params[:user][:email]}"
127
+ end
128
+ unless user?
129
+ redirect_to :action => 'login'
130
+ return
131
+ end
132
+ redirect_back_or_default :action => 'home'
133
+ rescue
134
+ flash.now[:warning] = "Your password could not be emailed to #{params[:user][:email]}"
135
+ end
136
+ end
137
+ end
138
+
139
+ def edit
140
+ return if generate_filled_in
141
+ do_edit_user(@user)
142
+ end
143
+
144
+ protected
145
+ def do_edit_user(user)
146
+ begin
147
+ User.transaction(user) do
148
+ user.attributes = params[:user].delete_if { |k,v| not LoginEngine.config(:changeable_fields).include?(k) }
149
+ if user.save
150
+ flash[:notice] = "User details updated"
151
+ else
152
+ flash[:warning] = "Details could not be updated! Please retry."
153
+ end
154
+ end
155
+ rescue
156
+ flash.now[:warning] = "Error updating user details. Please try again later."
157
+ end
158
+ end
159
+
160
+ public
161
+
162
+ def delete
163
+ get_user_to_act_on
164
+ do_delete_user(@user)
165
+ end
166
+
167
+ protected
168
+ def do_delete_user(user)
169
+ begin
170
+ if LoginEngine.config(:delayed_delete)
171
+ User.transaction(user) do
172
+ key = user.set_delete_after
173
+ if LoginEngine.config(:use_email_notification)
174
+ url = url_for(:action => 'restore_deleted', 'user[id]' => user.id, :key => key)
175
+ UserNotify.deliver_pending_delete(user, url)
176
+ end
177
+ end
178
+ else
179
+ destroy(@user)
180
+ end
181
+ logout
182
+ rescue
183
+ if LoginEngine.config(:use_email_notification)
184
+ flash.now[:warning] = 'The delete instructions were not sent. Please try again later.'
185
+ else
186
+ flash.now[:notice] = 'The account has been scheduled for deletion. It will be removed in #{LoginEngine.config(:delayed_delete_days)} days.'
187
+ end
188
+ redirect_back_or_default :action => 'home'
189
+ end
190
+ end
191
+
192
+ public
193
+
194
+ def restore_deleted
195
+ get_user_to_act_on
196
+ @user.deleted = 0
197
+ if not @user.save
198
+ flash.now[:warning] = "The account for #{@user['login']} was not restored. Please try the link again."
199
+ redirect_to :action => 'login'
200
+ else
201
+ redirect_to :action => 'home'
202
+ end
203
+ end
204
+
205
+ protected
206
+
207
+ def destroy(user)
208
+ UserNotify.deliver_delete(user) if LoginEngine.config(:use_email_notification)
209
+ flash[:notice] = "The account for #{user['login']} was successfully deleted."
210
+ user.destroy()
211
+ end
212
+
213
+ def protect?(action)
214
+ if ['login', 'signup', 'forgot_password'].include?(action)
215
+ return false
216
+ else
217
+ return true
218
+ end
219
+ end
220
+
221
+ # Generate a template user for certain actions on get
222
+ def generate_blank
223
+ case request.method
224
+ when :get
225
+ @user = User.new
226
+ render
227
+ return true
228
+ end
229
+ return false
230
+ end
231
+
232
+ # Generate a template user for certain actions on get
233
+ def generate_filled_in
234
+ get_user_to_act_on
235
+ case request.method
236
+ when :get
237
+ render
238
+ return true
239
+ end
240
+ return false
241
+ end
242
+
243
+ # returns the user object this method should act upon; only really
244
+ # exists for other engines operating on top of this one to redefine...
245
+ def get_user_to_act_on
246
+ @user = session[:user]
247
+ end
248
+ end
@@ -0,0 +1,88 @@
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(:TwoColumnInput)
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
@@ -0,0 +1,7 @@
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
+
@@ -0,0 +1,75 @@
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
@@ -0,0 +1,11 @@
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>
@@ -0,0 +1,9 @@
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>
@@ -0,0 +1,17 @@
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>
@@ -0,0 +1,23 @@
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>
@@ -0,0 +1,18 @@
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
+ <%= form_input :text_field, 'Email Address', 'email', :size => 30 %><br/>
11
+
12
+ <div class="button-bar">
13
+ <%= submit_tag 'Submit request' %>
14
+ <%= link_to 'Cancel', :action => 'login' %>
15
+ </div>
16
+ <%= end_form_tag %>
17
+ </div>
18
+ </div>
@@ -0,0 +1,7 @@
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>
@@ -0,0 +1,17 @@
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>
@@ -0,0 +1,8 @@
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
+
@@ -0,0 +1,17 @@
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>
@@ -0,0 +1,10 @@
1
+ Dear <%= @name %>,
2
+
3
+ At your request, <%= @app_name %> has changed your password. If it was not at your request, then you should be aware that someone has access to your account and requested this change.
4
+
5
+ Your new login credentials are:
6
+
7
+ login: <%= @login %>
8
+ password: <%= @password %>
9
+
10
+ <%= @url %>
@@ -0,0 +1,5 @@
1
+ Dear <%= @name %>,
2
+
3
+ At your request, <%= @app_name %> has permanently deleted your account.
4
+
5
+ <%= @url %>
@@ -0,0 +1,11 @@
1
+ Dear <%= @name %>,
2
+
3
+ At your request, <%= @app_name %> has sent you the following URL so that you may reset your password. If it was not at your request, then you should be aware that someone has entered your email address as theirs in the forgotten password section of <%= @app_name %>.
4
+
5
+ Please click on the following link to go to the change password page:
6
+
7
+ <a href="<%= @url%>">Click me!</a>
8
+
9
+ It's advisable for you to change your password as soon as you login. It's as simple as navigating to 'Preferences' and clicking on 'Change Password'.
10
+
11
+ <%= @url %>
@@ -0,0 +1,9 @@
1
+ Dear <%= @name %>,
2
+
3
+ At your request, <%= @app_name %> has marked your account for deletion. If it was not at your request, then you should be aware that someone has access to your account and requested this change.
4
+
5
+ The following link is provided for you to restore your deleted account. If you click on this link within the next <%= @days %> days, your account will not be deleted. Otherwise, simply ignore this email and your account will be permanently deleted after that time.
6
+
7
+ <a href="<%= @url%>">Click me!</a>
8
+
9
+ <%= @url %>
@@ -0,0 +1,12 @@
1
+ Welcome to <%= @app_name %>, <%= @name %>.
2
+
3
+ Your login credentials are:
4
+
5
+ login: <%= @login %>
6
+ password: <%= @password %>
7
+
8
+ Please click on the following link to confirm your registration:
9
+
10
+ <a href="<%= @url%>">Click me!</a>
11
+
12
+ <%= @url %>
@@ -0,0 +1,25 @@
1
+ # This file is autogenerated. Instead of editing this file, please use the
2
+ # migrations feature of ActiveRecord to incrementally modify your database, and
3
+ # then regenerate this schema definition.
4
+
5
+ ActiveRecord::Schema.define() do
6
+
7
+ create_table LoginEngine.config(:user_table), :force => true do |t|
8
+ t.column "login", :string, :limit => 80, :default => "", :null => false
9
+ t.column "salted_password", :string, :limit => 40, :default => "", :null => false
10
+ t.column "email", :string, :limit => 60, :default => "", :null => false
11
+ t.column "firstname", :string, :limit => 40
12
+ t.column "lastname", :string, :limit => 40
13
+ t.column "salt", :string, :limit => 40, :default => "", :null => false
14
+ t.column "verified", :integer, :default => 0
15
+ t.column "role", :string, :limit => 40
16
+ t.column "security_token", :string, :limit => 40
17
+ t.column "token_expiry", :datetime
18
+ t.column "created_at", :datetime
19
+ t.column "updated_at", :datetime
20
+ t.column "logged_in_at", :datetime
21
+ t.column "deleted", :integer, :default => 0
22
+ t.column "delete_after", :datetime
23
+ end
24
+
25
+ end
@@ -0,0 +1,10 @@
1
+ # load up all the required files we need...
2
+
3
+ require 'login_engine'
4
+
5
+ # TODO: why do I have to include these here, when including them in login_engine.rb should be sufficient?
6
+ require 'authenticated_user'
7
+ require 'authenticated_system'
8
+
9
+ #ApplicationController.send(:include, LoginEngine)
10
+ #ApplicationHelper.send(:include, LoginEngine)