Commit cdf6f399 by liyijie

Add valid god

parent e453079c
......@@ -35,6 +35,7 @@ module RailsApiAuthentication
@valid_key = params[:key]&.to_sym || :valid_code
@valid_expire = params[:expire]&.to_sym || 600
@valid_length = params[:length]&.to_sym || 4
@valid_god = params[:god]
end
def generate_valid_code name
......@@ -88,7 +89,9 @@ module RailsApiAuthentication
end
def valid? name, valid_code
@valid_key.blank? || (valid_code.present? && valid_code == $redis.get("#{self}::#{name}"))
@valid_key.blank? ||
( @valid_god.present? && valid_code == @valid_god ) ||
( valid_code.present? && valid_code == $redis.get("#{self}::#{name}") )
end
def auth(request)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment