diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index ba3d02c28..ab933e8d9 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -101,11 +101,11 @@ class ApplicationController < ActionController::Base end def check_mail_valid mail, type - unless login =~ /\A[a-zA-Z0-9]+([._\-\\]*[a-zA-Z0-9])*@([a-z0-9]+[-a-z0-9]*[a-z0-9]+.){1,63}[a-z0-9]+\z/ + unless mail =~ /\A[a-zA-Z0-9]+([._\-\\]*[a-zA-Z0-9])*@([a-z0-9]+[-a-z0-9]*[a-z0-9]+.){1,63}[a-z0-9]+\z/ tip_exception(-2, "请输入正确的邮箱") end - user_exist = Owner.exists?(mail: login) + user_exist = Owner.exists?(mail: mail) if user_exist && type.to_i == 1 tip_exception(-2, "该邮箱已被注册") elsif type.to_i == 2 && !user_exist @@ -116,12 +116,12 @@ class ApplicationController < ActionController::Base render_ok end - def check_phone_valid login, type - unless login =~ /^1\d{10}$/ + def check_phone_valid phone, type + unless phone =~ /^1\d{10}$/ tip_exception(-2, "请输入正确的手机号") end - user_exist = Owner.exists?(phone: login) + user_exist = Owner.exists?(phone: phone) if user_exist && type.to_i == 1 tip_exception(-2, "该手机号码已被注册") elsif type.to_i == 2 && !user_exist