Description:
force log out when password change
Commit status:
[Not Reviewed]
References:
Diff options:
Comments:
0 Commit comments
0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
r884:490fbe2ccf0b - - 2 files changed: 7 inserted, 1 deleted
@@ -114,6 +114,11 | |||
|
114 | 114 | end |
|
115 | 115 | end |
|
116 | 116 | |
|
117 | + # check if password is changed | |
|
118 | + if session[:last_password_hash] != @current_user.hashed_password | |
|
119 | + unauthorized_redirect 'You are forced to log out.' | |
|
120 | + end | |
|
121 | + | |
|
117 | 122 | if GraderConfiguration.multicontests? |
|
118 | 123 | return true if @current_user.admin? |
|
119 | 124 | begin |
@@ -1,7 +1,7 | |||
|
1 | 1 | class LoginController < ApplicationController |
|
2 | 2 | |
|
3 | 3 | @@authenticators = [] |
|
4 | - | |
|
4 | + | |
|
5 | 5 | def index |
|
6 | 6 | # show login screen |
|
7 | 7 | reset_session |
@@ -34,6 +34,7 | |||
|
34 | 34 | |
|
35 | 35 | #process logging in |
|
36 | 36 | session[:user_id] = user.id |
|
37 | + session[:last_password_hash] = user.hashed_password | |
|
37 | 38 | session[:admin] = user.admin? |
|
38 | 39 | |
|
39 | 40 | # clear forced logout flag for multicontests contest change |
You need to be logged in to leave comments.
Login now