fixed 增加自动登录,手机号先记录,后续用

This commit is contained in:
xiaoxiaoqiong 2022-05-24 10:47:17 +08:00
parent ee3a14fa28
commit b673909f9e
1 changed files with 4 additions and 1 deletions

View File

@ -350,7 +350,10 @@ class UsersController < ApplicationController
# 没有用户时,新建用户并登录
user = User.where("login = ? or phone = ? or mail = ? ", "#{login}", phone, email).first
unless user
if user.present?
# 手机号先记录,后续用
user.update_column(:phone, "#{phone}") if phone.present?
else
ActiveRecord::Base.transaction do
phone_rand = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9].sample(4).join
user_params = { status: 1, type: 'User', login: "#{login}", lastname: "#{real_name}", mail: "#{email}",