From d2c112469f7099c1efb2c63c01c098fd2107c9ea Mon Sep 17 00:00:00 2001 From: jingquan huang Date: Sat, 20 Jul 2019 20:31:55 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E7=99=BB=E5=BD=95=E8=A7=84=E8=8C=83?= =?UTF-8?q?=E6=A3=80=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/application_controller.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 6a7599f28..732ff781c 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -46,7 +46,9 @@ class ApplicationController < ActionController::Base # 判断用户的邮箱或者手机是否可用 # params[:type] 1: 注册;2:忘记密码 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}$/ + 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])$/ +end tip_exception(-2, "请输入正确的手机号或邮箱") end # 考虑到安全参数问题,多一次查询,去掉Union From b26a9fc03d709a46fa3283d42ef382d274cf5cf3 Mon Sep 17 00:00:00 2001 From: jingquan huang Date: Sat, 20 Jul 2019 20:38:53 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E7=99=BB=E5=BD=95=E7=9A=84=E6=97=B6?= =?UTF-8?q?=E5=80=99=E6=AD=A3=E5=88=99=E8=A7=84=E8=8C=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/application_controller.rb | 1 - 1 file changed, 1 deletion(-) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 0862892bb..b1c36c7bf 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -48,7 +48,6 @@ class ApplicationController < ActionController::Base 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])$/ -end tip_exception(-2, "请输入正确的手机号或邮箱") end # 考虑到安全参数问题,多一次查询,去掉Union