lockup 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -1,8 +1,14 @@
1
1
  # Lockup
2
2
 
3
- “Can I come into your fort?”
3
+ [![Gem Version](https://badge.fury.io/rb/lockup.png)](http://badge.fury.io/rb/lockup)
4
4
 
5
- “…what's the codeword?”
5
+ A simple gem to more elegantly place a staging server or other in-progress rails application behind a basic codeword. It’s easy to implement, share with clients/collaborators, and more beautiful than the typical password-protection sheet.
6
+
7
+ _“Can I come into your fort?”_
8
+
9
+ _“…what's the codeword?”_
10
+
11
+ (currently used in production with Rails 3.X and nonimally tested—seems to work—in Rails 4)
6
12
 
7
13
  ## Installation
8
14
 
@@ -4,11 +4,16 @@ module Lockup
4
4
 
5
5
  def unlock
6
6
  if params[:lockup_codeword].present?
7
- @codeword = params[:lockup_codeword].to_s.downcase
8
- @return_to = params[:return_to]
9
- if @codeword == ENV["LOCKUP_CODEWORD"].to_s.downcase
10
- set_cookie
11
- run_redirect
7
+ user_agent = request.env['HTTP_USER_AGENT'].downcase
8
+ unless user_agent.match(/crawl|googlebot|slurp|spider|bingbot|tracker|click|parser|spider/)
9
+ @codeword = params[:lockup_codeword].to_s.downcase
10
+ @return_to = params[:return_to]
11
+ if @codeword == ENV["LOCKUP_CODEWORD"].to_s.downcase
12
+ set_cookie
13
+ run_redirect
14
+ end
15
+ else
16
+ render :nothing => true
12
17
  end
13
18
  end
14
19
 
@@ -1,3 +1,3 @@
1
1
  module Lockup
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lockup
3
3
  version: !ruby/object:Gem::Version
4
- hash: 23
4
+ hash: 21
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 4
10
- version: 0.0.4
9
+ - 5
10
+ version: 0.0.5
11
11
  platform: ruby
12
12
  authors:
13
13
  - gb Studio
@@ -31,10 +31,10 @@ dependencies:
31
31
  version: "3"
32
32
  - - <
33
33
  - !ruby/object:Gem::Version
34
- hash: 15
34
+ hash: 9
35
35
  segments:
36
- - 6
37
- version: "6"
36
+ - 5
37
+ version: "5"
38
38
  type: :runtime
39
39
  version_requirements: *id001
40
40
  description: "A simple gem to more elegantly place a staging server or other in-progress application behind a basic codeword. It\xE2\x80\x99s easy to implement, share with clients/collaborators, and more beautiful than the typical password-protection sheet."