Sha256: 4bba951ea8cf458d453b0bba41393edc1ef81e68fb1533d352e57c83397f6737
Contents?: true
Size: 822 Bytes
Versions: 4
Compression:
Stored size: 822 Bytes
Contents
class ApplicationController < ActionController::Base before_action :set_current_request_details before_action :authenticate <%- if options.lockable? %> def require_lock(wait: 1.hour, attempts: 10) counter = Kredis.counter("require_lock:#{request.remote_ip}:#{controller_path}:#{action_name}", expires_in: wait) counter.increment if counter.value > attempts redirect_to root_path, alert: "You've exceeded the maximum number of attempts" end end <%- end -%> private def authenticate if session = Session.find_by_id(cookies.signed[:session_token]) Current.session = session else redirect_to sign_in_path end end def set_current_request_details Current.user_agent = request.user_agent Current.ip_address = request.ip end end
Version data entries
4 entries across 4 versions & 1 rubygems