7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
# File 'app/controllers/codeword/codeword_controller.rb', line 7
def unlock
user_agent = request.env['HTTP_USER_AGENT'].presence
if user_agent&.downcase&.match(CRAWLER_REGEX)
head :ok
return
end
if params[:codeword].present?
@codeword = params[:codeword].to_s.downcase
@return_to = params[:return_to]
if @codeword == Codeword::Configuration.codeword_code.to_s.downcase
set_cookie
run_redirect
else
@wrong = true
end
else
respond_to :html
end
end
|