Description:
Merge branch 'master' into codejom (bug fixed)
Commit status:
[Not Reviewed]
References:
Diff options:
Comments:
0 Commit comments
0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
r250:6820e08d6a38 - - 1 file changed: 10 inserted, 0 deleted
@@ -1,19 +1,23 | |||||
|
1 | class MainController < ApplicationController |
|
1 | class MainController < ApplicationController |
|
2 |
|
2 | ||
|
3 | before_filter :authenticate, :except => [:index, :login] |
|
3 | before_filter :authenticate, :except => [:index, :login] |
|
4 | before_filter :check_viewability, :except => [:index, :login] |
|
4 | before_filter :check_viewability, :except => [:index, :login] |
|
5 |
|
5 | ||
|
6 | append_before_filter :update_user_start_time, :except => [:index, :login] |
|
6 | append_before_filter :update_user_start_time, :except => [:index, :login] |
|
7 |
|
7 | ||
|
|
8 | + # to prevent log in box to be shown when user logged out of the | ||
|
|
9 | + # system only in some tab | ||
|
|
10 | + prepend_before_filter :reject_announcement_refresh_when_logged_out, :only => [:announcements] | ||
|
|
11 | + | ||
|
8 | # COMMENTED OUT: filter in each action instead |
|
12 | # COMMENTED OUT: filter in each action instead |
|
9 | # before_filter :verify_time_limit, :only => [:submit] |
|
13 | # before_filter :verify_time_limit, :only => [:submit] |
|
10 |
|
14 | ||
|
11 | verify :method => :post, :only => [:submit, :download_input, :submit_solution], |
|
15 | verify :method => :post, :only => [:submit, :download_input, :submit_solution], |
|
12 | :redirect_to => { :action => :index } |
|
16 | :redirect_to => { :action => :index } |
|
13 |
|
17 | ||
|
14 | # COMMENT OUT: only need when having high load |
|
18 | # COMMENT OUT: only need when having high load |
|
15 | # caches_action :index, :login |
|
19 | # caches_action :index, :login |
|
16 |
|
20 | ||
|
17 | # NOTE: This method is not actually needed, 'config/routes.rb' has |
|
21 | # NOTE: This method is not actually needed, 'config/routes.rb' has |
|
18 | # assigned action login as a default action. |
|
22 | # assigned action login as a default action. |
|
19 | def index |
|
23 | def index |
@@ -453,14 +457,20 | |||||
|
453 | :msg => "#{run_stat}\n#{time_stat}", |
|
457 | :msg => "#{run_stat}\n#{time_stat}", |
|
454 | :running_time => seconds, |
|
458 | :running_time => seconds, |
|
455 | :exit_status => run_stat, |
|
459 | :exit_status => run_stat, |
|
456 | :memory_usage => memory_used |
|
460 | :memory_usage => memory_used |
|
457 | } |
|
461 | } |
|
458 | end |
|
462 | end |
|
459 |
|
463 | ||
|
460 | def update_user_start_time |
|
464 | def update_user_start_time |
|
461 | user = User.find(session[:user_id]) |
|
465 | user = User.find(session[:user_id]) |
|
462 | UserContestStat.update_user_start_time(user) |
|
466 | UserContestStat.update_user_start_time(user) |
|
463 | end |
|
467 | end |
|
464 |
|
468 | ||
|
|
469 | + def reject_announcement_refresh_when_logged_out | ||
|
|
470 | + if not session[:user_id] | ||
|
|
471 | + render :text => 'Access forbidden', :status => 403 | ||
|
|
472 | + end | ||
|
|
473 | + end | ||
|
|
474 | + | ||
|
465 | end |
|
475 | end |
|
466 |
|
476 |
You need to be logged in to leave comments.
Login now