请求签名过滤不合理请求

dev_cxt
jingquan huang 5 years ago
parent b1e04695e3
commit fc0f9cb0d1

@ -12,6 +12,7 @@ class ApplicationController < ActionController::Base
protect_from_forgery prepend: true, unless: -> { request.format.json? }
before_action :check_sign
before_action :user_setup
#before_action :check_account
@ -20,6 +21,13 @@ class ApplicationController < ActionController::Base
helper_method :current_user
# 所有请求必须合法签名
def check_sign
timestamp = Time.now.to_i
sign = Digest::MD5.hexdigest("#{OPENKEY}#{timestamp}")
tip_exception(501, "请求不合理") if sign != params[:client_key]
end
# 全局配置参数
# 返回name对应的value
def edu_setting(name)

Loading…
Cancel
Save