Sha256: 5ff095283de935deaf764c0e093fd1811768e8a7dfc4d9f1c4c1198e652d14da
Contents?: true
Size: 721 Bytes
Versions: 2
Compression:
Stored size: 721 Bytes
Contents
require_dependency "guard_dog/application_controller" module GuardDog class AccessController < ApplicationController skip_before_filter :guard_dog_authentication def authentication passwords = ENV['GUARD_DOG_PASSWORD'].try(:split, /\s*,\s*/) || [] if passwords.empty? || passwords.include?(params[:password]) allow_access else deny_access end end protected def allow_access session[:guard_dog_password] = true redirect_to main_app.root_path end def deny_access session[:guard_dog_password] = false if params[:password].blank? flash.now[:notice] = 'Please enter the password to continue.' else flash.now[:notice] = 'Invalid password!' end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
guard_dog-0.1.5 | app/controllers/guard_dog/access_controller.rb |
guard_dog-0.1.3 | app/controllers/guard_dog/access_controller.rb |