Description:
login test
Commit status:
[Not Reviewed]
References:
Diff options:
Comments:
0 Commit comments
0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
r626:f38d39d4f555 - - 7 files changed: 35 inserted, 11 deleted
@@ -25,54 +25,54 | |||||
|
25 | # gem 'prototype-rails' |
|
25 | # gem 'prototype-rails' |
|
26 |
|
26 | ||
|
27 | # To use ActiveModel has_secure_password |
|
27 | # To use ActiveModel has_secure_password |
|
28 | # gem 'bcrypt-ruby', '~> 3.0.0' |
|
28 | # gem 'bcrypt-ruby', '~> 3.0.0' |
|
29 |
|
29 | ||
|
30 | # To use Jbuilder templates for JSON |
|
30 | # To use Jbuilder templates for JSON |
|
31 | # gem 'jbuilder' |
|
31 | # gem 'jbuilder' |
|
32 |
|
32 | ||
|
33 | # Use unicorn as the app server |
|
33 | # Use unicorn as the app server |
|
34 | # gem 'unicorn' |
|
34 | # gem 'unicorn' |
|
35 |
|
35 | ||
|
36 | # Deploy with Capistrano |
|
36 | # Deploy with Capistrano |
|
37 | # gem 'capistrano' |
|
37 | # gem 'capistrano' |
|
38 |
|
38 | ||
|
39 | # To use debugger |
|
39 | # To use debugger |
|
40 | # gem 'debugger' |
|
40 | # gem 'debugger' |
|
41 | # |
|
41 | # |
|
42 |
|
42 | ||
|
43 | #in-place editor |
|
43 | #in-place editor |
|
44 | gem 'best_in_place', '~> 3.0.1' |
|
44 | gem 'best_in_place', '~> 3.0.1' |
|
45 |
|
45 | ||
|
46 | # jquery addition |
|
46 | # jquery addition |
|
47 | gem 'jquery-rails' |
|
47 | gem 'jquery-rails' |
|
48 | gem 'jquery-ui-rails' |
|
48 | gem 'jquery-ui-rails' |
|
49 | gem 'jquery-timepicker-addon-rails' |
|
49 | gem 'jquery-timepicker-addon-rails' |
|
50 | gem 'jquery-tablesorter' |
|
50 | gem 'jquery-tablesorter' |
|
51 | gem 'jquery-countdown-rails' |
|
51 | gem 'jquery-countdown-rails' |
|
52 |
|
52 | ||
|
53 | #syntax highlighter |
|
53 | #syntax highlighter |
|
54 | gem 'rouge' |
|
54 | gem 'rouge' |
|
55 |
|
55 | ||
|
56 | #add bootstrap |
|
56 | #add bootstrap |
|
57 | gem 'bootstrap-sass', '~> 3.2.0' |
|
57 | gem 'bootstrap-sass', '~> 3.2.0' |
|
58 | gem 'bootstrap-switch-rails' |
|
58 | gem 'bootstrap-switch-rails' |
|
59 | gem 'bootstrap-toggle-rails' |
|
59 | gem 'bootstrap-toggle-rails' |
|
60 | gem 'autoprefixer-rails' |
|
60 | gem 'autoprefixer-rails' |
|
61 |
|
61 | ||
|
62 | #bootstrap sortable |
|
62 | #bootstrap sortable |
|
63 | gem 'momentjs-rails' |
|
63 | gem 'momentjs-rails' |
|
64 | gem 'rails_bootstrap_sortable' |
|
64 | gem 'rails_bootstrap_sortable' |
|
65 |
|
65 | ||
|
66 | #ace editor |
|
66 | #ace editor |
|
67 | gem 'ace-rails-ap' |
|
67 | gem 'ace-rails-ap' |
|
68 |
|
68 | ||
|
69 | gem 'haml' |
|
69 | gem 'haml' |
|
70 | gem 'haml-rails' |
|
70 | gem 'haml-rails' |
|
71 | gem 'mail' |
|
71 | gem 'mail' |
|
72 | gem 'rdiscount' |
|
72 | gem 'rdiscount' |
|
73 | - gem 'test-unit' |
|
73 | + #gem 'test-unit' |
|
74 | gem 'will_paginate', '~> 3.0.7' |
|
74 | gem 'will_paginate', '~> 3.0.7' |
|
75 | gem 'dynamic_form' |
|
75 | gem 'dynamic_form' |
|
76 | gem 'in_place_editing' |
|
76 | gem 'in_place_editing' |
|
77 | gem 'verification', :git => 'https://github.com/sikachu/verification.git' |
|
77 | gem 'verification', :git => 'https://github.com/sikachu/verification.git' |
|
78 |
|
78 |
@@ -72,150 +72,146 | |||||
|
72 | concurrent-ruby (1.0.4) |
|
72 | concurrent-ruby (1.0.4) |
|
73 | dynamic_form (1.1.4) |
|
73 | dynamic_form (1.1.4) |
|
74 | erubis (2.7.0) |
|
74 | erubis (2.7.0) |
|
75 | execjs (2.7.0) |
|
75 | execjs (2.7.0) |
|
76 | globalid (0.3.7) |
|
76 | globalid (0.3.7) |
|
77 | activesupport (>= 4.1.0) |
|
77 | activesupport (>= 4.1.0) |
|
78 | haml (4.0.7) |
|
78 | haml (4.0.7) |
|
79 | tilt |
|
79 | tilt |
|
80 | haml-rails (0.9.0) |
|
80 | haml-rails (0.9.0) |
|
81 | actionpack (>= 4.0.1) |
|
81 | actionpack (>= 4.0.1) |
|
82 | activesupport (>= 4.0.1) |
|
82 | activesupport (>= 4.0.1) |
|
83 | haml (>= 4.0.6, < 5.0) |
|
83 | haml (>= 4.0.6, < 5.0) |
|
84 | html2haml (>= 1.0.1) |
|
84 | html2haml (>= 1.0.1) |
|
85 | railties (>= 4.0.1) |
|
85 | railties (>= 4.0.1) |
|
86 | html2haml (2.0.0) |
|
86 | html2haml (2.0.0) |
|
87 | erubis (~> 2.7.0) |
|
87 | erubis (~> 2.7.0) |
|
88 | haml (~> 4.0.0) |
|
88 | haml (~> 4.0.0) |
|
89 | nokogiri (~> 1.6.0) |
|
89 | nokogiri (~> 1.6.0) |
|
90 | ruby_parser (~> 3.5) |
|
90 | ruby_parser (~> 3.5) |
|
91 | i18n (0.7.0) |
|
91 | i18n (0.7.0) |
|
92 | in_place_editing (1.2.0) |
|
92 | in_place_editing (1.2.0) |
|
93 | jquery-countdown-rails (2.0.2) |
|
93 | jquery-countdown-rails (2.0.2) |
|
94 | jquery-rails (4.2.1) |
|
94 | jquery-rails (4.2.1) |
|
95 | rails-dom-testing (>= 1, < 3) |
|
95 | rails-dom-testing (>= 1, < 3) |
|
96 | railties (>= 4.2.0) |
|
96 | railties (>= 4.2.0) |
|
97 | thor (>= 0.14, < 2.0) |
|
97 | thor (>= 0.14, < 2.0) |
|
98 | jquery-tablesorter (1.23.3) |
|
98 | jquery-tablesorter (1.23.3) |
|
99 | railties (>= 3.2, < 6) |
|
99 | railties (>= 3.2, < 6) |
|
100 | jquery-timepicker-addon-rails (1.4.1) |
|
100 | jquery-timepicker-addon-rails (1.4.1) |
|
101 | railties (>= 3.1) |
|
101 | railties (>= 3.1) |
|
102 | jquery-ui-rails (6.0.1) |
|
102 | jquery-ui-rails (6.0.1) |
|
103 | railties (>= 3.2.16) |
|
103 | railties (>= 3.2.16) |
|
104 | json (1.8.3) |
|
104 | json (1.8.3) |
|
105 | loofah (2.0.3) |
|
105 | loofah (2.0.3) |
|
106 | nokogiri (>= 1.5.9) |
|
106 | nokogiri (>= 1.5.9) |
|
107 | mail (2.6.4) |
|
107 | mail (2.6.4) |
|
108 | mime-types (>= 1.16, < 4) |
|
108 | mime-types (>= 1.16, < 4) |
|
109 | mime-types (3.1) |
|
109 | mime-types (3.1) |
|
110 | mime-types-data (~> 3.2015) |
|
110 | mime-types-data (~> 3.2015) |
|
111 | mime-types-data (3.2016.0521) |
|
111 | mime-types-data (3.2016.0521) |
|
112 | mini_portile2 (2.1.0) |
|
112 | mini_portile2 (2.1.0) |
|
113 | minitest (5.10.1) |
|
113 | minitest (5.10.1) |
|
114 | momentjs-rails (2.15.1) |
|
114 | momentjs-rails (2.15.1) |
|
115 | railties (>= 3.1) |
|
115 | railties (>= 3.1) |
|
116 | multi_json (1.12.1) |
|
116 | multi_json (1.12.1) |
|
117 | mysql2 (0.4.5) |
|
117 | mysql2 (0.4.5) |
|
118 | nokogiri (1.6.8.1) |
|
118 | nokogiri (1.6.8.1) |
|
119 | mini_portile2 (~> 2.1.0) |
|
119 | mini_portile2 (~> 2.1.0) |
|
120 | - power_assert (0.4.1) |
|
||
|
121 | rack (1.6.5) |
|
120 | rack (1.6.5) |
|
122 | rack-test (0.6.3) |
|
121 | rack-test (0.6.3) |
|
123 | rack (>= 1.0) |
|
122 | rack (>= 1.0) |
|
124 | rails (4.2.7.1) |
|
123 | rails (4.2.7.1) |
|
125 | actionmailer (= 4.2.7.1) |
|
124 | actionmailer (= 4.2.7.1) |
|
126 | actionpack (= 4.2.7.1) |
|
125 | actionpack (= 4.2.7.1) |
|
127 | actionview (= 4.2.7.1) |
|
126 | actionview (= 4.2.7.1) |
|
128 | activejob (= 4.2.7.1) |
|
127 | activejob (= 4.2.7.1) |
|
129 | activemodel (= 4.2.7.1) |
|
128 | activemodel (= 4.2.7.1) |
|
130 | activerecord (= 4.2.7.1) |
|
129 | activerecord (= 4.2.7.1) |
|
131 | activesupport (= 4.2.7.1) |
|
130 | activesupport (= 4.2.7.1) |
|
132 | bundler (>= 1.3.0, < 2.0) |
|
131 | bundler (>= 1.3.0, < 2.0) |
|
133 | railties (= 4.2.7.1) |
|
132 | railties (= 4.2.7.1) |
|
134 | sprockets-rails |
|
133 | sprockets-rails |
|
135 | rails-deprecated_sanitizer (1.0.3) |
|
134 | rails-deprecated_sanitizer (1.0.3) |
|
136 | activesupport (>= 4.2.0.alpha) |
|
135 | activesupport (>= 4.2.0.alpha) |
|
137 | rails-dom-testing (1.0.8) |
|
136 | rails-dom-testing (1.0.8) |
|
138 | activesupport (>= 4.2.0.beta, < 5.0) |
|
137 | activesupport (>= 4.2.0.beta, < 5.0) |
|
139 | nokogiri (~> 1.6) |
|
138 | nokogiri (~> 1.6) |
|
140 | rails-deprecated_sanitizer (>= 1.0.1) |
|
139 | rails-deprecated_sanitizer (>= 1.0.1) |
|
141 | rails-html-sanitizer (1.0.3) |
|
140 | rails-html-sanitizer (1.0.3) |
|
142 | loofah (~> 2.0) |
|
141 | loofah (~> 2.0) |
|
143 | rails_bootstrap_sortable (2.0.1) |
|
142 | rails_bootstrap_sortable (2.0.1) |
|
144 | momentjs-rails (>= 2.8.3) |
|
143 | momentjs-rails (>= 2.8.3) |
|
145 | railties (4.2.7.1) |
|
144 | railties (4.2.7.1) |
|
146 | actionpack (= 4.2.7.1) |
|
145 | actionpack (= 4.2.7.1) |
|
147 | activesupport (= 4.2.7.1) |
|
146 | activesupport (= 4.2.7.1) |
|
148 | rake (>= 0.8.7) |
|
147 | rake (>= 0.8.7) |
|
149 | thor (>= 0.18.1, < 2.0) |
|
148 | thor (>= 0.18.1, < 2.0) |
|
150 | rake (12.0.0) |
|
149 | rake (12.0.0) |
|
151 | rdiscount (2.2.0.1) |
|
150 | rdiscount (2.2.0.1) |
|
152 | rouge (2.0.7) |
|
151 | rouge (2.0.7) |
|
153 | ruby_parser (3.8.3) |
|
152 | ruby_parser (3.8.3) |
|
154 | sexp_processor (~> 4.1) |
|
153 | sexp_processor (~> 4.1) |
|
155 | sass (3.4.23) |
|
154 | sass (3.4.23) |
|
156 | sass-rails (5.0.6) |
|
155 | sass-rails (5.0.6) |
|
157 | railties (>= 4.0.0, < 6) |
|
156 | railties (>= 4.0.0, < 6) |
|
158 | sass (~> 3.1) |
|
157 | sass (~> 3.1) |
|
159 | sprockets (>= 2.8, < 4.0) |
|
158 | sprockets (>= 2.8, < 4.0) |
|
160 | sprockets-rails (>= 2.0, < 4.0) |
|
159 | sprockets-rails (>= 2.0, < 4.0) |
|
161 | tilt (>= 1.1, < 3) |
|
160 | tilt (>= 1.1, < 3) |
|
162 | select2-rails (4.0.3) |
|
161 | select2-rails (4.0.3) |
|
163 | thor (~> 0.14) |
|
162 | thor (~> 0.14) |
|
164 | sexp_processor (4.7.0) |
|
163 | sexp_processor (4.7.0) |
|
165 | sprockets (3.7.1) |
|
164 | sprockets (3.7.1) |
|
166 | concurrent-ruby (~> 1.0) |
|
165 | concurrent-ruby (~> 1.0) |
|
167 | rack (> 1, < 3) |
|
166 | rack (> 1, < 3) |
|
168 | sprockets-rails (3.2.0) |
|
167 | sprockets-rails (3.2.0) |
|
169 | actionpack (>= 4.0) |
|
168 | actionpack (>= 4.0) |
|
170 | activesupport (>= 4.0) |
|
169 | activesupport (>= 4.0) |
|
171 | sprockets (>= 3.0.0) |
|
170 | sprockets (>= 3.0.0) |
|
172 | sqlite3 (1.3.12) |
|
171 | sqlite3 (1.3.12) |
|
173 | - test-unit (3.2.3) |
|
||
|
174 | - power_assert |
|
||
|
175 | thor (0.19.4) |
|
172 | thor (0.19.4) |
|
176 | thread_safe (0.3.5) |
|
173 | thread_safe (0.3.5) |
|
177 | tilt (2.0.5) |
|
174 | tilt (2.0.5) |
|
178 | tzinfo (1.2.2) |
|
175 | tzinfo (1.2.2) |
|
179 | thread_safe (~> 0.1) |
|
176 | thread_safe (~> 0.1) |
|
180 | uglifier (3.0.4) |
|
177 | uglifier (3.0.4) |
|
181 | execjs (>= 0.3.0, < 3) |
|
178 | execjs (>= 0.3.0, < 3) |
|
182 | will_paginate (3.0.12) |
|
179 | will_paginate (3.0.12) |
|
183 |
|
180 | ||
|
184 | PLATFORMS |
|
181 | PLATFORMS |
|
185 | ruby |
|
182 | ruby |
|
186 |
|
183 | ||
|
187 | DEPENDENCIES |
|
184 | DEPENDENCIES |
|
188 | ace-rails-ap |
|
185 | ace-rails-ap |
|
189 | activerecord-session_store |
|
186 | activerecord-session_store |
|
190 | autoprefixer-rails |
|
187 | autoprefixer-rails |
|
191 | best_in_place (~> 3.0.1) |
|
188 | best_in_place (~> 3.0.1) |
|
192 | bootstrap-sass (~> 3.2.0) |
|
189 | bootstrap-sass (~> 3.2.0) |
|
193 | bootstrap-switch-rails |
|
190 | bootstrap-switch-rails |
|
194 | bootstrap-toggle-rails |
|
191 | bootstrap-toggle-rails |
|
195 | coffee-rails |
|
192 | coffee-rails |
|
196 | dynamic_form |
|
193 | dynamic_form |
|
197 | haml |
|
194 | haml |
|
198 | haml-rails |
|
195 | haml-rails |
|
199 | in_place_editing |
|
196 | in_place_editing |
|
200 | jquery-countdown-rails |
|
197 | jquery-countdown-rails |
|
201 | jquery-rails |
|
198 | jquery-rails |
|
202 | jquery-tablesorter |
|
199 | jquery-tablesorter |
|
203 | jquery-timepicker-addon-rails |
|
200 | jquery-timepicker-addon-rails |
|
204 | jquery-ui-rails |
|
201 | jquery-ui-rails |
|
205 |
|
202 | ||
|
206 | momentjs-rails |
|
203 | momentjs-rails |
|
207 | mysql2 |
|
204 | mysql2 |
|
208 | rails (~> 4.2.0) |
|
205 | rails (~> 4.2.0) |
|
209 | rails_bootstrap_sortable |
|
206 | rails_bootstrap_sortable |
|
210 | rdiscount |
|
207 | rdiscount |
|
211 | rouge |
|
208 | rouge |
|
212 | sass-rails |
|
209 | sass-rails |
|
213 | select2-rails |
|
210 | select2-rails |
|
214 | sqlite3 |
|
211 | sqlite3 |
|
215 | - test-unit |
|
||
|
216 | uglifier |
|
212 | uglifier |
|
217 | verification! |
|
213 | verification! |
|
218 | will_paginate (~> 3.0.7) |
|
214 | will_paginate (~> 3.0.7) |
|
219 |
|
215 | ||
|
220 | BUNDLED WITH |
|
216 | BUNDLED WITH |
|
221 | 1.13.6 |
|
217 | 1.13.6 |
@@ -1,61 +1,62 | |||||
|
1 | require 'yaml' |
|
1 | require 'yaml' |
|
2 |
|
2 | ||
|
3 | # |
|
3 | # |
|
4 | # This class also contains various login of the system. |
|
4 | # This class also contains various login of the system. |
|
5 | # |
|
5 | # |
|
6 | class GraderConfiguration < ActiveRecord::Base |
|
6 | class GraderConfiguration < ActiveRecord::Base |
|
7 |
|
7 | ||
|
8 | SYSTEM_MODE_CONF_KEY = 'system.mode' |
|
8 | SYSTEM_MODE_CONF_KEY = 'system.mode' |
|
9 | TEST_REQUEST_EARLY_TIMEOUT_KEY = 'contest.test_request.early_timeout' |
|
9 | TEST_REQUEST_EARLY_TIMEOUT_KEY = 'contest.test_request.early_timeout' |
|
10 | MULTICONTESTS_KEY = 'system.multicontests' |
|
10 | MULTICONTESTS_KEY = 'system.multicontests' |
|
11 | CONTEST_TIME_LIMIT_KEY = 'contest.time_limit' |
|
11 | CONTEST_TIME_LIMIT_KEY = 'contest.time_limit' |
|
12 | MULTIPLE_IP_LOGIN_KEY = 'right.multiple_ip_login' |
|
12 | MULTIPLE_IP_LOGIN_KEY = 'right.multiple_ip_login' |
|
13 | VIEW_TESTCASE = 'right.view_testcase' |
|
13 | VIEW_TESTCASE = 'right.view_testcase' |
|
|
14 | + SINGLE_USER_KEY = 'system.single_user' | ||
|
14 |
|
15 | ||
|
15 | cattr_accessor :config_cache |
|
16 | cattr_accessor :config_cache |
|
16 | cattr_accessor :task_grading_info_cache |
|
17 | cattr_accessor :task_grading_info_cache |
|
17 | cattr_accessor :contest_time_str |
|
18 | cattr_accessor :contest_time_str |
|
18 | cattr_accessor :contest_time |
|
19 | cattr_accessor :contest_time |
|
19 |
|
20 | ||
|
20 | GraderConfiguration.config_cache = nil |
|
21 | GraderConfiguration.config_cache = nil |
|
21 | GraderConfiguration.task_grading_info_cache = nil |
|
22 | GraderConfiguration.task_grading_info_cache = nil |
|
22 |
|
23 | ||
|
23 | def self.config_cached? |
|
24 | def self.config_cached? |
|
24 | (defined? CONFIGURATION_CACHE_ENABLED) and (CONFIGURATION_CACHE_ENABLED) |
|
25 | (defined? CONFIGURATION_CACHE_ENABLED) and (CONFIGURATION_CACHE_ENABLED) |
|
25 | end |
|
26 | end |
|
26 |
|
27 | ||
|
27 | def self.get(key) |
|
28 | def self.get(key) |
|
28 | if GraderConfiguration.config_cached? |
|
29 | if GraderConfiguration.config_cached? |
|
29 | if GraderConfiguration.config_cache == nil |
|
30 | if GraderConfiguration.config_cache == nil |
|
30 | self.read_config |
|
31 | self.read_config |
|
31 | end |
|
32 | end |
|
32 | return GraderConfiguration.config_cache[key] |
|
33 | return GraderConfiguration.config_cache[key] |
|
33 | else |
|
34 | else |
|
34 | return GraderConfiguration.read_one_key(key) |
|
35 | return GraderConfiguration.read_one_key(key) |
|
35 | end |
|
36 | end |
|
36 | end |
|
37 | end |
|
37 |
|
38 | ||
|
38 | def self.[](key) |
|
39 | def self.[](key) |
|
39 | self.get(key) |
|
40 | self.get(key) |
|
40 | end |
|
41 | end |
|
41 |
|
42 | ||
|
42 | def self.reload |
|
43 | def self.reload |
|
43 | self.read_config |
|
44 | self.read_config |
|
44 | end |
|
45 | end |
|
45 |
|
46 | ||
|
46 | def self.clear |
|
47 | def self.clear |
|
47 | GraderConfiguration.config_cache = nil |
|
48 | GraderConfiguration.config_cache = nil |
|
48 | end |
|
49 | end |
|
49 |
|
50 | ||
|
50 | # |
|
51 | # |
|
51 | # View decision |
|
52 | # View decision |
|
52 | # |
|
53 | # |
|
53 | def self.show_submitbox_to?(user) |
|
54 | def self.show_submitbox_to?(user) |
|
54 | mode = get(SYSTEM_MODE_CONF_KEY) |
|
55 | mode = get(SYSTEM_MODE_CONF_KEY) |
|
55 | return false if mode=='analysis' |
|
56 | return false if mode=='analysis' |
|
56 | if (mode=='contest') |
|
57 | if (mode=='contest') |
|
57 | return false if (user.site!=nil) and |
|
58 | return false if (user.site!=nil) and |
|
58 | ((user.site.started!=true) or (user.site.finished?)) |
|
59 | ((user.site.started!=true) or (user.site.finished?)) |
|
59 | end |
|
60 | end |
|
60 | return true |
|
61 | return true |
|
61 | end |
|
62 | end |
@@ -1,39 +1,39 | |||||
|
1 | %b= GraderConfiguration['ui.front.welcome_message'] |
|
1 | %b= GraderConfiguration['ui.front.welcome_message'] |
|
2 | %br/ |
|
2 | %br/ |
|
3 |
|
3 | ||
|
4 | - if !@hidelogin |
|
4 | - if !@hidelogin |
|
5 | =t 'login.message' |
|
5 | =t 'login.message' |
|
6 | %br/ |
|
6 | %br/ |
|
7 | %br/ |
|
7 | %br/ |
|
8 |
|
8 | ||
|
9 | - if flash[:notice] |
|
9 | - if flash[:notice] |
|
10 | %hr/ |
|
10 | %hr/ |
|
11 | %b= flash[:notice] |
|
11 | %b= flash[:notice] |
|
12 | %hr/ |
|
12 | %hr/ |
|
13 |
|
13 | ||
|
14 | %div{ :style => "border: solid 1px gray; padding: 4px; background: #eeeeff;"} |
|
14 | %div{ :style => "border: solid 1px gray; padding: 4px; background: #eeeeff;"} |
|
15 | - = form_tag :controller => 'login', :action => 'login' do |
|
15 | + = form_tag login_login_path do |
|
16 | %table |
|
16 | %table |
|
17 | %tr |
|
17 | %tr |
|
18 | %td{:align => "right"} |
|
18 | %td{:align => "right"} |
|
19 | ="#{t 'login_label'}:" |
|
19 | ="#{t 'login_label'}:" |
|
20 | %td= text_field_tag 'login' |
|
20 | %td= text_field_tag 'login' |
|
21 | %tr |
|
21 | %tr |
|
22 | %td{:align => "right"} |
|
22 | %td{:align => "right"} |
|
23 | ="#{t 'password_label'}:" |
|
23 | ="#{t 'password_label'}:" |
|
24 | %td= password_field_tag |
|
24 | %td= password_field_tag |
|
25 | - unless GraderConfiguration['right.bypass_agreement'] |
|
25 | - unless GraderConfiguration['right.bypass_agreement'] |
|
26 | %tr |
|
26 | %tr |
|
27 | %td{:align => "right"}= check_box_tag 'accept_agree' |
|
27 | %td{:align => "right"}= check_box_tag 'accept_agree' |
|
28 | %td ΰΈ’ΰΈΰΈ‘ΰΈ£ΰΈ±ΰΈΰΈΰΉΰΈΰΈΰΈΰΈ₯ΰΈΰΈΰΈ²ΰΈ£ΰΉΰΈΰΉΰΈΰΈ²ΰΈ |
|
28 | %td ΰΈ’ΰΈΰΈ‘ΰΈ£ΰΈ±ΰΈΰΈΰΉΰΈΰΈΰΈΰΈ₯ΰΈΰΈΰΈ²ΰΈ£ΰΉΰΈΰΉΰΈΰΈ²ΰΈ |
|
29 |
|
29 | ||
|
30 | = submit_tag t('login.login_submit') |
|
30 | = submit_tag t('login.login_submit') |
|
31 | %br/ |
|
31 | %br/ |
|
32 |
|
32 | ||
|
33 | - if GraderConfiguration['system.online_registration'] |
|
33 | - if GraderConfiguration['system.online_registration'] |
|
34 | =t 'login.participation' |
|
34 | =t 'login.participation' |
|
35 | %b |
|
35 | %b |
|
36 | = "#{t 'login.please'} " |
|
36 | = "#{t 'login.please'} " |
|
37 | = link_to "#{t 'login.register'}", :controller => :users, :action => :new |
|
37 | = link_to "#{t 'login.register'}", :controller => :users, :action => :new |
|
38 | %br/ |
|
38 | %br/ |
|
39 | = link_to "#{t 'login.forget_password'}", :controller => :users, :action => :forget |
|
39 | = link_to "#{t 'login.forget_password'}", :controller => :users, :action => :forget |
@@ -1,53 +1,56 | |||||
|
1 | CafeGrader::Application.routes.draw do |
|
1 | CafeGrader::Application.routes.draw do |
|
2 | get "sources/direct_edit" |
|
2 | get "sources/direct_edit" |
|
3 |
|
3 | ||
|
4 | root :to => 'main#login' |
|
4 | root :to => 'main#login' |
|
5 |
|
5 | ||
|
|
6 | + #logins | ||
|
|
7 | + get 'login/login', to: 'login#login' | ||
|
|
8 | + | ||
|
6 | resources :contests |
|
9 | resources :contests |
|
7 |
|
10 | ||
|
8 | resources :sites |
|
11 | resources :sites |
|
9 |
|
12 | ||
|
10 | resources :announcements do |
|
13 | resources :announcements do |
|
11 | member do |
|
14 | member do |
|
12 | get 'toggle','toggle_front' |
|
15 | get 'toggle','toggle_front' |
|
13 | end |
|
16 | end |
|
14 | end |
|
17 | end |
|
15 |
|
18 | ||
|
16 | resources :problems do |
|
19 | resources :problems do |
|
17 | member do |
|
20 | member do |
|
18 | get 'toggle' |
|
21 | get 'toggle' |
|
19 | get 'toggle_test' |
|
22 | get 'toggle_test' |
|
20 | get 'stat' |
|
23 | get 'stat' |
|
21 | get 'show_testcase' |
|
24 | get 'show_testcase' |
|
22 | end |
|
25 | end |
|
23 | collection do |
|
26 | collection do |
|
24 | get 'turn_all_off' |
|
27 | get 'turn_all_off' |
|
25 | get 'turn_all_on' |
|
28 | get 'turn_all_on' |
|
26 | get 'import' |
|
29 | get 'import' |
|
27 | get 'manage' |
|
30 | get 'manage' |
|
28 | end |
|
31 | end |
|
29 |
|
32 | ||
|
30 | resources :testcases, only: [] do |
|
33 | resources :testcases, only: [] do |
|
31 | member do |
|
34 | member do |
|
32 | get 'download_input' |
|
35 | get 'download_input' |
|
33 | get 'download_sol' |
|
36 | get 'download_sol' |
|
34 | end |
|
37 | end |
|
35 | end |
|
38 | end |
|
36 | end |
|
39 | end |
|
37 |
|
40 | ||
|
38 | resources :grader_configuration, controller: 'configurations' |
|
41 | resources :grader_configuration, controller: 'configurations' |
|
39 |
|
42 | ||
|
40 | resources :users do |
|
43 | resources :users do |
|
41 | member do |
|
44 | member do |
|
42 | get 'toggle_activate', 'toggle_enable' |
|
45 | get 'toggle_activate', 'toggle_enable' |
|
43 | get 'stat' |
|
46 | get 'stat' |
|
44 | end |
|
47 | end |
|
45 | end |
|
48 | end |
|
46 |
|
49 | ||
|
47 | resources :submissions do |
|
50 | resources :submissions do |
|
48 | member do |
|
51 | member do |
|
49 | get 'download' |
|
52 | get 'download' |
|
50 | get 'compiler_msg' |
|
53 | get 'compiler_msg' |
|
51 | end |
|
54 | end |
|
52 | collection do |
|
55 | collection do |
|
53 | get 'prob/:problem_id', to: 'submissions#index', as: 'problem' |
|
56 | get 'prob/:problem_id', to: 'submissions#index', as: 'problem' |
@@ -1,38 +1,38 | |||||
|
1 | # Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html |
|
1 | # Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html |
|
2 |
|
2 | ||
|
3 | <% |
|
3 | <% |
|
4 | User.public_class_method :encrypt |
|
4 | User.public_class_method :encrypt |
|
5 |
|
5 | ||
|
6 | salt = "abc" |
|
6 | salt = "abc" |
|
7 | %> |
|
7 | %> |
|
8 |
|
8 | ||
|
9 | john: |
|
9 | john: |
|
10 | login: john |
|
10 | login: john |
|
11 | full_name: john |
|
11 | full_name: john |
|
12 | hashed_password: <%= User.encrypt("hello",salt) %> |
|
12 | hashed_password: <%= User.encrypt("hello",salt) %> |
|
13 | salt: <%= salt %> |
|
13 | salt: <%= salt %> |
|
14 | activated: true |
|
14 | activated: true |
|
15 |
|
15 | ||
|
16 | - mary: |
|
16 | + admin: |
|
17 |
- login: |
|
17 | + login: admin |
|
18 |
- full_name: |
|
18 | + full_name: admin |
|
19 |
- hashed_password: <%= User.encrypt(" |
|
19 | + hashed_password: <%= User.encrypt("admin",salt) %> |
|
20 | salt: <%= salt %> |
|
20 | salt: <%= salt %> |
|
21 | roles: admin |
|
21 | roles: admin |
|
22 | activated: true |
|
22 | activated: true |
|
23 |
|
23 | ||
|
24 | james: |
|
24 | james: |
|
25 | login: james |
|
25 | login: james |
|
26 | full_name: James |
|
26 | full_name: James |
|
27 | hashed_password: <%= User.encrypt("morning",salt) %> |
|
27 | hashed_password: <%= User.encrypt("morning",salt) %> |
|
28 | salt: <%= salt %> |
|
28 | salt: <%= salt %> |
|
29 | contests: contest_a |
|
29 | contests: contest_a |
|
30 | activated: true |
|
30 | activated: true |
|
31 |
|
31 | ||
|
32 | jack: |
|
32 | jack: |
|
33 | login: jack |
|
33 | login: jack |
|
34 | full_name: Jack |
|
34 | full_name: Jack |
|
35 | hashed_password: <%= User.encrypt("morning",salt) %> |
|
35 | hashed_password: <%= User.encrypt("morning",salt) %> |
|
36 | salt: <%= salt %> |
|
36 | salt: <%= salt %> |
|
37 | contests: contest_a, contest_b |
|
37 | contests: contest_a, contest_b |
|
38 | activated: true |
|
38 | activated: true |
@@ -1,13 +1,37 | |||||
|
1 | require 'test_helper' |
|
1 | require 'test_helper' |
|
2 |
|
2 | ||
|
3 | class LoginTest < ActionDispatch::IntegrationTest |
|
3 | class LoginTest < ActionDispatch::IntegrationTest |
|
4 | # test "the truth" do |
|
4 | # test "the truth" do |
|
5 | # assert true |
|
5 | # assert true |
|
6 | # end |
|
6 | # end |
|
7 |
|
7 | ||
|
8 | - test "login with valid information" do |
|
8 | + test "login with invalid information" do |
|
|
9 | + get root_path | ||
|
|
10 | + assert_response :success | ||
|
|
11 | + post login_login_path, login: "root", password: "hahaha" | ||
|
|
12 | + assert_redirected_to root_path | ||
|
|
13 | + end | ||
|
|
14 | + | ||
|
|
15 | + test "normal user login" do | ||
|
9 | get root_path |
|
16 | get root_path |
|
10 | assert_response :success |
|
17 | assert_response :success |
|
|
18 | + post login_login_path, {login: "john", password: "hello" } | ||
|
|
19 | + assert_redirected_to main_list_path | ||
|
|
20 | + end | ||
|
11 |
|
21 | ||
|
|
22 | + test "normal user login in single_user mode" do | ||
|
|
23 | + GraderConfiguration[GraderConfiguration::SINGLE_USER_KEY] = 'true' | ||
|
|
24 | + get root_path | ||
|
|
25 | + assert_response :success | ||
|
|
26 | + post login_login_path, {login: "john", password: "hello" } | ||
|
|
27 | + assert_redirected_to root_path | ||
|
|
28 | + end | ||
|
|
29 | + | ||
|
|
30 | + test "root login in in single_user mode" do | ||
|
|
31 | + GraderConfiguration[GraderConfiguration::SINGLE_USER_KEY] = 'true' | ||
|
|
32 | + get root_path | ||
|
|
33 | + assert_response :success | ||
|
|
34 | + post login_login_path, {login: "admin", password: "admin" } | ||
|
|
35 | + assert_redirected_to main_list_path | ||
|
12 | end |
|
36 | end |
|
13 | end |
|
37 | end |
You need to be logged in to leave comments.
Login now