fixed 手机号注册失败

This commit is contained in:
xiaoxiaoqiong 2021-12-25 20:22:46 +08:00
parent a5d4799a21
commit 01bf13ddd9
1 changed files with 2 additions and 2 deletions

View File

@ -6,12 +6,12 @@ module RegisterHelper
email = email.blank? ? "#{username}@example.org" : email
user = User.find_by(login: username)
user = User.find_by(phone: phone) if phone.present?
user = User.find_by(phone: phone) if user.blank? && phone.present?
user ||= User.new(admin: false, login: username, mail: email, type: "User")
user.password = password
user.platform = platform
user.phone = phone
user.phone = phone if phone.present?
user.activate
return unless user.valid?