reviewed-auth 0.2.3 → 0.2.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -25,7 +25,7 @@ module Reviewed
25
25
 
26
26
  get "/" do
27
27
  response.delete_cookie(:_reviewed_token)
28
- erb :login_form, locals: {return_to_url: return_to_url(params)}
28
+ erb :login_form, locals: {return_to_url: return_to_url(params, request)}
29
29
  end
30
30
 
31
31
  post "/" do
@@ -57,14 +57,22 @@ module Reviewed
57
57
  end
58
58
  end
59
59
 
60
- def return_to_url(params)
61
- uri = URI(params['return_url'] || 'http://www.reviewed.com')
60
+ def return_to_url(params, request)
61
+ uri = URI(params['return_url'] || default_host_url(request))
62
62
  uri_params = params.reject { |k, v| k == 'return_url' }
63
63
  query_string = ::URI.encode_www_form(uri_params)
64
64
  uri.query = nil
65
65
  uri.query = query_string if !query_string.empty?
66
66
  return ::CGI.escape(uri.to_s)
67
67
  end
68
+
69
+ def default_host_url(request)
70
+ if request.env['HTTP_HOST'].match(/^.+\.reviewed\.(com|dev)/i)
71
+ "http://#{request.env['HTTP_HOST']}"
72
+ else
73
+ 'http://www.reviewed.com'
74
+ end
75
+ end
68
76
  end
69
77
  end
70
78
  end
@@ -1,5 +1,5 @@
1
1
  module Reviewed
2
2
  module Auth
3
- VERSION = "0.2.3"
3
+ VERSION = "0.2.4"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,69 +1,78 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: reviewed-auth
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.2.4
5
+ prerelease:
5
6
  platform: ruby
6
7
  authors:
7
8
  - Mark Bates
8
9
  autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
11
- date: 2013-11-21 00:00:00.000000000 Z
12
+ date: 2014-01-03 00:00:00.000000000 Z
12
13
  dependencies:
13
14
  - !ruby/object:Gem::Dependency
14
15
  name: sinatra
15
16
  requirement: !ruby/object:Gem::Requirement
17
+ none: false
16
18
  requirements:
17
- - - '>='
19
+ - - ! '>='
18
20
  - !ruby/object:Gem::Version
19
21
  version: '0'
20
22
  type: :runtime
21
23
  prerelease: false
22
24
  version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
23
26
  requirements:
24
- - - '>='
27
+ - - ! '>='
25
28
  - !ruby/object:Gem::Version
26
29
  version: '0'
27
30
  - !ruby/object:Gem::Dependency
28
31
  name: sinatra-contrib
29
32
  requirement: !ruby/object:Gem::Requirement
33
+ none: false
30
34
  requirements:
31
- - - '>='
35
+ - - ! '>='
32
36
  - !ruby/object:Gem::Version
33
37
  version: '0'
34
38
  type: :runtime
35
39
  prerelease: false
36
40
  version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
37
42
  requirements:
38
- - - '>='
43
+ - - ! '>='
39
44
  - !ruby/object:Gem::Version
40
45
  version: '0'
41
46
  - !ruby/object:Gem::Dependency
42
47
  name: faraday
43
48
  requirement: !ruby/object:Gem::Requirement
49
+ none: false
44
50
  requirements:
45
- - - '>='
51
+ - - ! '>='
46
52
  - !ruby/object:Gem::Version
47
53
  version: '0'
48
54
  type: :runtime
49
55
  prerelease: false
50
56
  version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
51
58
  requirements:
52
- - - '>='
59
+ - - ! '>='
53
60
  - !ruby/object:Gem::Version
54
61
  version: '0'
55
62
  - !ruby/object:Gem::Dependency
56
63
  name: sinatra-twitter-bootstrap
57
64
  requirement: !ruby/object:Gem::Requirement
65
+ none: false
58
66
  requirements:
59
- - - '>='
67
+ - - ! '>='
60
68
  - !ruby/object:Gem::Version
61
69
  version: '0'
62
70
  type: :runtime
63
71
  prerelease: false
64
72
  version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
65
74
  requirements:
66
- - - '>='
75
+ - - ! '>='
67
76
  - !ruby/object:Gem::Version
68
77
  version: '0'
69
78
  description: Central Authentication Service for Reviewed.com
@@ -88,25 +97,26 @@ files:
88
97
  - reviewed-auth.gemspec
89
98
  homepage: ''
90
99
  licenses: []
91
- metadata: {}
92
100
  post_install_message:
93
101
  rdoc_options: []
94
102
  require_paths:
95
103
  - lib
96
104
  required_ruby_version: !ruby/object:Gem::Requirement
105
+ none: false
97
106
  requirements:
98
- - - '>='
107
+ - - ! '>='
99
108
  - !ruby/object:Gem::Version
100
109
  version: '0'
101
110
  required_rubygems_version: !ruby/object:Gem::Requirement
111
+ none: false
102
112
  requirements:
103
- - - '>='
113
+ - - ! '>='
104
114
  - !ruby/object:Gem::Version
105
115
  version: '0'
106
116
  requirements: []
107
117
  rubyforge_project:
108
- rubygems_version: 2.0.3
118
+ rubygems_version: 1.8.23
109
119
  signing_key:
110
- specification_version: 4
120
+ specification_version: 3
111
121
  summary: Central Authentication Service for Reviewed.com
112
122
  test_files: []
checksums.yaml DELETED
@@ -1,7 +0,0 @@
1
- ---
2
- SHA1:
3
- metadata.gz: 542b1439dc87328027801c922afdb168bf7b9371
4
- data.tar.gz: 2ba5ba173b70fb2c9fb438cdef0ed1ab2cc8ca28
5
- SHA512:
6
- metadata.gz: 885a4b716669a52cba3aaaad67334917fa8a2623b404190b9dc8c9747e33a6dafa252c497cffdd506e7fe3b95fda7b3f9b2a41f45d0b3bcc0f3e998497cdb466
7
- data.tar.gz: 74f1b45a62efc7f031913028c58b923f5f1e861069d9b24987c064bf423149ce8f31ff53a90c8cd4141874abe368d9cef30f01b68bdb68391873332fffa0ddee