fix: profile completed

This commit is contained in:
2021-09-18 10:24:16 +08:00
parent 8c60ce1d76
commit a2ae8f1630
2 changed files with 6 additions and 6 deletions

View File

@@ -186,7 +186,7 @@ class User < Owner
:show_email, :show_location, :show_department,
:technical_title, :province, :city, :custom_department, to: :user_extension, allow_nil: true
before_save :update_hashed_password, :set_lastname, :set_profile_completed
before_save :update_hashed_password, :set_lastname
after_create do
SyncTrustieJob.perform_later("user", 1) if allow_sync_to_trustie?
end
@@ -757,6 +757,10 @@ class User < Owner
laboratory_id.present? && laboratory_id != 1
end
def profile_is_completed?
self.nickname.present? && self.gender.present? && self.mail.present? && self.custom_department.present?
end
protected
def validate_password_length
# 管理员的初始密码是5位
@@ -783,10 +787,6 @@ class User < Owner
def set_lastname
self.lastname = self.nickname if changes[:nickname].present?
end
def set_profile_completed
self.profile_completed = self.nickname.present? && self.gender.present? && self.mail.present? && self.custom_department.present?
end
end