Commit fbf69899 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Force admin to change password after first sign-in

parent 94be7320
...@@ -159,7 +159,7 @@ class ApplicationController < ActionController::Base ...@@ -159,7 +159,7 @@ class ApplicationController < ActionController::Base
end end
def check_password_expiration 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 redirect_to new_profile_password_path and return
end end
end end
......
...@@ -42,8 +42,11 @@ class User < ActiveRecord::Base ...@@ -42,8 +42,11 @@ class User < ActiveRecord::Base
attr_accessible :email, :password, :password_confirmation, :remember_me, :bio, :name, :username, attr_accessible :email, :password, :password_confirmation, :remember_me, :bio, :name, :username,
:skype, :linkedin, :twitter, :color_scheme_id, :theme_id, :force_random_password, :skype, :linkedin, :twitter, :color_scheme_id, :theme_id, :force_random_password,
:extern_uid, :provider, as: [:default, :admin] :extern_uid, :provider, :password_expires_at,
attr_accessible :projects_limit, :can_create_team, :can_create_group, as: :admin as: [:default, :admin]
attr_accessible :projects_limit, :can_create_team, :can_create_group,
as: :admin
attr_accessor :force_random_password attr_accessor :force_random_password
......
...@@ -3,7 +3,8 @@ admin = User.create( ...@@ -3,7 +3,8 @@ admin = User.create(
name: "Administrator", name: "Administrator",
username: 'root', username: 'root',
password: "5iveL!fe", password: "5iveL!fe",
password_confirmation: "5iveL!fe" password_confirmation: "5iveL!fe",
password_expires_at: Time.now
) )
admin.projects_limit = 10000 admin.projects_limit = 10000
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment