Add password_expires_at to users table
This commit is contained in:
parent
5b40780290
commit
94be732026
|
@ -1,7 +1,7 @@
|
|||
class ApplicationController < ActionController::Base
|
||||
before_filter :authenticate_user!
|
||||
before_filter :reject_blocked!
|
||||
before_filter :check_password_expiration!
|
||||
before_filter :check_password_expiration
|
||||
before_filter :set_current_user_for_thread
|
||||
before_filter :add_abilities
|
||||
before_filter :dev_tools if Rails.env == 'development'
|
||||
|
@ -159,7 +159,7 @@ class ApplicationController < ActionController::Base
|
|||
end
|
||||
|
||||
def check_password_expiration
|
||||
if current_user.password_expires_at < Time.now
|
||||
if current_user.password_expires_at && current_user.password_expires_at < Time.now
|
||||
redirect_to new_profile_password_path and return
|
||||
end
|
||||
end
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
class AddPasswordExpiresAtToUsers < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :users, :password_expires_at, :datetime
|
||||
end
|
||||
end
|
|
@ -11,7 +11,7 @@
|
|||
#
|
||||
# It's strongly recommended to check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(:version => 20130522141856) do
|
||||
ActiveRecord::Schema.define(:version => 20130613165816) do
|
||||
|
||||
create_table "deploy_keys_projects", :force => true do |t|
|
||||
t.integer "deploy_key_id", :null => false
|
||||
|
@ -292,6 +292,7 @@ ActiveRecord::Schema.define(:version => 20130522141856) do
|
|||
t.string "state"
|
||||
t.integer "color_scheme_id", :default => 1, :null => false
|
||||
t.integer "notification_level", :default => 1, :null => false
|
||||
t.datetime "password_expires_at"
|
||||
end
|
||||
|
||||
add_index "users", ["admin"], :name => "index_users_on_admin"
|
||||
|
|
Loading…
Reference in New Issue