mc-openid 0.0.3 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Gemfile.lock +1 -1
- data/lib/mc-openid.rb +6 -3
- data/lib/mc-openid/version.rb +1 -1
- data/spec/mc-openid_spec.rb +2 -7
- metadata +4 -4
data/Gemfile.lock
CHANGED
data/lib/mc-openid.rb
CHANGED
@@ -6,14 +6,17 @@ module ModCloth
|
|
6
6
|
include ::OpenIdAuthentication
|
7
7
|
|
8
8
|
|
9
|
-
def check_openid
|
10
|
-
open_id_authentication("https://www.google.com/accounts/o8/site-xrds?hd=modcloth.com")
|
9
|
+
def check_openid(routes)
|
10
|
+
open_id_authentication("https://www.google.com/accounts/o8/site-xrds?hd=modcloth.com", routes)
|
11
11
|
end
|
12
12
|
|
13
|
-
def open_id_authentication(openid_url)
|
13
|
+
def open_id_authentication(openid_url, routes)
|
14
14
|
authenticate_with_open_id(openid_url, [{:name => :email, :uri => 'http://axschema.org/contact/email'}]) do |result, identity_url, registration|
|
15
15
|
if result.successful?
|
16
16
|
session[:user_email] = registration.data['http://axschema.org/contact/email'].first
|
17
|
+
redirect_to routes[:success]
|
18
|
+
else
|
19
|
+
redirect_to routes[:fail]
|
17
20
|
end
|
18
21
|
end
|
19
22
|
end
|
data/lib/mc-openid/version.rb
CHANGED
data/spec/mc-openid_spec.rb
CHANGED
@@ -19,16 +19,11 @@ describe ModCloth::OpenID do
|
|
19
19
|
describe "authentication" do
|
20
20
|
it "return successful if open id authentication passes" do
|
21
21
|
open_id_consumer = mock()
|
22
|
+
routes = { :success => '/', :fail => '/'}
|
22
23
|
@controller.stub!(:session).and_return({})
|
23
24
|
@controller.stub!(:open_id_consumer).and_return(open_id_consumer)
|
24
25
|
@controller.stub!(:begin_open_id_authentication).and_return({:user_email => "test@modcloth.com"})
|
25
|
-
@controller.check_openid.should == {:user_email => "test@modcloth.com"}
|
26
|
-
end
|
27
|
-
|
28
|
-
it "return successful if exist a session" do
|
29
|
-
session = {:user_email =>"test@modcloth.com"}
|
30
|
-
@controller.stub!(:session).and_return(session)
|
31
|
-
@controller.check_openid.should == session
|
26
|
+
@controller.check_openid(routes).should == {:user_email => "test@modcloth.com"}
|
32
27
|
end
|
33
28
|
end
|
34
29
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mc-openid
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 23
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 4
|
10
|
+
version: 0.0.4
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Luis Flores, Juan Esparza, Rudy Sombillo, Sergio Figueroa
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-01
|
18
|
+
date: 2011-02-01 00:00:00 -08:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|