Description:
shows warning message when user cannot log in in single user mode
Commit status:
[Not Reviewed]
References:
Comments:
0 Commit comments 0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
Add another comment

r301:bdf9a550f783 - - 1 file changed: 1 inserted, 0 deleted

@@ -24,24 +24,25
24 protected
24 protected
25
25
26 def authenticate
26 def authenticate
27 unless session[:user_id]
27 unless session[:user_id]
28 redirect_to :controller => 'main', :action => 'login'
28 redirect_to :controller => 'main', :action => 'login'
29 return false
29 return false
30 end
30 end
31
31
32 # check if run in single user mode
32 # check if run in single user mode
33 if Configuration[SINGLE_USER_MODE_CONF_KEY]
33 if Configuration[SINGLE_USER_MODE_CONF_KEY]
34 user = User.find(session[:user_id])
34 user = User.find(session[:user_id])
35 if user==nil or (not user.admin?)
35 if user==nil or (not user.admin?)
36 + flash[:notice] = 'You cannot log in at this time'
36 redirect_to :controller => 'main', :action => 'login'
37 redirect_to :controller => 'main', :action => 'login'
37 return false
38 return false
38 end
39 end
39 return true
40 return true
40 end
41 end
41
42
42 if Configuration.multicontests?
43 if Configuration.multicontests?
43 user = User.find(session[:user_id])
44 user = User.find(session[:user_id])
44 return true if user.admin?
45 return true if user.admin?
45 begin
46 begin
46 if user.contest_stat(true).forced_logout
47 if user.contest_stat(true).forced_logout
47 flash[:notice] = 'You have been automatically logged out.'
48 flash[:notice] = 'You have been automatically logged out.'
You need to be logged in to leave comments. Login now