reviewed-auth 0.1.2 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/reviewed-auth/login_controller.rb +10 -3
- data/lib/reviewed-auth/version.rb +1 -1
- data/lib/reviewed-auth/views/login_form.erb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0c297110edbef5b07508b8655361f83f42113ecb
|
4
|
+
data.tar.gz: c1f956ccfd45329829903f0b5763c71a93742134
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7ca96b969472dcc558c8d71f211e023a5ca036728dba1d7cd29605b2e3214322386f35fe10b5e00d9c27fb4a91b04ef0b076626fc6a551352ce4908d643085eb
|
7
|
+
data.tar.gz: 4121b8dec3b1d8fe8052faafffe164ae73cfe15e2e3c0603a210b28b1fa31d4605a7d2ddd7e9389543a8ee074fe85d07e5e906b286c79fb332b316193f32cba0
|
@@ -2,6 +2,7 @@ require 'sinatra/twitter-bootstrap'
|
|
2
2
|
require 'faraday'
|
3
3
|
require 'json'
|
4
4
|
require 'uri'
|
5
|
+
require 'cgi'
|
5
6
|
|
6
7
|
module Reviewed
|
7
8
|
module Auth
|
@@ -24,7 +25,7 @@ module Reviewed
|
|
24
25
|
|
25
26
|
get "/" do
|
26
27
|
response.delete_cookie(:_reviewed_token)
|
27
|
-
erb :login_form
|
28
|
+
erb :login_form, locals: {return_to_url: return_to_url(params)}
|
28
29
|
end
|
29
30
|
|
30
31
|
post "/" do
|
@@ -37,7 +38,7 @@ module Reviewed
|
|
37
38
|
response.set_cookie(:_reviewed_token, value: @user.token, path: "/", expires: Time.now + (60 * 60 * 24 * 7))
|
38
39
|
end
|
39
40
|
if params[:return_url] != ""
|
40
|
-
url = params[:return_url]
|
41
|
+
url = CGI.unescape(params[:return_url])
|
41
42
|
if params[:drop_cookie] != "true"
|
42
43
|
if url.match(/\?/)
|
43
44
|
url += "&_reviewed_token=#{@user.token}"
|
@@ -56,6 +57,12 @@ module Reviewed
|
|
56
57
|
end
|
57
58
|
end
|
58
59
|
|
60
|
+
def return_to_url(params)
|
61
|
+
uri = URI(params['return_url'])
|
62
|
+
uri_params = params.reject { |k, v| k == 'return_url' }
|
63
|
+
uri.query = ::URI.encode_www_form(uri_params)
|
64
|
+
return ::CGI.escape(uri.to_s)
|
65
|
+
end
|
59
66
|
end
|
60
67
|
end
|
61
|
-
end
|
68
|
+
end
|
@@ -66,7 +66,7 @@
|
|
66
66
|
<form class="form-signin" method="post">
|
67
67
|
<h1>Reviewed.com</h1>
|
68
68
|
<h2 class="form-signin-heading">Please sign in</h2>
|
69
|
-
<input type="hidden" name="return_url" value="<%=
|
69
|
+
<input type="hidden" name="return_url" value="<%= return_to_url || Reviewed::Auth.return_url %>" />
|
70
70
|
<input type="hidden" name="drop_cookie" value="<%= params[:drop_cookie] || Reviewed::Auth.drop_cookie %>" />
|
71
71
|
<input type="text" class="input-block-level" placeholder="Email address" name="email">
|
72
72
|
<input type="password" class="input-block-level" placeholder="Password" name="password">
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: reviewed-auth
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mark Bates
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-09-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sinatra
|
@@ -105,7 +105,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
105
105
|
version: '0'
|
106
106
|
requirements: []
|
107
107
|
rubyforge_project:
|
108
|
-
rubygems_version: 2.0.
|
108
|
+
rubygems_version: 2.0.2
|
109
109
|
signing_key:
|
110
110
|
specification_version: 4
|
111
111
|
summary: Central Authentication Service for Reviewed.com
|