Description:
update heartbeat
add try-to-login-from-other-ip loggin (by printing to stdout)
Commit status:
[Not Reviewed]
References:
Diff options:
Comments:
0 Commit comments
0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
r539:c49187a88c77 - - 2 files changed: 2 inserted, 1 deleted
@@ -69,6 +69,7 | |||||
|
69 | if (not user.admin? and user.last_ip and user.last_ip != request.remote_ip) |
|
69 | if (not user.admin? and user.last_ip and user.last_ip != request.remote_ip) |
|
70 | flash[:notice] = "You cannot use the system from #{request.remote_ip}. Your last ip is #{user.last_ip}" |
|
70 | flash[:notice] = "You cannot use the system from #{request.remote_ip}. Your last ip is #{user.last_ip}" |
|
71 | redirect_to :controller => 'main', :action => 'login' |
|
71 | redirect_to :controller => 'main', :action => 'login' |
|
|
72 | + puts "CHEAT: user #{user.login} tried to login from '#{request.remote_ip}' while last ip is '#{user.last_ip}' at #{Time.zone.now}" | ||
|
72 | return false |
|
73 | return false |
|
73 | end |
|
74 | end |
|
74 | unless user.last_ip |
|
75 | unless user.last_ip |
@@ -26,6 +26,6 | |||||
|
26 |
|
26 | ||
|
27 | def index |
|
27 | def index |
|
28 | @hb = HeartBeat.where("updated_at >= ?",Time.zone.now-2.hours).includes(:user).order(:user_id).all |
|
28 | @hb = HeartBeat.where("updated_at >= ?",Time.zone.now-2.hours).includes(:user).order(:user_id).all |
|
29 | - @num = HeartBeat.where("updated_at >= ?",Time.zone.now-5.minutes).count |
|
29 | + @num = HeartBeat.where("updated_at >= ?",Time.zone.now-5.minutes).count(:user_id,distinct: true) |
|
30 | end |
|
30 | end |
|
31 | end |
|
31 | end |
You need to be logged in to leave comments.
Login now