From ba19c7395ec5cc2fd4cc28d5f0901a94f66b4a89 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Thu, 30 Jan 2020 21:06:40 +0800 Subject: [PATCH] =?UTF-8?q?=E9=AA=8C=E8=AF=81=E6=89=8B=E6=9C=BA=E5=8F=B7?= =?UTF-8?q?=E6=88=96=E9=82=AE=E7=AE=B1=E6=98=AF=E5=90=A6=E5=B7=B2=E7=BB=91?= =?UTF-8?q?=E5=AE=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/accounts_controller.rb | 2 +- app/controllers/application_controller.rb | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/app/controllers/accounts_controller.rb b/app/controllers/accounts_controller.rb index 99cb013b7..c6c8b008c 100644 --- a/app/controllers/accounts_controller.rb +++ b/app/controllers/accounts_controller.rb @@ -167,7 +167,7 @@ class AccountsController < ApplicationController end # 检验邮箱是否已被注册及邮箱或者手机号是否合法 - # 参数type为事件类型 1:注册;2:忘记密码 + # 参数type为事件类型 1:注册;2:忘记密码;3:绑定 def valid_email_and_phone check_mail_and_phone_valid(params[:login], params[:type]) end diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index fdb41c114..e75892bf5 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -92,7 +92,7 @@ class ApplicationController < ActionController::Base # 判断用户的邮箱或者手机是否可用 - # params[:type] 1: 注册;2:忘记密码 + # params[:type] 1: 注册;2:忘记密码;3:绑定 def check_mail_and_phone_valid login, type unless login =~ /^[a-zA-Z0-9]+([._\\]*[a-zA-Z0-9])*@([a-z0-9]+[-a-z0-9]*[a-z0-9]+.){1,63}[a-z0-9]+$/ || login =~ /^1\d{10}$/ || login =~ /^[a-zA-Z0-9]+([._\\]*[a-zA-Z0-9])$/ @@ -104,6 +104,8 @@ class ApplicationController < ActionController::Base tip_exception(-2, "该手机号码或邮箱已被注册") elsif type.to_i == 2 && user.nil? tip_exception(-2, "该手机号码或邮箱未注册") + elsif type.to_i == 3 && user.present? + tip_exception(-2, "该手机号码或邮箱已绑定") end sucess_status end