FIX: Password required flag should be cleared whenever clearing the raw password (#5384)

This commit is contained in:
Vinoth Kannan
2017-12-01 09:49:24 +05:30
committed by Sam
parent 9876f3d0ee
commit 7f2eeaf767
7 changed files with 38 additions and 12 deletions

View File

@@ -452,6 +452,10 @@ class User < ActiveRecord::Base
!!@password_required
end
def password_validation_required?
password_required? || @raw_password.present?
end
def has_password?
password_hash.present?
end
@@ -1029,6 +1033,7 @@ class User < ActiveRecord::Base
UserAuthToken.where(user_id: id).destroy_all
# We should not carry this around after save
@raw_password = nil
@password_required = false
end
end