Description:
consolidate
Commit status:
[Not Reviewed]
References:
Diff options:
Comments:
0 Commit comments
0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
r489:915396c14fc6 - - 23 files changed: 123 inserted, 159 deleted
@@ -1,31 +1,31 | |||
|
1 | 1 | source 'https://rubygems.org' |
|
2 | 2 | |
|
3 |
- gem 'rails', '3.2.1 |
|
|
3 | + gem 'rails', '3.2.21' | |
|
4 | 4 | |
|
5 | 5 | # Bundle edge Rails instead: |
|
6 | 6 | # gem 'rails', :git => 'git://github.com/rails/rails.git' |
|
7 | 7 | |
|
8 | 8 | gem 'mysql2' |
|
9 | 9 | |
|
10 | 10 | # Gems used only for assets and not required |
|
11 | 11 | # in production environments by default. |
|
12 | 12 | group :assets do |
|
13 |
- gem 'sass-rails', '~> 3.2. |
|
|
14 |
- gem 'coffee-rails', '~> 3.2. |
|
|
13 | + gem 'sass-rails', '~> 3.2.6' | |
|
14 | + gem 'coffee-rails', '~> 3.2.2' | |
|
15 | 15 | |
|
16 | 16 | # See https://github.com/sstephenson/execjs#readme for more supported runtimes |
|
17 | 17 | # gem 'therubyracer', :platforms => :ruby |
|
18 | 18 | |
|
19 |
- gem 'uglifier' |
|
|
19 | + gem 'uglifier' | |
|
20 | 20 | end |
|
21 | 21 | |
|
22 | 22 | gem 'prototype-rails' |
|
23 | 23 | |
|
24 | 24 | # To use ActiveModel has_secure_password |
|
25 | 25 | # gem 'bcrypt-ruby', '~> 3.0.0' |
|
26 | 26 | |
|
27 | 27 | # To use Jbuilder templates for JSON |
|
28 | 28 | # gem 'jbuilder' |
|
29 | 29 | |
|
30 | 30 | # Use unicorn as the app server |
|
31 | 31 | # gem 'unicorn' |
@@ -40,24 +40,24 | |||
|
40 | 40 | #in-place editor |
|
41 | 41 | gem 'best_in_place', '~> 3.0.1' |
|
42 | 42 | |
|
43 | 43 | # jquery addition |
|
44 | 44 | gem 'jquery-rails' |
|
45 | 45 | gem 'jquery-ui-sass-rails' |
|
46 | 46 | gem 'jquery-timepicker-addon-rails' |
|
47 | 47 | gem 'jquery-tablesorter' |
|
48 | 48 | |
|
49 | 49 | #syntax highlighter |
|
50 | 50 | gem 'rouge' |
|
51 | 51 | |
|
52 |
- gem |
|
|
53 |
- gem |
|
|
54 |
- gem |
|
|
55 |
- gem |
|
|
56 |
- gem 'will_paginate', '~> 3.0. |
|
|
52 | + gem 'haml' | |
|
53 | + gem 'mail' | |
|
54 | + gem 'rdiscount' | |
|
55 | + gem 'test-unit' | |
|
56 | + gem 'will_paginate', '~> 3.0.7' | |
|
57 | 57 | gem 'dynamic_form' |
|
58 | 58 | gem 'in_place_editing' |
|
59 |
- gem 'verification', :git => ' |
|
|
59 | + gem 'verification', :git => 'https://github.com/sikachu/verification.git' | |
|
60 | 60 | |
|
61 | 61 | group :test, :development do |
|
62 |
- gem |
|
|
62 | + gem 'rspec-rails', '~> 2.99.0' | |
|
63 | 63 | end |
@@ -1,175 +1,175 | |||
|
1 | 1 | GIT |
|
2 |
- remote: |
|
|
2 | + remote: https://github.com/sikachu/verification.git | |
|
3 | 3 | revision: 76eaf51b13276ecae54bd9cd115832595d2ff56d |
|
4 | 4 | specs: |
|
5 | 5 | verification (1.0.3) |
|
6 | 6 | actionpack (>= 3.0.0, < 5.0) |
|
7 | 7 | activesupport (>= 3.0.0, < 5.0) |
|
8 | 8 | |
|
9 | 9 | GEM |
|
10 | 10 | remote: https://rubygems.org/ |
|
11 | 11 | specs: |
|
12 |
- actionmailer (3.2.1 |
|
|
13 |
- actionpack (= 3.2.1 |
|
|
12 | + actionmailer (3.2.21) | |
|
13 | + actionpack (= 3.2.21) | |
|
14 | 14 | mail (~> 2.5.4) |
|
15 |
- actionpack (3.2.1 |
|
|
16 |
- activemodel (= 3.2.1 |
|
|
17 |
- activesupport (= 3.2.1 |
|
|
15 | + actionpack (3.2.21) | |
|
16 | + activemodel (= 3.2.21) | |
|
17 | + activesupport (= 3.2.21) | |
|
18 | 18 | builder (~> 3.0.0) |
|
19 | 19 | erubis (~> 2.7.0) |
|
20 | 20 | journey (~> 1.0.4) |
|
21 | 21 | rack (~> 1.4.5) |
|
22 | 22 | rack-cache (~> 1.2) |
|
23 | 23 | rack-test (~> 0.6.1) |
|
24 | 24 | sprockets (~> 2.2.1) |
|
25 |
- activemodel (3.2.1 |
|
|
26 |
- activesupport (= 3.2.1 |
|
|
25 | + activemodel (3.2.21) | |
|
26 | + activesupport (= 3.2.21) | |
|
27 | 27 | builder (~> 3.0.0) |
|
28 |
- activerecord (3.2.1 |
|
|
29 |
- activemodel (= 3.2.1 |
|
|
30 |
- activesupport (= 3.2.1 |
|
|
28 | + activerecord (3.2.21) | |
|
29 | + activemodel (= 3.2.21) | |
|
30 | + activesupport (= 3.2.21) | |
|
31 | 31 | arel (~> 3.0.2) |
|
32 | 32 | tzinfo (~> 0.3.29) |
|
33 |
- activeresource (3.2.1 |
|
|
34 |
- activemodel (= 3.2.1 |
|
|
35 |
- activesupport (= 3.2.1 |
|
|
36 |
- activesupport (3.2.1 |
|
|
33 | + activeresource (3.2.21) | |
|
34 | + activemodel (= 3.2.21) | |
|
35 | + activesupport (= 3.2.21) | |
|
36 | + activesupport (3.2.21) | |
|
37 | 37 | i18n (~> 0.6, >= 0.6.4) |
|
38 | 38 | multi_json (~> 1.0) |
|
39 | 39 | arel (3.0.3) |
|
40 |
- best_in_place (3.0. |
|
|
40 | + best_in_place (3.0.3) | |
|
41 | 41 | actionpack (>= 3.2) |
|
42 | 42 | railties (>= 3.2) |
|
43 | 43 | builder (3.0.4) |
|
44 | 44 | coffee-rails (3.2.2) |
|
45 | 45 | coffee-script (>= 2.2.0) |
|
46 | 46 | railties (~> 3.2.0) |
|
47 | 47 | coffee-script (2.3.0) |
|
48 | 48 | coffee-script-source |
|
49 | 49 | execjs |
|
50 |
- coffee-script-source (1. |
|
|
50 | + coffee-script-source (1.9.0) | |
|
51 | 51 | diff-lcs (1.2.5) |
|
52 | 52 | dynamic_form (1.1.4) |
|
53 | 53 | erubis (2.7.0) |
|
54 |
- execjs (2. |
|
|
55 |
- haml (4.0. |
|
|
54 | + execjs (2.3.0) | |
|
55 | + haml (4.0.6) | |
|
56 | 56 | tilt |
|
57 | 57 | hike (1.2.3) |
|
58 |
- i18n (0. |
|
|
58 | + i18n (0.7.0) | |
|
59 | 59 | in_place_editing (1.2.0) |
|
60 | 60 | journey (1.0.4) |
|
61 |
- jquery-rails (3.1. |
|
|
61 | + jquery-rails (3.1.2) | |
|
62 | 62 | railties (>= 3.0, < 5.0) |
|
63 | 63 | thor (>= 0.14, < 2.0) |
|
64 |
- jquery-tablesorter (1.1 |
|
|
64 | + jquery-tablesorter (1.13.4) | |
|
65 | 65 | railties (>= 3.1, < 5) |
|
66 | 66 | jquery-timepicker-addon-rails (1.4.1) |
|
67 | 67 | railties (>= 3.1) |
|
68 | 68 | jquery-ui-rails (4.0.3) |
|
69 | 69 | jquery-rails |
|
70 | 70 | railties (>= 3.1.0) |
|
71 | 71 | jquery-ui-sass-rails (4.0.3.0) |
|
72 | 72 | jquery-rails |
|
73 | 73 | jquery-ui-rails (= 4.0.3) |
|
74 | 74 | railties (>= 3.1.0) |
|
75 |
- json (1.8. |
|
|
75 | + json (1.8.2) | |
|
76 | 76 | mail (2.5.4) |
|
77 | 77 | mime-types (~> 1.16) |
|
78 | 78 | treetop (~> 1.4.8) |
|
79 | 79 | mime-types (1.25.1) |
|
80 | 80 | multi_json (1.10.1) |
|
81 |
- mysql2 (0.3.1 |
|
|
81 | + mysql2 (0.3.17) | |
|
82 | 82 | polyglot (0.3.5) |
|
83 |
- power_assert (0. |
|
|
83 | + power_assert (0.2.2) | |
|
84 | 84 | prototype-rails (3.2.1) |
|
85 | 85 | rails (~> 3.2) |
|
86 | 86 | rack (1.4.5) |
|
87 | 87 | rack-cache (1.2) |
|
88 | 88 | rack (>= 0.4) |
|
89 | 89 | rack-ssl (1.3.4) |
|
90 | 90 | rack |
|
91 |
- rack-test (0.6. |
|
|
91 | + rack-test (0.6.3) | |
|
92 | 92 | rack (>= 1.0) |
|
93 |
- rails (3.2.1 |
|
|
94 |
- actionmailer (= 3.2.1 |
|
|
95 |
- actionpack (= 3.2.1 |
|
|
96 |
- activerecord (= 3.2.1 |
|
|
97 |
- activeresource (= 3.2.1 |
|
|
98 |
- activesupport (= 3.2.1 |
|
|
93 | + rails (3.2.21) | |
|
94 | + actionmailer (= 3.2.21) | |
|
95 | + actionpack (= 3.2.21) | |
|
96 | + activerecord (= 3.2.21) | |
|
97 | + activeresource (= 3.2.21) | |
|
98 | + activesupport (= 3.2.21) | |
|
99 | 99 | bundler (~> 1.0) |
|
100 |
- railties (= 3.2.1 |
|
|
101 |
- railties (3.2.1 |
|
|
102 |
- actionpack (= 3.2.1 |
|
|
103 |
- activesupport (= 3.2.1 |
|
|
100 | + railties (= 3.2.21) | |
|
101 | + railties (3.2.21) | |
|
102 | + actionpack (= 3.2.21) | |
|
103 | + activesupport (= 3.2.21) | |
|
104 | 104 | rack-ssl (~> 1.3.2) |
|
105 | 105 | rake (>= 0.8.7) |
|
106 | 106 | rdoc (~> 3.4) |
|
107 | 107 | thor (>= 0.14.6, < 2.0) |
|
108 |
- rake (10. |
|
|
109 |
- rdiscount (2.1. |
|
|
108 | + rake (10.4.2) | |
|
109 | + rdiscount (2.1.8) | |
|
110 | 110 | rdoc (3.12.2) |
|
111 | 111 | json (~> 1.4) |
|
112 |
- rouge (1. |
|
|
113 |
- rspec-collection_matchers (1. |
|
|
112 | + rouge (1.8.0) | |
|
113 | + rspec-collection_matchers (1.1.2) | |
|
114 | 114 | rspec-expectations (>= 2.99.0.beta1) |
|
115 | 115 | rspec-core (2.99.2) |
|
116 | 116 | rspec-expectations (2.99.2) |
|
117 | 117 | diff-lcs (>= 1.1.3, < 2.0) |
|
118 |
- rspec-mocks (2.99. |
|
|
118 | + rspec-mocks (2.99.3) | |
|
119 | 119 | rspec-rails (2.99.0) |
|
120 | 120 | actionpack (>= 3.0) |
|
121 | 121 | activemodel (>= 3.0) |
|
122 | 122 | activesupport (>= 3.0) |
|
123 | 123 | railties (>= 3.0) |
|
124 | 124 | rspec-collection_matchers |
|
125 | 125 | rspec-core (~> 2.99.0) |
|
126 | 126 | rspec-expectations (~> 2.99.0) |
|
127 | 127 | rspec-mocks (~> 2.99.0) |
|
128 | - sass (3.4.1) | |
|
128 | + sass (3.4.11) | |
|
129 | 129 | sass-rails (3.2.6) |
|
130 | 130 | railties (~> 3.2.0) |
|
131 | 131 | sass (>= 3.1.10) |
|
132 | 132 | tilt (~> 1.3) |
|
133 |
- sprockets (2.2. |
|
|
133 | + sprockets (2.2.3) | |
|
134 | 134 | hike (~> 1.2) |
|
135 | 135 | multi_json (~> 1.0) |
|
136 | 136 | rack (~> 1.0) |
|
137 | 137 | tilt (~> 1.1, != 1.3.0) |
|
138 |
- test-unit (3.0. |
|
|
138 | + test-unit (3.0.9) | |
|
139 | 139 | power_assert |
|
140 | 140 | thor (0.19.1) |
|
141 | 141 | tilt (1.4.1) |
|
142 | 142 | treetop (1.4.15) |
|
143 | 143 | polyglot |
|
144 | 144 | polyglot (>= 0.3.1) |
|
145 |
- tzinfo (0.3.4 |
|
|
146 |
- uglifier (2. |
|
|
145 | + tzinfo (0.3.43) | |
|
146 | + uglifier (2.7.0) | |
|
147 | 147 | execjs (>= 0.3.0) |
|
148 | 148 | json (>= 1.8.0) |
|
149 | 149 | will_paginate (3.0.7) |
|
150 | 150 | |
|
151 | 151 | PLATFORMS |
|
152 | 152 | ruby |
|
153 | 153 | |
|
154 | 154 | DEPENDENCIES |
|
155 | 155 | best_in_place (~> 3.0.1) |
|
156 |
- coffee-rails (~> 3.2. |
|
|
156 | + coffee-rails (~> 3.2.2) | |
|
157 | 157 | dynamic_form |
|
158 | 158 | haml |
|
159 | 159 | in_place_editing |
|
160 | 160 | jquery-rails |
|
161 | 161 | jquery-tablesorter |
|
162 | 162 | jquery-timepicker-addon-rails |
|
163 | 163 | jquery-ui-sass-rails |
|
164 | 164 | |
|
165 | 165 | mysql2 |
|
166 | 166 | prototype-rails |
|
167 |
- rails (= 3.2.1 |
|
|
167 | + rails (= 3.2.21) | |
|
168 | 168 | rdiscount |
|
169 | 169 | rouge |
|
170 | - rspec-rails (~> 2.0) | |
|
171 |
- sass-rails (~> 3.2. |
|
|
170 | + rspec-rails (~> 2.99.0) | |
|
171 | + sass-rails (~> 3.2.6) | |
|
172 | 172 | test-unit |
|
173 |
- uglifier |
|
|
173 | + uglifier | |
|
174 | 174 | verification! |
|
175 |
- will_paginate (~> 3.0. |
|
|
175 | + will_paginate (~> 3.0.7) |
@@ -28,23 +28,23 | |||
|
28 | 28 | |
|
29 | 29 | def clear_all_stat |
|
30 | 30 | if not GraderConfiguration.indv_contest_mode? |
|
31 | 31 | redirect_to :action => 'index' and return |
|
32 | 32 | end |
|
33 | 33 | |
|
34 | 34 | UserContestStat.delete_all() |
|
35 | 35 | flash[:notice] = 'All start time statistic cleared.' |
|
36 | 36 | redirect_to :action => 'index' |
|
37 | 37 | end |
|
38 | 38 | |
|
39 | 39 | def change_contest_mode |
|
40 | - if ['standard', 'contest', 'indv-contest'].include? params[:id] | |
|
40 | + if ['standard', 'contest', 'indv-contest', 'analysis'].include? params[:id] | |
|
41 | 41 | config = GraderConfiguration.find_by_key('system.mode') |
|
42 | 42 | config.value = params[:id] |
|
43 | 43 | config.save |
|
44 | 44 | else |
|
45 | 45 | flash[:notice] = 'Wrong contest mode value' |
|
46 | 46 | end |
|
47 | 47 | redirect_to :action => 'index' |
|
48 | 48 | end |
|
49 | 49 | |
|
50 | 50 | end |
@@ -62,25 +62,25 | |||
|
62 | 62 | @submission.problem_id = params[:submission][:problem_id] |
|
63 | 63 | @submission.user = user |
|
64 | 64 | @submission.language_id = 0 |
|
65 | 65 | if (params['file']) and (params['file']!='') |
|
66 | 66 | @submission.source = File.open(params['file'].path,'r:UTF-8',&:read) |
|
67 | 67 | @submission.source.encode!('UTF-8','UTF-8',invalid: :replace, replace: '') |
|
68 | 68 | @submission.source_filename = params['file'].original_filename |
|
69 | 69 | end |
|
70 | 70 | @submission.submitted_at = Time.new.gmtime |
|
71 | 71 | @submission.ip_address = request.remote_ip |
|
72 | 72 | |
|
73 | 73 | if GraderConfiguration.time_limit_mode? and user.contest_finished? |
|
74 |
- @submission.errors.add |
|
|
74 | + @submission.errors.add(:base,"The contest is over.") | |
|
75 | 75 | prepare_list_information |
|
76 | 76 | render :action => 'list' and return |
|
77 | 77 | end |
|
78 | 78 | |
|
79 | 79 | if @submission.valid? |
|
80 | 80 | if @submission.save == false |
|
81 | 81 | flash[:notice] = 'Error saving your submission' |
|
82 | 82 | elsif Task.create(:submission_id => @submission.id, |
|
83 | 83 | :status => Task::STATUS_INQUEUE) == false |
|
84 | 84 | flash[:notice] = 'Error adding your submission to task queue' |
|
85 | 85 | end |
|
86 | 86 | else |
@@ -185,25 +185,25 | |||
|
185 | 185 | if params.has_key? 'recent' |
|
186 | 186 | prepare_announcements(params[:recent]) |
|
187 | 187 | else |
|
188 | 188 | prepare_announcements |
|
189 | 189 | end |
|
190 | 190 | render(:partial => 'announcement', |
|
191 | 191 | :collection => @announcements, |
|
192 | 192 | :locals => {:announcement_effect => true}) |
|
193 | 193 | end |
|
194 | 194 | |
|
195 | 195 | def confirm_contest_start |
|
196 | 196 | user = User.find(session[:user_id]) |
|
197 |
- if request.method == |
|
|
197 | + if request.method == 'POST' | |
|
198 | 198 | user.update_start_time |
|
199 | 199 | redirect_to :action => 'list' |
|
200 | 200 | else |
|
201 | 201 | @contests = user.contests |
|
202 | 202 | @user = user |
|
203 | 203 | end |
|
204 | 204 | end |
|
205 | 205 | |
|
206 | 206 | protected |
|
207 | 207 | |
|
208 | 208 | def prepare_announcements(recent=nil) |
|
209 | 209 | if GraderConfiguration.show_tasks_to?(@user) |
@@ -22,52 +22,53 | |||
|
22 | 22 | @message = Message.find(params[:id]) |
|
23 | 23 | end |
|
24 | 24 | |
|
25 | 25 | def list_all |
|
26 | 26 | @user = User.find(session[:user_id]) |
|
27 | 27 | @messages = Message.where(receiver_id: nil).order(:created_at) |
|
28 | 28 | end |
|
29 | 29 | |
|
30 | 30 | def create |
|
31 | 31 | user = User.find(session[:user_id]) |
|
32 | 32 | @message = Message.new(params[:message]) |
|
33 | 33 | @message.sender = user |
|
34 | - if !@message.save | |
|
35 | - render :action => 'list' and return | |
|
34 | + if @message.body == '' or !@message.save | |
|
35 | + flash[:notice] = 'An error occurred' | |
|
36 | 36 | else |
|
37 | 37 | flash[:notice] = 'New message posted' |
|
38 | + end | |
|
38 | 39 |
|
|
39 | 40 |
|
|
40 | - end | |
|
41 | 41 | |
|
42 | 42 | def reply |
|
43 | 43 | user = User.find(session[:user_id]) |
|
44 | 44 | @message = Message.new(params[:r_message]) |
|
45 | 45 | @message.sender = user |
|
46 | - if !@message.save | |
|
47 | - render :action => 'show' and return | |
|
46 | + if @message.body == '' or !@message.save | |
|
47 | + flash[:notice] = 'An error occurred' | |
|
48 | + redirect_to :action => 'show', :id => @message.replying_message_id | |
|
48 | 49 | else |
|
49 | 50 | flash[:notice] = 'Message replied' |
|
50 | 51 | rep_msg = @message.replying_message |
|
51 | 52 | rep_msg.replied = true |
|
52 | 53 | rep_msg.save |
|
53 | 54 | redirect_to :action => 'console' |
|
54 | 55 | end |
|
55 | 56 | end |
|
56 | 57 | |
|
57 | 58 | def hide |
|
58 | 59 | message = Message.find(params[:id]) |
|
59 | 60 | message.replied = true |
|
60 | 61 | message.save |
|
61 |
- flash[:notice] = 'Message hid |
|
|
62 | + flash[:notice] = 'Message hidden (just marked replied)' | |
|
62 | 63 | redirect_to :action => 'console' |
|
63 | 64 | end |
|
64 | 65 | |
|
65 | 66 | protected |
|
66 | 67 | def build_replying_message_hierarchy(user) |
|
67 | 68 | @all_messages = {} |
|
68 | 69 | |
|
69 | 70 | |
|
70 | 71 | # manually build replies hierarchy (to improve efficiency) |
|
71 | 72 | [@messages, @replied_messages].each do |collection| |
|
72 | 73 | collection.each do |m| |
|
73 | 74 | @all_messages[m.id] = {:msg => m, :replies => []} |
@@ -17,25 +17,25 | |||
|
17 | 17 | def submit |
|
18 | 18 | @user = User.find(session[:user_id]) |
|
19 | 19 | |
|
20 | 20 | @submitted_test_request = TestRequest.new_from_form_params(@user,params[:test_request]) |
|
21 | 21 | |
|
22 | 22 | if ! @submitted_test_request.errors.empty? |
|
23 | 23 | prepare_index_information |
|
24 | 24 | render :action => 'index' and return |
|
25 | 25 | end |
|
26 | 26 | |
|
27 | 27 | if GraderConfiguration.time_limit_mode? |
|
28 | 28 | if @user.contest_finished? |
|
29 |
- @submitted_test_request.errors.add |
|
|
29 | + @submitted_test_request.errors.add(:base,'Contest is over.') | |
|
30 | 30 | prepare_index_information |
|
31 | 31 | render :action => 'index' and return |
|
32 | 32 | end |
|
33 | 33 | |
|
34 | 34 | if !GraderConfiguration.allow_test_request(@user) |
|
35 | 35 | prepare_index_information |
|
36 | 36 | flash[:notice] = 'Test request is not allowed during the last 30 minutes' |
|
37 | 37 | redirect_to :action => 'index' and return |
|
38 | 38 | end |
|
39 | 39 | end |
|
40 | 40 | |
|
41 | 41 | if @submitted_test_request.save |
@@ -1,17 +1,16 | |||
|
1 | 1 | require 'csv' |
|
2 | 2 | |
|
3 | 3 | class UserAdminController < ApplicationController |
|
4 | 4 | |
|
5 | - | |
|
6 | 5 | include MailHelperMethods |
|
7 | 6 | |
|
8 | 7 | before_filter :admin_authorization |
|
9 | 8 | |
|
10 | 9 | # GETs should be safe (see http://www.w3.org/2001/tag/doc/whenToUseGet.html) |
|
11 | 10 | verify :method => :post, :only => [ :destroy, |
|
12 | 11 | :create, :create_from_list, |
|
13 | 12 | :update, |
|
14 | 13 | :manage_contest, |
|
15 | 14 | :bulk_mail |
|
16 | 15 | ], |
|
17 | 16 | :redirect_to => { :action => :list } |
@@ -142,31 +141,24 | |||
|
142 | 141 | ustat = Array.new |
|
143 | 142 | ustat[0] = u |
|
144 | 143 | @problems.each do |p| |
|
145 | 144 | sub = Submission.find_last_by_user_and_problem(u.id,p.id) |
|
146 | 145 | if (sub!=nil) and (sub.points!=nil) |
|
147 | 146 | ustat << [(sub.points.to_f*100/p.full_score).round, (sub.points>=p.full_score)] |
|
148 | 147 | else |
|
149 | 148 | ustat << [0,false] |
|
150 | 149 | end |
|
151 | 150 | end |
|
152 | 151 | @scorearray << ustat |
|
153 | 152 | end |
|
154 | - | |
|
155 | - if params[:commit] == 'download csv' then | |
|
156 | - csv = gen_csv_from_scorearray(@scorearray,@problems) | |
|
157 | - send_data csv, filename: 'last_score.csv' | |
|
158 | - else | |
|
159 | - render template: 'user_admin/user_stat' | |
|
160 | - end | |
|
161 | 153 | end |
|
162 | 154 | |
|
163 | 155 | def user_stat_max |
|
164 | 156 | if params[:commit] == 'download csv' |
|
165 | 157 | @problems = Problem.all |
|
166 | 158 | else |
|
167 | 159 | @problems = Problem.find_available_problems |
|
168 | 160 | end |
|
169 | 161 | @users = User.find(:all, :include => [:contests, :contest_stat]) |
|
170 | 162 | @scorearray = Array.new |
|
171 | 163 | #set up range from param |
|
172 | 164 | since_id = params.fetch(:since_id, 0).to_i |
@@ -54,25 +54,25 | |||
|
54 | 54 | end |
|
55 | 55 | @user = User.new(params[:user]) |
|
56 | 56 | @user.password_confirmation = @user.password = User.random_password |
|
57 | 57 | @user.activated = false |
|
58 | 58 | if (@user.valid?) and (@user.save) |
|
59 | 59 | if send_confirmation_email(@user) |
|
60 | 60 | render :action => 'new_splash', :layout => 'empty' |
|
61 | 61 | else |
|
62 | 62 | @admin_email = GraderConfiguration['system.admin_email'] |
|
63 | 63 | render :action => 'email_error', :layout => 'empty' |
|
64 | 64 | end |
|
65 | 65 | else |
|
66 |
- @user.errors.add |
|
|
66 | + @user.errors.add(:base,"Email cannot be blank") if @user.email=='' | |
|
67 | 67 | render :action => 'new', :layout => 'empty' |
|
68 | 68 | end |
|
69 | 69 | end |
|
70 | 70 | |
|
71 | 71 | def confirm |
|
72 | 72 | login = params[:login] |
|
73 | 73 | key = params[:activation] |
|
74 | 74 | @user = User.find_by_login(login) |
|
75 | 75 | if (@user) and (@user.verify_activation_key(key)) |
|
76 | 76 | if @user.valid? # check uniquenss of email |
|
77 | 77 | @user.activated = true |
|
78 | 78 | @user.save |
@@ -145,41 +145,41 | |||
|
145 | 145 | contest_name = GraderConfiguration['contest.name'] |
|
146 | 146 | activation_url = url_for(:action => 'confirm', |
|
147 | 147 | :login => user.login, |
|
148 | 148 | :activation => user.activation_key) |
|
149 | 149 | home_url = url_for(:controller => 'main', :action => 'index') |
|
150 | 150 | mail_subject = "[#{contest_name}] Confirmation" |
|
151 | 151 | mail_body = t('registration.email_body', { |
|
152 | 152 | :full_name => user.full_name, |
|
153 | 153 | :contest_name => contest_name, |
|
154 | 154 | :login => user.login, |
|
155 | 155 | :password => user.password, |
|
156 | 156 | :activation_url => activation_url, |
|
157 | - :admin_email => admin_email | |
|
157 | + :admin_email => GraderConfiguration['system.admin_email'] | |
|
158 | 158 | }) |
|
159 | 159 | |
|
160 | 160 | logger.info mail_body |
|
161 | 161 | |
|
162 | 162 | send_mail(user.email, mail_subject, mail_body) |
|
163 | 163 | end |
|
164 | 164 | |
|
165 | 165 | def send_new_password_email(user) |
|
166 | 166 | contest_name = GraderConfiguration['contest.name'] |
|
167 | 167 | mail_subject = "[#{contest_name}] Password recovery" |
|
168 | 168 | mail_body = t('registration.password_retrieval.email_body', { |
|
169 | 169 | :full_name => user.full_name, |
|
170 | 170 | :contest_name => contest_name, |
|
171 | 171 | :login => user.login, |
|
172 | 172 | :password => user.password, |
|
173 | - :admin_email => admin_email | |
|
173 | + :admin_email => GraderConfiguration['system.admin_email'] | |
|
174 | 174 | }) |
|
175 | 175 | |
|
176 | 176 | logger.info mail_body |
|
177 | 177 | |
|
178 | 178 | send_mail(user.email, mail_subject, mail_body) |
|
179 | 179 | end |
|
180 | 180 | |
|
181 | 181 | # allow viewing of regular user profile only when options allow so |
|
182 | 182 | # only admins can view admins profile |
|
183 | 183 | def profile_authorization |
|
184 | 184 | #if view admins' profile, allow only admin |
|
185 | 185 | return false unless(params[:id]) |
@@ -109,25 +109,25 | |||
|
109 | 109 | |
|
110 | 110 | contest_name = GraderConfiguration['contest.name'] |
|
111 | 111 | |
|
112 | 112 | # |
|
113 | 113 | # build real title bar |
|
114 | 114 | result = <<TITLEBAR |
|
115 | 115 | <div class="title"> |
|
116 | 116 | <table> |
|
117 | 117 | #{header} |
|
118 | 118 | <tr> |
|
119 | 119 | <td class="left-col"> |
|
120 | 120 | #{user.full_name}<br/> |
|
121 | - #{t 'title_bar.current_time'} #{format_short_time(Time.new)} | |
|
121 | + #{t 'title_bar.current_time'} #{format_short_time(Time.zone.now)} | |
|
122 | 122 | #{time_left} |
|
123 | 123 | <br/> |
|
124 | 124 | </td> |
|
125 | 125 | <td class="right-col">#{contest_name}</td> |
|
126 | 126 | </tr> |
|
127 | 127 | </table> |
|
128 | 128 | </div> |
|
129 | 129 | TITLEBAR |
|
130 | 130 | result.html_safe |
|
131 | 131 | end |
|
132 | 132 | |
|
133 | 133 | def markdown(text) |
@@ -36,25 +36,25 | |||
|
36 | 36 | return problem, 'Error importing' |
|
37 | 37 | end |
|
38 | 38 | |
|
39 | 39 | import_to_db = params.has_key? :import_to_db |
|
40 | 40 | |
|
41 | 41 | importer = TestdataImporter.new(problem) |
|
42 | 42 | |
|
43 | 43 | if not importer.import_from_file(import_params[:file], |
|
44 | 44 | import_params[:time_limit], |
|
45 | 45 | import_params[:memory_limit], |
|
46 | 46 | import_params[:checker_name], |
|
47 | 47 | import_to_db) |
|
48 |
- problem.errors.add |
|
|
48 | + problem.errors.add(:base,'Import error.') | |
|
49 | 49 | end |
|
50 | 50 | |
|
51 | 51 | return problem, importer.log_msg |
|
52 | 52 | end |
|
53 | 53 | |
|
54 | 54 | def self.download_file_basedir |
|
55 | 55 | return "#{Rails.root}/data/tasks" |
|
56 | 56 | end |
|
57 | 57 | |
|
58 | 58 | def get_submission_stat |
|
59 | 59 | result = Hash.new |
|
60 | 60 | #total number of submission |
@@ -76,35 +76,35 | |||
|
76 | 76 | result = st.to_f |
|
77 | 77 | end |
|
78 | 78 | result ||= default |
|
79 | 79 | end |
|
80 | 80 | |
|
81 | 81 | def self.extract_params_and_check(params, problem) |
|
82 | 82 | time_limit = Problem.to_f_or_default(params[:time_limit], |
|
83 | 83 | DEFAULT_TIME_LIMIT) |
|
84 | 84 | memory_limit = Problem.to_i_or_default(params[:memory_limit], |
|
85 | 85 | DEFAULT_MEMORY_LIMIT) |
|
86 | 86 | |
|
87 | 87 | if time_limit<=0 or time_limit >60 |
|
88 |
- problem.errors.add |
|
|
88 | + problem.errors.add(:base,'Time limit out of range.') | |
|
89 | 89 | end |
|
90 | 90 | |
|
91 | 91 | if memory_limit==0 and params[:memory_limit]!='0' |
|
92 |
- problem.errors.add |
|
|
92 | + problem.errors.add(:base,'Memory limit format errors.') | |
|
93 | 93 | elsif memory_limit<=0 or memory_limit >512 |
|
94 |
- problem.errors.add |
|
|
94 | + problem.errors.add(:base,'Memory limit out of range.') | |
|
95 | 95 | end |
|
96 | 96 | |
|
97 | 97 | if params[:file]==nil or params[:file]=='' |
|
98 |
- problem.errors.add |
|
|
98 | + problem.errors.add(:base,'No testdata file.') | |
|
99 | 99 | end |
|
100 | 100 | |
|
101 | 101 | checker_name = 'text' |
|
102 | 102 | if ['text','float'].include? params[:checker] |
|
103 | 103 | checker_name = params[:checker] |
|
104 | 104 | end |
|
105 | 105 | |
|
106 | 106 | file = params[:file] |
|
107 | 107 | |
|
108 | 108 | if !problem.errors.empty? |
|
109 | 109 | return nil, problem |
|
110 | 110 | end |
@@ -61,30 +61,30 | |||
|
61 | 61 | test_request.problem = problem |
|
62 | 62 | if problem!=nil |
|
63 | 63 | test_request.submission = |
|
64 | 64 | Submission.find_by_user_problem_number(user.id, |
|
65 | 65 | problem.id, |
|
66 | 66 | params[:submission_number]) |
|
67 | 67 | else |
|
68 | 68 | test_request.submission = nil |
|
69 | 69 | end |
|
70 | 70 | |
|
71 | 71 | # checks if the user submits any input file |
|
72 | 72 | if params[:input_file]==nil or params[:input_file]=="" |
|
73 |
- test_request.errors.add |
|
|
73 | + test_request.errors.add(:base,"No input submitted.") | |
|
74 | 74 | test_request.input_file_name = nil |
|
75 | 75 | else |
|
76 | 76 | test_request.input_file_name = save_input_file(params[:input_file], user, problem) |
|
77 | 77 | if test_request.input_file_name == nil |
|
78 |
- test_request.errors.add |
|
|
78 | + test_request.errors.adds(:base,"No input submitted.") | |
|
79 | 79 | end |
|
80 | 80 | if params[:additional_file]!=nil and params[:additional_file]!="" |
|
81 | 81 | save_additional_file(params[:additional_file], |
|
82 | 82 | "#{test_request.input_file_name}.files") |
|
83 | 83 | end |
|
84 | 84 | end |
|
85 | 85 | test_request.submitted_at = Time.new.gmtime |
|
86 | 86 | test_request.status_inqueue |
|
87 | 87 | test_request |
|
88 | 88 | end |
|
89 | 89 | |
|
90 | 90 | protected |
@@ -58,82 +58,35 | |||
|
58 | 58 | before_save :encrypt_new_password |
|
59 | 59 | before_save :assign_default_site |
|
60 | 60 | before_save :assign_default_contest |
|
61 | 61 | |
|
62 | 62 | # this is for will_paginate |
|
63 | 63 | cattr_reader :per_page |
|
64 | 64 | @@per_page = 50 |
|
65 | 65 | |
|
66 | 66 | def self.authenticate(login, password) |
|
67 | 67 | user = find_by_login(login) |
|
68 | 68 | if user |
|
69 | 69 | return user if user.authenticated?(password) |
|
70 | - if user.authenticated_by_cucas?(password) or user.authenticated_by_pop3?(password) | |
|
71 | - user.password = password | |
|
72 | - user.save | |
|
73 | - return user | |
|
74 | - end | |
|
75 | 70 | end |
|
76 | 71 | end |
|
77 | 72 | |
|
78 | 73 | def authenticated?(password) |
|
79 | 74 | if self.activated |
|
80 | 75 | hashed_password == User.encrypt(password,self.salt) |
|
81 | 76 | else |
|
82 | 77 | false |
|
83 | 78 | end |
|
84 | 79 | end |
|
85 | 80 | |
|
86 | - def authenticated_by_pop3?(password) | |
|
87 | - Net::POP3.enable_ssl | |
|
88 | - pop = Net::POP3.new('pops.it.chula.ac.th') | |
|
89 | - authen = true | |
|
90 | - begin | |
|
91 | - pop.start(login, password) | |
|
92 | - pop.finish | |
|
93 | - return true | |
|
94 | - rescue | |
|
95 | - return false | |
|
96 | - end | |
|
97 | - end | |
|
98 | - | |
|
99 | - def authenticated_by_cucas?(password) | |
|
100 | - url = URI.parse('https://www.cas.chula.ac.th/cas/api/?q=studentAuthenticate') | |
|
101 | - appid = '41508763e340d5858c00f8c1a0f5a2bb' | |
|
102 | - appsecret ='d9cbb5863091dbe186fded85722a1e31' | |
|
103 | - post_args = { | |
|
104 | - 'appid' => appid, | |
|
105 | - 'appsecret' => appsecret, | |
|
106 | - 'username' => login, | |
|
107 | - 'password' => password | |
|
108 | - } | |
|
109 | - | |
|
110 | - #simple call | |
|
111 | - begin | |
|
112 | - http = Net::HTTP.new('www.cas.chula.ac.th', 443) | |
|
113 | - http.use_ssl = true | |
|
114 | - result = [ ] | |
|
115 | - http.start do |http| | |
|
116 | - req = Net::HTTP::Post.new('/cas/api/?q=studentAuthenticate') | |
|
117 | - param = "appid=#{appid}&appsecret=#{appsecret}&username=#{login}&password=#{password}" | |
|
118 | - resp = http.request(req,param) | |
|
119 | - result = JSON.parse resp.body | |
|
120 | - end | |
|
121 | - return true if result["type"] == "beanStudent" | |
|
122 | - rescue | |
|
123 | - return false | |
|
124 | - end | |
|
125 | - return false | |
|
126 | - end | |
|
127 | - | |
|
128 | 81 | def admin? |
|
129 | 82 | self.roles.detect {|r| r.name == 'admin' } |
|
130 | 83 | end |
|
131 | 84 | |
|
132 | 85 | def email_for_editing |
|
133 | 86 | if self.email==nil |
|
134 | 87 | "(unknown)" |
|
135 | 88 | elsif self.email=='' |
|
136 | 89 | "(blank)" |
|
137 | 90 | else |
|
138 | 91 | self.email |
|
139 | 92 | end |
@@ -342,35 +295,35 | |||
|
342 | 295 | |
|
343 | 296 | def password_required? |
|
344 | 297 | self.hashed_password.blank? || !self.password.blank? |
|
345 | 298 | end |
|
346 | 299 | |
|
347 | 300 | def self.encrypt(string,salt) |
|
348 | 301 | Digest::SHA1.hexdigest(salt + string) |
|
349 | 302 | end |
|
350 | 303 | |
|
351 | 304 | def uniqueness_of_email_from_activated_users |
|
352 | 305 | user = User.activated_users.find_by_email(self.email) |
|
353 | 306 | if user and (user.login != self.login) |
|
354 |
- self.errors.add |
|
|
307 | + self.errors.add(:base,"Email has already been taken") | |
|
355 | 308 | end |
|
356 | 309 | end |
|
357 | 310 | |
|
358 | 311 | def enough_time_interval_between_same_email_registrations |
|
359 | 312 | return if !self.new_record? |
|
360 | 313 | return if self.activated |
|
361 | 314 | open_user = User.find_by_email(self.email, |
|
362 | 315 | :order => 'created_at DESC') |
|
363 | 316 | if open_user and open_user.created_at and |
|
364 | 317 | (open_user.created_at > Time.now.gmtime - 5.minutes) |
|
365 |
- self.errors.add |
|
|
318 | + self.errors.add(:base,"There are already unactivated registrations with this e-mail address (please wait for 5 minutes)") | |
|
366 | 319 | end |
|
367 | 320 | end |
|
368 | 321 | |
|
369 | 322 | def email_validation? |
|
370 | 323 | begin |
|
371 | 324 | return VALIDATE_USER_EMAILS |
|
372 | 325 | rescue |
|
373 | 326 | return false |
|
374 | 327 | end |
|
375 | 328 | end |
|
376 | 329 | end |
@@ -2,30 +2,33 | |||
|
2 | 2 | |
|
3 | 3 | .infobox |
|
4 | 4 | |
|
5 | 5 | - if @num_contests>1 |
|
6 | 6 | %b Multiple contests: |
|
7 | 7 | = "There are #{@num_contests} contests running." |
|
8 | 8 | - else |
|
9 | 9 | %b Single contest: |
|
10 | 10 | =raw "[#{link_to 'Add/remove contests', :controller => 'contests', :action => 'index'}]" |
|
11 | 11 | |
|
12 | 12 | .infobox |
|
13 | 13 | %b Web interface mode: |
|
14 | - - if (not GraderConfiguration.contest_mode?) and (not GraderConfiguration.indv_contest_mode?) | |
|
15 | - standard mode | |
|
14 | + - if GraderConfiguration.analysis_mode? | |
|
15 | + Analysis Mode | |
|
16 | + - elsif (not GraderConfiguration.contest_mode?) and (not GraderConfiguration.indv_contest_mode?) | |
|
17 | + Standard Mode | |
|
16 | 18 | - elsif GraderConfiguration.contest_mode? |
|
17 |
- |
|
|
19 | + Normal Contest Mode | |
|
18 | 20 | - else |
|
19 |
- |
|
|
21 | + Individual Contest Mode | |
|
20 | 22 | |
|
21 | 23 | %br/ |
|
22 | 24 | Change mode to: |
|
23 |
- =raw "[#{link_to ' |
|
|
24 |
- =raw "[#{link_to ' |
|
|
25 |
- =raw "[#{link_to ' |
|
|
25 | + =raw "[#{link_to 'Standard', :action => 'change_contest_mode', :id => 'standard'}]" | |
|
26 | + =raw "[#{link_to 'Contest', :action => 'change_contest_mode', :id => 'contest'}]" | |
|
27 | + =raw "[#{link_to 'Individual Contest', :action => 'change_contest_mode', :id => 'indv-contest'}]" | |
|
28 | + =raw "[#{link_to 'Analysis', :action => 'change_contest_mode', :id => 'analysis'}]" | |
|
26 | 29 | |
|
27 | 30 | - if GraderConfiguration.indv_contest_mode? |
|
28 | 31 | = render :partial => 'indv_contest_mode_index' |
|
29 | 32 | |
|
30 | 33 | %br/ |
|
31 | 34 |
@@ -16,25 +16,25 | |||
|
16 | 16 | = "Test submitted at: #{format_short_time(@test_request.submitted_at)}" |
|
17 | 17 | %br/ |
|
18 | 18 | = "Execution time: #{@test_request.running_time} s." |
|
19 | 19 | %br/ |
|
20 | 20 | = "Memory usage: #{@test_request.memory_usage}kb" |
|
21 | 21 | %br/ |
|
22 | 22 | %b= @test_request.exit_status |
|
23 | 23 | %br/ |
|
24 | 24 | |
|
25 | 25 | - if @test_request.compiler_message!=nil and @test_request.compiler_message!='' |
|
26 | 26 | %b Compiler Message |
|
27 | 27 | %div{:style => "border: 1px solid black; background: lightgrey"} |
|
28 | - = simple_format(truncate((@test_request.compiler_message or ''),200)) | |
|
28 | + = simple_format(truncate((@test_request.compiler_message or ''), :length => 200)) | |
|
29 | 29 | |
|
30 | 30 | %b Input (first 2kb) |
|
31 | 31 | %div{:style => "border: 1px solid black; background: lightgrey"} |
|
32 | 32 | - if @test_request.input_file_name!=nil |
|
33 | 33 | = simple_format(read_textfile(@test_request.input_file_name,2048)) |
|
34 | 34 | |
|
35 | 35 | %b Output (first 2kb) |
|
36 | 36 | %div{:style => "border: 1px solid black; background: lightgrey"} |
|
37 | 37 | - if @test_request.output_file_name!=nil |
|
38 | 38 | = simple_format(read_textfile(@test_request.output_file_name,2048)) |
|
39 | 39 | - else |
|
40 | 40 | (no output) |
@@ -1,14 +1,14 | |||
|
1 | 1 | |
|
2 | - <% if compiler_message==nil or compiler_message=='' %> | |
|
2 | + <% if compiler_message == nil or compiler_message.chomp == '' %> | |
|
3 | 3 | No message |
|
4 | 4 | <% else %> |
|
5 | 5 | <div><div><a href="#" onClick="n = this.parentNode.parentNode.lastChild; |
|
6 | 6 | if(n.style.display == 'none') { n.style.display = 'block'; } |
|
7 | 7 | else {n.style.display ='none'; } return false;"> |
|
8 | 8 | (click to see)</a> |
|
9 | 9 | </div> |
|
10 | 10 | <div style="display: none"> |
|
11 | 11 | <div class="compilermsgbody" style="border: thin solid grey; margin: 2px"> |
|
12 | 12 | <%=simple_format(compiler_message) %> |
|
13 | 13 | </div> |
|
14 | 14 | </div></div> |
@@ -1,6 +1,6 | |||
|
1 | 1 | %h2= "Compiler message for submission \##{@submission.number}, task: #{@submission.problem.name}" |
|
2 | 2 | %p |
|
3 | - - if @submission.compiler_message.chomp == '' | |
|
4 |
- |
|
|
3 | + - if @submission.compiler_message == nil or @submission.compiler_message.chomp == '' | |
|
4 | + No message | |
|
5 | 5 | - else |
|
6 | 6 | = simple_format(@submission.compiler_message) |
@@ -3,14 +3,14 | |||
|
3 | 3 | .announcementbox |
|
4 | 4 | %span{:class => 'title'} |
|
5 | 5 | =t 'main.confirm_contest_start.box_title' |
|
6 | 6 | .announcement |
|
7 | 7 | %center |
|
8 | 8 | =t 'main.confirm_contest_start.contest_list' |
|
9 | 9 | - @contests.each do |contest| |
|
10 | 10 | = contest.title |
|
11 | 11 | %br |
|
12 | 12 | |
|
13 | 13 | =t 'main.confirm_contest_start.timer_starts_after_click' |
|
14 | 14 | |
|
15 |
- = form_tag :action => 'confirm_contest_start' |
|
|
15 | + = form_tag :action => 'confirm_contest_start' do | |
|
16 | 16 | = submit_tag t('main.confirm_contest_start.start_button'), :confirm => t('main.confirm_contest_start.start_button_confirm') |
@@ -5,21 +5,21 | |||
|
5 | 5 | <%= text_field 'user', 'login' %></p> |
|
6 | 6 | |
|
7 | 7 | <p><label for="user_name">Full name</label><br/> |
|
8 | 8 | <%= text_field 'user', 'full_name' %></p> |
|
9 | 9 | |
|
10 | 10 | <p><label for="password">Password</label><br/> |
|
11 | 11 | <%= password_field 'user', 'password' %></p> |
|
12 | 12 | |
|
13 | 13 | <p><label for="password_confirmation">Password (confirm)</label><br/> |
|
14 | 14 | <%= password_field 'user', 'password_confirmation' %></p> |
|
15 | 15 | |
|
16 | 16 | <p><label for="user_email">E-mail</label><br/> |
|
17 |
- <%= |
|
|
17 | + <%= email_field 'user', 'email' %></p> | |
|
18 | 18 | |
|
19 | 19 | <p><label for="user_alias">Alias</label><br/> |
|
20 | 20 | <%= text_field 'user', 'alias' %></p> |
|
21 | 21 | |
|
22 | 22 | <p><label for="user_remark">Remark</label><br/> |
|
23 | 23 | <%= text_field 'user', 'remark' %></p> |
|
24 | 24 | <!--[eoform:user]--> |
|
25 | 25 |
@@ -7,25 +7,25 | |||
|
7 | 7 | <tr> |
|
8 | 8 | <td><label for="user_login">Login</label></td> |
|
9 | 9 | <td><label for="user_full_name">Full name</label></td> |
|
10 | 10 | <td><label for="user_password">Password</label></td> |
|
11 | 11 | <td><label for="user_password_confirmation">Confirm</label></td> |
|
12 | 12 | <td><label for="user_email">Email</label></td> |
|
13 | 13 | </tr> |
|
14 | 14 | <tr> |
|
15 | 15 | <td><%= text_field 'user', 'login', :size => 10 %></td> |
|
16 | 16 | <td><%= text_field 'user', 'full_name', :size => 30 %></td> |
|
17 | 17 | <td><%= password_field 'user', 'password', :size => 10 %></td> |
|
18 | 18 | <td><%= password_field 'user', 'password_confirmation', :size => 10 %></td> |
|
19 |
- <td><%= |
|
|
19 | + <td><%= email_field 'user', 'email', :size => 15 %></td> | |
|
20 | 20 | <td><%= submit_tag "Create" %></td> |
|
21 | 21 | </tr> |
|
22 | 22 | </table> |
|
23 | 23 | <% end %> |
|
24 | 24 | <br/> |
|
25 | 25 | <b>Import from site management</b> |
|
26 | 26 | <%= form_tag({:action => 'import'}, :multipart => true) do %> |
|
27 | 27 | File: <%= file_field_tag 'file' %> <%= submit_tag 'Import' %> |
|
28 | 28 | <% end %> |
|
29 | 29 | <br/> |
|
30 | 30 | <b>What else: </b> |
|
31 | 31 | <%= link_to '[New user]', :action => 'new' %> |
@@ -2,17 +2,18 | |||
|
2 | 2 | %h1 |
|
3 | 3 | = "#{GraderConfiguration['contest.name']}: #{t 'registration.password_retrieval.header'}" |
|
4 | 4 | |
|
5 | 5 | - if flash[:notice] |
|
6 | 6 | %hr/ |
|
7 | 7 | %b= flash[:notice] |
|
8 | 8 | %hr/ |
|
9 | 9 | |
|
10 | 10 | %br/ |
|
11 | 11 | |
|
12 | 12 | = form_tag :action => 'retrieve_password' do |
|
13 | 13 | =t 'registration.password_retrieval.instructions' |
|
14 | - = text_field 'email', nil, :size => 20 | |
|
14 | + %br/ | |
|
15 | + = email_field 'email', nil, :size => 20 | |
|
15 | 16 | %br/ |
|
16 | 17 | = submit_tag(t 'registration.password_retrieval.button_label') |
|
17 | 18 | |
|
18 | 19 | = link_to "#{t 'go_back_to'}#{t 'home_page'}", :controller => 'main', :action => 'index' |
@@ -16,24 +16,24 | |||
|
16 | 16 | %tr |
|
17 | 17 | %td |
|
18 | 18 | %td |
|
19 | 19 | %small |
|
20 | 20 | =t 'registration.login_guide' |
|
21 | 21 | %tr |
|
22 | 22 | %td{:align => "right"} |
|
23 | 23 | = "#{t 'full_name_label'}:" |
|
24 | 24 | %td= f.text_field :full_name |
|
25 | 25 | %tr |
|
26 | 26 | %td{:align => "right"} |
|
27 | 27 | = "#{t 'email_label'}:" |
|
28 |
- %td= f. |
|
|
28 | + %td= f.email_field :email | |
|
29 | 29 | %tr |
|
30 | 30 | %td |
|
31 | 31 | %td |
|
32 | 32 | %small |
|
33 |
- =t |
|
|
33 | + =t('registration.email_guide').html_safe | |
|
34 | 34 | %tr |
|
35 | 35 | %td/ |
|
36 | 36 | %td |
|
37 | 37 | = submit_tag((t 'registration.register'), :name => 'commit') |
|
38 | 38 | = submit_tag((t 'cancel'), :name => 'cancel') |
|
39 | 39 |
@@ -25,13 +25,16 | |||
|
25 | 25 | # Raise exception on mass assignment protection for Active Record models |
|
26 | 26 | config.active_record.mass_assignment_sanitizer = :strict |
|
27 | 27 | |
|
28 | 28 | # Log the query plan for queries taking more than this (works |
|
29 | 29 | # with SQLite, MySQL, and PostgreSQL) |
|
30 | 30 | config.active_record.auto_explain_threshold_in_seconds = 0.5 |
|
31 | 31 | |
|
32 | 32 | # Do not compress assets |
|
33 | 33 | config.assets.compress = false |
|
34 | 34 | |
|
35 | 35 | # Expands the lines which load the assets |
|
36 | 36 | config.assets.debug = true |
|
37 | + | |
|
38 | + # Prevents assets from rendering twice | |
|
39 | + config.serve_static_assets = false | |
|
37 | 40 | end |
@@ -13,18 +13,29 | |||
|
13 | 13 | -------------------------- |
|
14 | 14 | " |
|
15 | 15 | return true |
|
16 | 16 | end |
|
17 | 17 | |
|
18 | 18 | mail = Mail.new do |
|
19 | 19 | from mail_from |
|
20 | 20 | to mail_to |
|
21 | 21 | subject mail_subject |
|
22 | 22 | body mail_body |
|
23 | 23 | end |
|
24 | 24 | |
|
25 | - mail.delivery_settings = { :address => smtp_server } | |
|
25 | + mail_option = { | |
|
26 | + :address => smtp_server, | |
|
27 | + # :domain => nil, | |
|
28 | + # :port => 25, | |
|
29 | + # :user_name => nil, | |
|
30 | + # :password => nil, | |
|
31 | + # :authentication=>'plain', | |
|
32 | + # :enable_starttls_auto => true | |
|
33 | + } | |
|
34 | + | |
|
35 | + mail.delivery_method :smtp, mail_option | |
|
36 | + | |
|
26 | 37 | mail.deliver |
|
27 | 38 | end |
|
28 | 39 | |
|
29 | 40 | end |
|
30 | 41 |
You need to be logged in to leave comments.
Login now