Force admin to change password after first sign-in
This commit is contained in:
parent
94be732026
commit
fbf6989903
|
@ -159,7 +159,7 @@ class ApplicationController < ActionController::Base
|
|||
end
|
||||
|
||||
def check_password_expiration
|
||||
if current_user.password_expires_at && current_user.password_expires_at < Time.now
|
||||
if current_user && current_user.password_expires_at && current_user.password_expires_at < Time.now
|
||||
redirect_to new_profile_password_path and return
|
||||
end
|
||||
end
|
||||
|
|
|
@ -42,8 +42,11 @@ class User < ActiveRecord::Base
|
|||
|
||||
attr_accessible :email, :password, :password_confirmation, :remember_me, :bio, :name, :username,
|
||||
:skype, :linkedin, :twitter, :color_scheme_id, :theme_id, :force_random_password,
|
||||
:extern_uid, :provider, as: [:default, :admin]
|
||||
attr_accessible :projects_limit, :can_create_team, :can_create_group, as: :admin
|
||||
:extern_uid, :provider, :password_expires_at,
|
||||
as: [:default, :admin]
|
||||
|
||||
attr_accessible :projects_limit, :can_create_team, :can_create_group,
|
||||
as: :admin
|
||||
|
||||
attr_accessor :force_random_password
|
||||
|
||||
|
|
|
@ -3,7 +3,8 @@ admin = User.create(
|
|||
name: "Administrator",
|
||||
username: 'root',
|
||||
password: "5iveL!fe",
|
||||
password_confirmation: "5iveL!fe"
|
||||
password_confirmation: "5iveL!fe",
|
||||
password_expires_at: Time.now
|
||||
)
|
||||
|
||||
admin.projects_limit = 10000
|
||||
|
|
Loading…
Reference in New Issue