Description:
fixed form_tag bug in views
Commit status:
[Not Reviewed]
References:
Diff options:
Comments:
0 Commit comments
0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
r340:f512a445945b - - 2 files changed: 3 inserted, 3 deleted
@@ -150,13 +150,13 | |||||
|
150 |
|
150 | ||
|
151 | def random_all_passwords |
|
151 | def random_all_passwords |
|
152 | users = User.find(:all) |
|
152 | users = User.find(:all) |
|
153 | @prefix = params[:prefix] || '' |
|
153 | @prefix = params[:prefix] || '' |
|
154 | @non_admin_users = User.find_non_admin_with_prefix(@prefix) |
|
154 | @non_admin_users = User.find_non_admin_with_prefix(@prefix) |
|
155 | @changed = false |
|
155 | @changed = false |
|
156 |
- if request.request_method == |
|
156 | + if request.request_method == 'POST' |
|
157 | @non_admin_users.each do |user| |
|
157 | @non_admin_users.each do |user| |
|
158 | password = random_password |
|
158 | password = random_password |
|
159 | user.password = password |
|
159 | user.password = password |
|
160 | user.password_confirmation = password |
|
160 | user.password_confirmation = password |
|
161 | user.save |
|
161 | user.save |
|
162 | end |
|
162 | end |
@@ -20,20 +20,20 | |||||
|
20 | %tt= u.password |
|
20 | %tt= u.password |
|
21 |
|
21 | ||
|
22 | -else |
|
22 | - else |
|
23 | -if @prefix!='' |
|
23 | - if @prefix!='' |
|
24 | Current prefix: |
|
24 | Current prefix: |
|
25 | = @prefix |
|
25 | = @prefix |
|
26 |
- |
|
26 | + = form_tag((url_for :action => 'random_all_passwords'), :method => 'get') do |
|
27 | Change prefix |
|
27 | Change prefix |
|
28 | =text_field_tag 'prefix' |
|
28 | = text_field_tag 'prefix' |
|
29 | =submit_tag 'Change' |
|
29 | = submit_tag 'Change' |
|
30 |
|
30 | ||
|
31 | This will change passwords of the following users. |
|
31 | This will change passwords of the following users. |
|
32 | %ul |
|
32 | %ul |
|
33 | -for u in @non_admin_users |
|
33 | - for u in @non_admin_users |
|
34 | %li= u.login |
|
34 | %li= u.login |
|
35 |
|
35 | ||
|
36 |
- |
|
36 | + = form_tag((url_for :action => 'random_all_passwords'), :method => 'post') do |
|
37 | =hidden_field_tag 'prefix', @prefix |
|
37 | = hidden_field_tag 'prefix', @prefix |
|
38 | Are you sure? |
|
38 | Are you sure? |
|
39 | =submit_tag 'Go ahead' |
|
39 | = submit_tag 'Go ahead' |
You need to be logged in to leave comments.
Login now