Commit 94be73202617a5b0886c348ffbaf08947ecf8b45
1 parent
5b407802
Exists in
master
and in
4 other branches
Add password_expires_at to users table
Showing
3 changed files
with
9 additions
and
3 deletions
Show diff stats
app/controllers/application_controller.rb
1 | 1 | class ApplicationController < ActionController::Base |
2 | 2 | before_filter :authenticate_user! |
3 | 3 | before_filter :reject_blocked! |
4 | - before_filter :check_password_expiration! | |
4 | + before_filter :check_password_expiration | |
5 | 5 | before_filter :set_current_user_for_thread |
6 | 6 | before_filter :add_abilities |
7 | 7 | before_filter :dev_tools if Rails.env == 'development' |
... | ... | @@ -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 < Time.now | |
162 | + if 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 | ... | ... |
db/migrate/20130613165816_add_password_expires_at_to_users.rb
0 → 100644
db/schema.rb
... | ... | @@ -11,7 +11,7 @@ |
11 | 11 | # |
12 | 12 | # It's strongly recommended to check this file into your version control system. |
13 | 13 | |
14 | -ActiveRecord::Schema.define(:version => 20130522141856) do | |
14 | +ActiveRecord::Schema.define(:version => 20130613165816) do | |
15 | 15 | |
16 | 16 | create_table "deploy_keys_projects", :force => true do |t| |
17 | 17 | t.integer "deploy_key_id", :null => false |
... | ... | @@ -292,6 +292,7 @@ ActiveRecord::Schema.define(:version => 20130522141856) do |
292 | 292 | t.string "state" |
293 | 293 | t.integer "color_scheme_id", :default => 1, :null => false |
294 | 294 | t.integer "notification_level", :default => 1, :null => false |
295 | + t.datetime "password_expires_at" | |
295 | 296 | end |
296 | 297 | |
297 | 298 | add_index "users", ["admin"], :name => "index_users_on_admin" | ... | ... |