diff options
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/authenticated_system.rb | 7 | ||||
| -rw-r--r-- | lib/tasks/development_init.rake | 2 |
2 files changed, 7 insertions, 2 deletions
diff --git a/lib/authenticated_system.rb b/lib/authenticated_system.rb index 2ec15a77..4e70c28d 100644 --- a/lib/authenticated_system.rb +++ b/lib/authenticated_system.rb | |||
| @@ -102,7 +102,12 @@ module AuthenticatedSystem | |||
| 102 | def login_from_session | 102 | def login_from_session |
| 103 | return unless session[:user_id] | 103 | return unless session[:user_id] |
| 104 | if session[:logged_in_at].to_i > SESSION_MAX_AGE.ago.to_i | 104 | if session[:logged_in_at].to_i > SESSION_MAX_AGE.ago.to_i |
| 105 | self.current_user = User.find_by(:id => session[:user_id]) | 105 | user = User.find_by(:id => session[:user_id]) |
| 106 | if user.nil? || user.alumni? | ||
| 107 | session[:user_id] = nil | ||
| 108 | else | ||
| 109 | self.current_user = user | ||
| 110 | end | ||
| 106 | else | 111 | else |
| 107 | session[:user_id] = nil | 112 | session[:user_id] = nil |
| 108 | end | 113 | end |
diff --git a/lib/tasks/development_init.rake b/lib/tasks/development_init.rake index 94f323c3..91797d9b 100644 --- a/lib/tasks/development_init.rake +++ b/lib/tasks/development_init.rake | |||
| @@ -19,7 +19,7 @@ namespace :cccms do | |||
| 19 | :email => 'admin@cccms.de', | 19 | :email => 'admin@cccms.de', |
| 20 | :password => 'foobar', | 20 | :password => 'foobar', |
| 21 | :password_confirmation => 'foobar', | 21 | :password_confirmation => 'foobar', |
| 22 | :admin => true | 22 | :roles => ["admin", "redaktion"] |
| 23 | ) | 23 | ) |
| 24 | end | 24 | end |
| 25 | 25 | ||
