sinatra_auth_github 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/sinatra/auth/github.rb +7 -1
- metadata +3 -3
data/lib/sinatra/auth/github.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'sinatra/base'
|
2
|
+
require 'sinatra/url_for'
|
2
3
|
require 'warden-github'
|
3
4
|
|
4
5
|
module Sinatra
|
@@ -36,6 +37,10 @@ module Sinatra
|
|
36
37
|
response = RestClient.get("https://github.com/api/v2/json/#{path}", {:accept => :json, :params => {:token => github_user.token}})
|
37
38
|
JSON.parse(response.body)
|
38
39
|
end
|
40
|
+
|
41
|
+
def _relative_url_for(path)
|
42
|
+
request.script_name + path
|
43
|
+
end
|
39
44
|
end
|
40
45
|
|
41
46
|
def self.registered(app)
|
@@ -50,10 +55,11 @@ module Sinatra
|
|
50
55
|
end
|
51
56
|
|
52
57
|
app.helpers Helpers
|
58
|
+
app.helpers Sinatra::UrlForHelper
|
53
59
|
|
54
60
|
app.get '/auth/github/callback' do
|
55
61
|
authenticate!
|
56
|
-
redirect
|
62
|
+
redirect _relative_url_for('/')
|
57
63
|
end
|
58
64
|
end
|
59
65
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sinatra_auth_github
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 17
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 7
|
10
|
+
version: 0.0.7
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Corey Donohoe
|