Merge branch 'dev_aliyun' of https://bdgit.educoder.net/Hjqreturn/educoder into dev_aliyun

dev_forum
daiao 5 years ago
commit f7d7422b20

@ -46,7 +46,8 @@ class ApplicationController < ActionController::Base
# 判断用户的邮箱或者手机是否可用 # 判断用户的邮箱或者手机是否可用
# params[:type] 1: 注册2忘记密码 # params[:type] 1: 注册2忘记密码
def check_mail_and_phone_valid login, type 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, "请输入正确的手机号或邮箱") tip_exception(-2, "请输入正确的手机号或邮箱")
end end
# 考虑到安全参数问题多一次查询去掉Union # 考虑到安全参数问题多一次查询去掉Union
@ -186,7 +187,7 @@ class ApplicationController < ActionController::Base
# 系统全局认证 # 系统全局认证
def check_auth def check_auth
if current_user.certification != 1 && current_user.apply_actions.exists?(container_type: 'TrialAuthorization', status: 0) 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 elsif current_user.certification != 1
day_cer = UserDayCertification.find_by(user_id: current_user.id) 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 tip_exception(407, "系统未授权") unless (Time.now.to_i - day_cer.try(:created_at).to_i) < 86400

@ -196,7 +196,7 @@ class HomeworkCommonsController < ApplicationController
if params[:format] == "xlsx" if params[:format] == "xlsx"
if @user_course_identity >= Course::STUDENT if @user_course_identity >= Course::STUDENT
tip_exception(403, "无权限操作") tip_exception(403, "无权限操作")
elsif @work_excel.size == 0 elsif @work_excel.blank? || @work_excel.size == 0
normal_status(-1,"暂无用户提交!") normal_status(-1,"暂无用户提交!")
else else
respond_to do |format| respond_to do |format|

@ -1,8 +1,8 @@
class Users::AuthAttachmentsController < Users::BaseAccountController class Users::AuthAttachmentsController < Users::BaseAccountController
before_action :private_user_resources! 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' # 上传文件保存至临时文件,提交申请时再移到正常目录 image_temp_path = auth_image_path + 'temp' # 上传文件保存至临时文件,提交申请时再移到正常目录
File.delete(image_temp_path) if File.exist?(image_temp_path) # 删除之前的临时文件 File.delete(image_temp_path) if File.exist?(image_temp_path) # 删除之前的临时文件

@ -80,7 +80,7 @@ Rails.application.routes.draw do
resource :email_bind, only: [:create] resource :email_bind, only: [:create]
resource :password, only: [:update] resource :password, only: [:update]
resource :avatar, only: [:update] resource :avatar, only: [:update]
resource :auth_attachment, only: [:update] resource :auth_attachment, only: [:create]
resource :authentication_apply, only: [:create] resource :authentication_apply, only: [:create]
resource :professional_auth_apply, only: [:create] resource :professional_auth_apply, only: [:create]
end end

Loading…
Cancel
Save