diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index cf98f2973..b0183574d 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -46,7 +46,8 @@ 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])$/ tip_exception(-2, "请输入正确的手机号或邮箱") end # 考虑到安全参数问题,多一次查询,去掉Union @@ -186,7 +187,7 @@ class ApplicationController < ActionController::Base # 系统全局认证 def check_auth if current_user.certification != 1 && current_user.apply_actions.exists?(container_type: 'TrialAuthorization', status: 0) - tip_exception(-1, "您的试用申请正在审核中,请耐心等待") + tip_exception(408, "您的试用申请正在审核中,请耐心等待") elsif current_user.certification != 1 day_cer = UserDayCertification.find_by(user_id: current_user.id) tip_exception(407, "系统未授权") unless (Time.now.to_i - day_cer.try(:created_at).to_i) < 86400 diff --git a/app/controllers/homework_commons_controller.rb b/app/controllers/homework_commons_controller.rb index 4685c9f69..8e4b888a1 100644 --- a/app/controllers/homework_commons_controller.rb +++ b/app/controllers/homework_commons_controller.rb @@ -196,7 +196,7 @@ class HomeworkCommonsController < ApplicationController if params[:format] == "xlsx" if @user_course_identity >= Course::STUDENT tip_exception(403, "无权限操作") - elsif @work_excel.size == 0 + elsif @work_excel.blank? || @work_excel.size == 0 normal_status(-1,"暂无用户提交!") else respond_to do |format| diff --git a/app/controllers/users/auth_attachments_controller.rb b/app/controllers/users/auth_attachments_controller.rb index 86c3e70ef..98eff078f 100644 --- a/app/controllers/users/auth_attachments_controller.rb +++ b/app/controllers/users/auth_attachments_controller.rb @@ -1,8 +1,8 @@ class Users::AuthAttachmentsController < Users::BaseAccountController before_action :private_user_resources! - before_action :convert_image!, only: [:update] + before_action :convert_image!, only: [:create] - def update + def create image_temp_path = auth_image_path + 'temp' # 上传文件保存至临时文件,提交申请时再移到正常目录 File.delete(image_temp_path) if File.exist?(image_temp_path) # 删除之前的临时文件 diff --git a/config/routes.rb b/config/routes.rb index a5742494d..cabdcb18e 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -80,7 +80,7 @@ Rails.application.routes.draw do resource :email_bind, only: [:create] resource :password, only: [:update] resource :avatar, only: [:update] - resource :auth_attachment, only: [:update] + resource :auth_attachment, only: [:create] resource :authentication_apply, only: [:create] resource :professional_auth_apply, only: [:create] end