修复: trace user 手机号为空

This commit is contained in:
yystopf 2022-08-17 18:39:01 +08:00
parent 911c47df8d
commit 4b167dacbb
1 changed files with 3 additions and 3 deletions

View File

@ -32,7 +32,7 @@ class TraceUser < ApplicationRecord
self.username = user.login
self.password = SecureRandom.hex
self.unit = user.custom_department.blank? ? 'GitLink' : user.custom_department
self.telnumber = user.phone
self.telnumber = user.phone || ""
self.email = user.mail
self.name = user.nickname.blank? ? user.login : user.nickname
@ -41,7 +41,7 @@ class TraceUser < ApplicationRecord
def build_token
return if username.blank? || password.blank? || unit.blank? || telnumber.blank? || email.blank? || name.blank?
return if username.blank? || password.blank? || unit.blank? || email.blank? || name.blank?
response = Trace::AddUserService.call(username, password, unit, telnumber, email, name)
self.token = response[1]['token']
@ -49,7 +49,7 @@ class TraceUser < ApplicationRecord
end
def refresh_token
return if username.blank? || password.blank? || unit.blank? || telnumber.blank? || email.blank? || name.blank?
return if username.blank? || password.blank? || unit.blank? || email.blank? || name.blank?
response = Trace::LoginService.call(username, password)
self.token = response[1]['token']