Commit fbf69899032ffd5e74e401aae7c94852a0722e92
1 parent
94be7320
Exists in
master
and in
4 other branches
Force admin to change password after first sign-in
Showing
3 changed files
with
8 additions
and
4 deletions
Show diff stats
app/controllers/application_controller.rb
| ... | ... | @@ -159,7 +159,7 @@ class ApplicationController < ActionController::Base |
| 159 | 159 | end |
| 160 | 160 | |
| 161 | 161 | def check_password_expiration |
| 162 | - if current_user.password_expires_at && current_user.password_expires_at < Time.now | |
| 162 | + if current_user && current_user.password_expires_at && current_user.password_expires_at < Time.now | |
| 163 | 163 | redirect_to new_profile_password_path and return |
| 164 | 164 | end |
| 165 | 165 | end | ... | ... |
app/models/user.rb
| ... | ... | @@ -42,8 +42,11 @@ class User < ActiveRecord::Base |
| 42 | 42 | |
| 43 | 43 | attr_accessible :email, :password, :password_confirmation, :remember_me, :bio, :name, :username, |
| 44 | 44 | :skype, :linkedin, :twitter, :color_scheme_id, :theme_id, :force_random_password, |
| 45 | - :extern_uid, :provider, as: [:default, :admin] | |
| 46 | - attr_accessible :projects_limit, :can_create_team, :can_create_group, as: :admin | |
| 45 | + :extern_uid, :provider, :password_expires_at, | |
| 46 | + as: [:default, :admin] | |
| 47 | + | |
| 48 | + attr_accessible :projects_limit, :can_create_team, :can_create_group, | |
| 49 | + as: :admin | |
| 47 | 50 | |
| 48 | 51 | attr_accessor :force_random_password |
| 49 | 52 | ... | ... |
db/fixtures/production/001_admin.rb