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: 12 inserted, 12 deleted
@@ -144,25 +144,25 | |||
|
144 | 144 | if params[:file]=='' |
|
145 | 145 | flash[:notice] = 'Error importing no file' |
|
146 | 146 | redirect_to :action => 'list' and return |
|
147 | 147 | end |
|
148 | 148 | import_from_file(params[:file]) |
|
149 | 149 | end |
|
150 | 150 | |
|
151 | 151 | def random_all_passwords |
|
152 | 152 | users = User.find(:all) |
|
153 | 153 | @prefix = params[:prefix] || '' |
|
154 | 154 | @non_admin_users = User.find_non_admin_with_prefix(@prefix) |
|
155 | 155 | @changed = false |
|
156 |
- if request.request_method == |
|
|
156 | + if request.request_method == 'POST' | |
|
157 | 157 | @non_admin_users.each do |user| |
|
158 | 158 | password = random_password |
|
159 | 159 | user.password = password |
|
160 | 160 | user.password_confirmation = password |
|
161 | 161 | user.save |
|
162 | 162 | end |
|
163 | 163 | @changed = true |
|
164 | 164 | end |
|
165 | 165 | end |
|
166 | 166 | |
|
167 | 167 | # contest management |
|
168 | 168 |
@@ -1,39 +1,39 | |||
|
1 | 1 | %h1 Random user passwords |
|
2 | 2 | |
|
3 | - -if @changed | |
|
3 | + - if @changed | |
|
4 | 4 | %p |
|
5 | 5 | %b Done! |
|
6 | 6 | Here's a new password list. |
|
7 | 7 | Go back to |
|
8 | 8 | = (link_to '[user list]', :action => 'index') + '.' |
|
9 | 9 | %br/ |
|
10 | 10 | %table |
|
11 | 11 | %tr |
|
12 | 12 | %th Login |
|
13 | 13 | %th Fullname |
|
14 | 14 | %th Password |
|
15 | - -for u in @non_admin_users | |
|
15 | + - for u in @non_admin_users | |
|
16 | 16 | %tr |
|
17 | 17 | %td= u.login |
|
18 | 18 | %td= u.full_name |
|
19 | 19 | %td |
|
20 | 20 | %tt= u.password |
|
21 | 21 | |
|
22 | - -else | |
|
23 | - -if @prefix!='' | |
|
22 | + - else | |
|
23 | + - if @prefix!='' | |
|
24 | 24 | Current prefix: |
|
25 | 25 | = @prefix |
|
26 |
- |
|
|
26 | + = form_tag((url_for :action => 'random_all_passwords'), :method => 'get') do | |
|
27 | 27 | Change prefix |
|
28 | - =text_field_tag 'prefix' | |
|
29 | - =submit_tag 'Change' | |
|
28 | + = text_field_tag 'prefix' | |
|
29 | + = submit_tag 'Change' | |
|
30 | 30 | |
|
31 | 31 | This will change passwords of the following users. |
|
32 | 32 | %ul |
|
33 | - -for u in @non_admin_users | |
|
33 | + - for u in @non_admin_users | |
|
34 | 34 | %li= u.login |
|
35 | 35 | |
|
36 |
- |
|
|
37 | - =hidden_field_tag 'prefix', @prefix | |
|
36 | + = form_tag((url_for :action => 'random_all_passwords'), :method => 'post') do | |
|
37 | + = hidden_field_tag 'prefix', @prefix | |
|
38 | 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