authpwn_rails 0.10.4 → 0.10.5
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 +1 -1
- data/Gemfile.lock +40 -42
- data/VERSION +1 -1
- data/authpwn_rails.gemspec +6 -6
- data/lib/authpwn_rails/credential_model.rb +0 -6
- data/lib/authpwn_rails/session_controller.rb +76 -80
- data/lib/authpwn_rails/user_extensions/email_field.rb +22 -24
- data/lib/authpwn_rails/user_extensions/facebook_fields.rb +26 -28
- data/lib/authpwn_rails/user_extensions/password_field.rb +40 -42
- data/lib/authpwn_rails/user_model.rb +17 -20
- metadata +19 -19
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
|
@@ -1,36 +1,35 @@
|
|
|
1
1
|
GEM
|
|
2
2
|
remote: http://rubygems.org/
|
|
3
3
|
specs:
|
|
4
|
-
actionmailer (3.
|
|
5
|
-
actionpack (= 3.
|
|
4
|
+
actionmailer (3.2.0.rc2)
|
|
5
|
+
actionpack (= 3.2.0.rc2)
|
|
6
6
|
mail (~> 2.3.0)
|
|
7
|
-
actionpack (3.
|
|
8
|
-
activemodel (= 3.
|
|
9
|
-
activesupport (= 3.
|
|
7
|
+
actionpack (3.2.0.rc2)
|
|
8
|
+
activemodel (= 3.2.0.rc2)
|
|
9
|
+
activesupport (= 3.2.0.rc2)
|
|
10
10
|
builder (~> 3.0.0)
|
|
11
11
|
erubis (~> 2.7.0)
|
|
12
|
-
|
|
13
|
-
rack (~> 1.
|
|
12
|
+
journey (~> 1.0.0.rc1)
|
|
13
|
+
rack (~> 1.4.0)
|
|
14
14
|
rack-cache (~> 1.1)
|
|
15
|
-
rack-mount (~> 0.8.2)
|
|
16
15
|
rack-test (~> 0.6.1)
|
|
17
|
-
sprockets (~> 2.
|
|
18
|
-
activemodel (3.
|
|
19
|
-
activesupport (= 3.
|
|
16
|
+
sprockets (~> 2.1.2)
|
|
17
|
+
activemodel (3.2.0.rc2)
|
|
18
|
+
activesupport (= 3.2.0.rc2)
|
|
20
19
|
builder (~> 3.0.0)
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
arel (~> 2.2.1)
|
|
20
|
+
activerecord (3.2.0.rc2)
|
|
21
|
+
activemodel (= 3.2.0.rc2)
|
|
22
|
+
activesupport (= 3.2.0.rc2)
|
|
23
|
+
arel (~> 3.0.0.rc1)
|
|
26
24
|
tzinfo (~> 0.3.29)
|
|
27
|
-
activeresource (3.
|
|
28
|
-
activemodel (= 3.
|
|
29
|
-
activesupport (= 3.
|
|
30
|
-
activesupport (3.
|
|
25
|
+
activeresource (3.2.0.rc2)
|
|
26
|
+
activemodel (= 3.2.0.rc2)
|
|
27
|
+
activesupport (= 3.2.0.rc2)
|
|
28
|
+
activesupport (3.2.0.rc2)
|
|
29
|
+
i18n (~> 0.6)
|
|
31
30
|
multi_json (~> 1.0)
|
|
32
31
|
addressable (2.2.6)
|
|
33
|
-
arel (
|
|
32
|
+
arel (3.0.0.rc1)
|
|
34
33
|
builder (3.0.0)
|
|
35
34
|
erubis (2.7.0)
|
|
36
35
|
faraday (0.7.5)
|
|
@@ -60,7 +59,8 @@ GEM
|
|
|
60
59
|
bundler (~> 1.0)
|
|
61
60
|
git (>= 1.2.5)
|
|
62
61
|
rake
|
|
63
|
-
|
|
62
|
+
journey (1.0.0.rc4)
|
|
63
|
+
json (1.6.4)
|
|
64
64
|
mail (2.3.0)
|
|
65
65
|
i18n (>= 0.4.0)
|
|
66
66
|
mime-types (~> 1.16)
|
|
@@ -68,45 +68,43 @@ GEM
|
|
|
68
68
|
mime-types (1.17.2)
|
|
69
69
|
multi_json (1.0.4)
|
|
70
70
|
multipart-post (1.1.4)
|
|
71
|
-
oauth2 (0.5.
|
|
72
|
-
faraday (~> 0.7
|
|
73
|
-
multi_json (~> 1.0
|
|
71
|
+
oauth2 (0.5.2)
|
|
72
|
+
faraday (~> 0.7)
|
|
73
|
+
multi_json (~> 1.0)
|
|
74
74
|
polyglot (0.3.3)
|
|
75
|
-
rack (1.
|
|
75
|
+
rack (1.4.0)
|
|
76
76
|
rack-cache (1.1)
|
|
77
77
|
rack (>= 0.4)
|
|
78
|
-
rack-mount (0.8.3)
|
|
79
|
-
rack (>= 1.0.0)
|
|
80
78
|
rack-ssl (1.3.2)
|
|
81
79
|
rack
|
|
82
80
|
rack-test (0.6.1)
|
|
83
81
|
rack (>= 1.0)
|
|
84
|
-
rails (3.
|
|
85
|
-
actionmailer (= 3.
|
|
86
|
-
actionpack (= 3.
|
|
87
|
-
activerecord (= 3.
|
|
88
|
-
activeresource (= 3.
|
|
89
|
-
activesupport (= 3.
|
|
82
|
+
rails (3.2.0.rc2)
|
|
83
|
+
actionmailer (= 3.2.0.rc2)
|
|
84
|
+
actionpack (= 3.2.0.rc2)
|
|
85
|
+
activerecord (= 3.2.0.rc2)
|
|
86
|
+
activeresource (= 3.2.0.rc2)
|
|
87
|
+
activesupport (= 3.2.0.rc2)
|
|
90
88
|
bundler (~> 1.0)
|
|
91
|
-
railties (= 3.
|
|
92
|
-
railties (3.
|
|
93
|
-
actionpack (= 3.
|
|
94
|
-
activesupport (= 3.
|
|
89
|
+
railties (= 3.2.0.rc2)
|
|
90
|
+
railties (3.2.0.rc2)
|
|
91
|
+
actionpack (= 3.2.0.rc2)
|
|
92
|
+
activesupport (= 3.2.0.rc2)
|
|
95
93
|
rack-ssl (~> 1.3.2)
|
|
96
94
|
rake (>= 0.8.7)
|
|
97
95
|
rdoc (~> 3.4)
|
|
98
96
|
thor (~> 0.14.6)
|
|
99
97
|
rake (0.9.2.2)
|
|
100
98
|
rcov (0.9.11)
|
|
101
|
-
rdoc (3.
|
|
99
|
+
rdoc (3.12)
|
|
102
100
|
json (~> 1.4)
|
|
103
101
|
rest-client (1.6.7)
|
|
104
102
|
mime-types (>= 1.16)
|
|
105
|
-
sprockets (2.
|
|
103
|
+
sprockets (2.1.2)
|
|
106
104
|
hike (~> 1.2)
|
|
107
105
|
rack (~> 1.0)
|
|
108
106
|
tilt (~> 1.1, != 1.3.0)
|
|
109
|
-
sqlite3 (1.3.
|
|
107
|
+
sqlite3 (1.3.5)
|
|
110
108
|
thor (0.14.6)
|
|
111
109
|
tilt (1.3.3)
|
|
112
110
|
treetop (1.4.10)
|
|
@@ -122,6 +120,6 @@ DEPENDENCIES
|
|
|
122
120
|
fbgraph_rails (>= 0.2.2)
|
|
123
121
|
flexmock (~> 0.9.0)
|
|
124
122
|
jeweler (~> 1.6.0)
|
|
125
|
-
rails (>= 3.
|
|
123
|
+
rails (>= 3.2.0.rc2)
|
|
126
124
|
rcov
|
|
127
125
|
sqlite3 (>= 1.3.3)
|
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.10.
|
|
1
|
+
0.10.5
|
data/authpwn_rails.gemspec
CHANGED
|
@@ -5,11 +5,11 @@
|
|
|
5
5
|
|
|
6
6
|
Gem::Specification.new do |s|
|
|
7
7
|
s.name = "authpwn_rails"
|
|
8
|
-
s.version = "0.10.
|
|
8
|
+
s.version = "0.10.5"
|
|
9
9
|
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
|
11
11
|
s.authors = ["Victor Costan"]
|
|
12
|
-
s.date = "
|
|
12
|
+
s.date = "2012-01-07"
|
|
13
13
|
s.description = "Works with Facebook."
|
|
14
14
|
s.email = "victor@costan.us"
|
|
15
15
|
s.extra_rdoc_files = [
|
|
@@ -77,7 +77,7 @@ Gem::Specification.new do |s|
|
|
|
77
77
|
s.homepage = "http://github.com/pwnall/authpwn_rails"
|
|
78
78
|
s.licenses = ["MIT"]
|
|
79
79
|
s.require_paths = ["lib"]
|
|
80
|
-
s.rubygems_version = "1.8.
|
|
80
|
+
s.rubygems_version = "1.8.15"
|
|
81
81
|
s.summary = "User authentication for Rails 3 applications."
|
|
82
82
|
|
|
83
83
|
if s.respond_to? :specification_version then
|
|
@@ -85,7 +85,7 @@ Gem::Specification.new do |s|
|
|
|
85
85
|
|
|
86
86
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
|
87
87
|
s.add_runtime_dependency(%q<fbgraph_rails>, [">= 0.2.2"])
|
|
88
|
-
s.add_runtime_dependency(%q<rails>, [">= 3.
|
|
88
|
+
s.add_runtime_dependency(%q<rails>, [">= 3.2.0.rc2"])
|
|
89
89
|
s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
|
|
90
90
|
s.add_development_dependency(%q<flexmock>, ["~> 0.9.0"])
|
|
91
91
|
s.add_development_dependency(%q<jeweler>, ["~> 1.6.0"])
|
|
@@ -93,7 +93,7 @@ Gem::Specification.new do |s|
|
|
|
93
93
|
s.add_development_dependency(%q<sqlite3>, [">= 1.3.3"])
|
|
94
94
|
else
|
|
95
95
|
s.add_dependency(%q<fbgraph_rails>, [">= 0.2.2"])
|
|
96
|
-
s.add_dependency(%q<rails>, [">= 3.
|
|
96
|
+
s.add_dependency(%q<rails>, [">= 3.2.0.rc2"])
|
|
97
97
|
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
|
98
98
|
s.add_dependency(%q<flexmock>, ["~> 0.9.0"])
|
|
99
99
|
s.add_dependency(%q<jeweler>, ["~> 1.6.0"])
|
|
@@ -102,7 +102,7 @@ Gem::Specification.new do |s|
|
|
|
102
102
|
end
|
|
103
103
|
else
|
|
104
104
|
s.add_dependency(%q<fbgraph_rails>, [">= 0.2.2"])
|
|
105
|
-
s.add_dependency(%q<rails>, [">= 3.
|
|
105
|
+
s.add_dependency(%q<rails>, [">= 3.2.0.rc2"])
|
|
106
106
|
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
|
107
107
|
s.add_dependency(%q<flexmock>, ["~> 0.9.0"])
|
|
108
108
|
s.add_dependency(%q<jeweler>, ["~> 1.6.0"])
|
|
@@ -27,12 +27,6 @@ module CredentialModel
|
|
|
27
27
|
|
|
28
28
|
end # module Authpwn::FacebookTokenModel::ClassMethods
|
|
29
29
|
|
|
30
|
-
|
|
31
|
-
# Included in models that include Authpwn::FacebookTokenModel.
|
|
32
|
-
module InstanceMethods
|
|
33
|
-
|
|
34
|
-
end # module Authpwn::FacebookTokenModel::InstanceMethods
|
|
35
|
-
|
|
36
30
|
end # namespace Authpwn::FacebookTokenModel
|
|
37
31
|
|
|
38
32
|
end # namespace Authpwn
|
|
@@ -14,101 +14,97 @@ module SessionController
|
|
|
14
14
|
authenticates_using_session
|
|
15
15
|
end
|
|
16
16
|
|
|
17
|
-
#
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
format.html { render :action => :welcome }
|
|
34
|
-
format.json { render :json => {} }
|
|
35
|
-
end
|
|
36
|
-
end
|
|
37
|
-
else
|
|
38
|
-
home
|
|
39
|
-
unless performed?
|
|
40
|
-
respond_to do |format|
|
|
41
|
-
format.html { render :action => :home }
|
|
42
|
-
format.json do
|
|
43
|
-
user_data = @user.as_json
|
|
44
|
-
user_data = user_data['user'] if @user.class.include_root_in_json
|
|
45
|
-
render :json => { :user => user_data,
|
|
46
|
-
:csrf => form_authenticity_token }
|
|
47
|
-
end
|
|
48
|
-
end
|
|
17
|
+
# GET /session/new
|
|
18
|
+
def new
|
|
19
|
+
@email = params[:email]
|
|
20
|
+
@redirect_url = flash[:auth_redirect_url]
|
|
21
|
+
redirect_to session_url if current_user
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
# GET /session
|
|
25
|
+
def show
|
|
26
|
+
@user = current_user || User.new
|
|
27
|
+
if @user.new_record?
|
|
28
|
+
welcome
|
|
29
|
+
unless performed?
|
|
30
|
+
respond_to do |format|
|
|
31
|
+
format.html { render :action => :welcome }
|
|
32
|
+
format.json { render :json => {} }
|
|
49
33
|
end
|
|
50
34
|
end
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
@email = params[:email]
|
|
57
|
-
auth = Credentials::Password.authenticate_email @email, params[:password]
|
|
58
|
-
self.current_user = auth unless auth.kind_of? Symbol
|
|
59
|
-
|
|
60
|
-
respond_to do |format|
|
|
61
|
-
if current_user
|
|
62
|
-
format.html { redirect_to @redirect_url }
|
|
35
|
+
else
|
|
36
|
+
home
|
|
37
|
+
unless performed?
|
|
38
|
+
respond_to do |format|
|
|
39
|
+
format.html { render :action => :home }
|
|
63
40
|
format.json do
|
|
64
|
-
user_data =
|
|
65
|
-
if
|
|
66
|
-
user_data = user_data['user']
|
|
67
|
-
end
|
|
41
|
+
user_data = @user.as_json
|
|
42
|
+
user_data = user_data['user'] if @user.class.include_root_in_json
|
|
68
43
|
render :json => { :user => user_data,
|
|
69
44
|
:csrf => form_authenticity_token }
|
|
70
45
|
end
|
|
71
|
-
else
|
|
72
|
-
notice = bounce_notice_text auth
|
|
73
|
-
format.html do
|
|
74
|
-
redirect_to new_session_url, :flash => { :notice => notice,
|
|
75
|
-
:auth_redirect_url => @redirect_url }
|
|
76
|
-
end
|
|
77
|
-
format.json { render :json => { :error => auth, :text => notice } }
|
|
78
46
|
end
|
|
79
47
|
end
|
|
80
48
|
end
|
|
49
|
+
end
|
|
81
50
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
51
|
+
# POST /session
|
|
52
|
+
def create
|
|
53
|
+
@redirect_url = params[:redirect_url] || session_url
|
|
54
|
+
@email = params[:email]
|
|
55
|
+
auth = Credentials::Password.authenticate_email @email, params[:password]
|
|
56
|
+
self.current_user = auth unless auth.kind_of? Symbol
|
|
57
|
+
|
|
58
|
+
respond_to do |format|
|
|
59
|
+
if current_user
|
|
60
|
+
format.html { redirect_to @redirect_url }
|
|
61
|
+
format.json do
|
|
62
|
+
user_data = current_user.as_json
|
|
63
|
+
if current_user.class.include_root_in_json
|
|
64
|
+
user_data = user_data['user']
|
|
65
|
+
end
|
|
66
|
+
render :json => { :user => user_data,
|
|
67
|
+
:csrf => form_authenticity_token }
|
|
68
|
+
end
|
|
69
|
+
else
|
|
70
|
+
notice = bounce_notice_text auth
|
|
71
|
+
format.html do
|
|
72
|
+
redirect_to new_session_url, :flash => { :notice => notice,
|
|
73
|
+
:auth_redirect_url => @redirect_url }
|
|
74
|
+
end
|
|
75
|
+
format.json { render :json => { :error => auth, :text => notice } }
|
|
88
76
|
end
|
|
89
77
|
end
|
|
90
|
-
|
|
91
|
-
# Hook for setting up the home view.
|
|
92
|
-
def home
|
|
93
|
-
end
|
|
94
|
-
private :home
|
|
95
|
-
|
|
96
|
-
# Hook for setting up the welcome view.
|
|
97
|
-
def welcome
|
|
98
|
-
end
|
|
99
|
-
private :welcome
|
|
78
|
+
end
|
|
100
79
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
'Account blocked. Please verify your e-mail address'
|
|
108
|
-
end
|
|
80
|
+
# DELETE /session
|
|
81
|
+
def destroy
|
|
82
|
+
self.current_user = nil
|
|
83
|
+
respond_to do |format|
|
|
84
|
+
format.html { redirect_to session_url }
|
|
85
|
+
format.json { head :ok }
|
|
109
86
|
end
|
|
110
|
-
end
|
|
87
|
+
end
|
|
111
88
|
|
|
89
|
+
# Hook for setting up the home view.
|
|
90
|
+
def home
|
|
91
|
+
end
|
|
92
|
+
private :home
|
|
93
|
+
|
|
94
|
+
# Hook for setting up the welcome view.
|
|
95
|
+
def welcome
|
|
96
|
+
end
|
|
97
|
+
private :welcome
|
|
98
|
+
|
|
99
|
+
# Hook for customizing the bounce notification text.
|
|
100
|
+
def bounce_notice_text(reason)
|
|
101
|
+
case reason
|
|
102
|
+
when :invalid
|
|
103
|
+
'Invalid e-mail or password'
|
|
104
|
+
when :blocked
|
|
105
|
+
'Account blocked. Please verify your e-mail address'
|
|
106
|
+
end
|
|
107
|
+
end
|
|
112
108
|
end # module Authpwn::SessionController
|
|
113
109
|
|
|
114
110
|
end # namespace Authpwn
|
|
@@ -25,31 +25,29 @@ module EmailField
|
|
|
25
25
|
end
|
|
26
26
|
end
|
|
27
27
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
credentials << Credentials::Email.new(:email => new_email)
|
|
50
|
-
end
|
|
51
|
-
new_email
|
|
28
|
+
# Credentials::Email instance associated with this user.
|
|
29
|
+
def email_credential
|
|
30
|
+
credentials.find { |c| c.instance_of?(Credentials::Email) }
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
# The e-mail from the user's Email credential.
|
|
34
|
+
#
|
|
35
|
+
# Returns nil if this user has no Email credential.
|
|
36
|
+
def email
|
|
37
|
+
credential = self.email_credential
|
|
38
|
+
credential && credential.email
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
# Sets the e-mail on the user's Email credential.
|
|
42
|
+
#
|
|
43
|
+
# Creates a new Credentials::Email instance if necessary.
|
|
44
|
+
def email=(new_email)
|
|
45
|
+
if credential = self.email_credential
|
|
46
|
+
credential.email = new_email
|
|
47
|
+
else
|
|
48
|
+
credentials << Credentials::Email.new(:email => new_email)
|
|
52
49
|
end
|
|
50
|
+
new_email
|
|
53
51
|
end
|
|
54
52
|
end # module Authpwn::UserExtensions::EmailField
|
|
55
53
|
|
|
@@ -28,35 +28,33 @@ module FacebookFields
|
|
|
28
28
|
end
|
|
29
29
|
end
|
|
30
30
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
end
|
|
31
|
+
# Credentials::Facebook instance associated with this user.
|
|
32
|
+
def facebook_credential
|
|
33
|
+
credentials.find { |c| c.instance_of?(Credentials::Facebook) }
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
# FBGraph client loaded with this access token.
|
|
37
|
+
#
|
|
38
|
+
# Returns nil if this user has no Facebook credential.
|
|
39
|
+
def facebook_client
|
|
40
|
+
credential = self.facebook_credential
|
|
41
|
+
credential && credential.facebook_client
|
|
42
|
+
end
|
|
44
43
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
end
|
|
44
|
+
# The facebook user ID from the user's Facebook credential.
|
|
45
|
+
#
|
|
46
|
+
# Returns nil if this user has no Facebook credential.
|
|
47
|
+
def facebook_uid
|
|
48
|
+
credential = self.facebook_credential
|
|
49
|
+
credential && credential.facebook_uid
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
# The facebook OAuth2 access token from the user's Facebook credential.
|
|
53
|
+
#
|
|
54
|
+
# Returns nil if this user has no Facebook credential.
|
|
55
|
+
def facebook_access_token
|
|
56
|
+
credential = self.facebook_credential
|
|
57
|
+
credential && credential.access_token
|
|
60
58
|
end
|
|
61
59
|
end # module Authpwn::UserExtensions::FacebookFields
|
|
62
60
|
|
|
@@ -25,52 +25,50 @@ module PasswordField
|
|
|
25
25
|
end
|
|
26
26
|
end
|
|
27
27
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
end
|
|
28
|
+
# Credentials::Password instance associated with this user.
|
|
29
|
+
def password_credential
|
|
30
|
+
credentials.find { |c| c.instance_of?(Credentials::Password) }
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
# The password from the user's Password credential, or nil.
|
|
34
|
+
#
|
|
35
|
+
# Returns nil if this user has no Password credential.
|
|
36
|
+
def password
|
|
37
|
+
credential = self.password_credential
|
|
38
|
+
credential && credential.password
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
# The password_confirmation from the user's Password credential, or nil.
|
|
42
|
+
#
|
|
43
|
+
# Returns nil if this user has no Password credential.
|
|
44
|
+
def password_confirmation
|
|
45
|
+
credential = self.password_credential
|
|
46
|
+
credential && credential.password_confirmation
|
|
47
|
+
end
|
|
49
48
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
end
|
|
59
|
-
new_password
|
|
49
|
+
# Sets the password on the user's Password credential.
|
|
50
|
+
#
|
|
51
|
+
# Creates a new Credentials::Password instance if necessary.
|
|
52
|
+
def password=(new_password)
|
|
53
|
+
if credential = self.password_credential
|
|
54
|
+
credential.password = new_password
|
|
55
|
+
else
|
|
56
|
+
credentials << Credentials::Password.new(:password => new_password)
|
|
60
57
|
end
|
|
58
|
+
new_password
|
|
59
|
+
end
|
|
61
60
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
end
|
|
72
|
-
new_password_confirmation
|
|
61
|
+
# Sets the password on the user's Password credential.
|
|
62
|
+
#
|
|
63
|
+
# Creates a new Credentials::Password instance if necessary.
|
|
64
|
+
def password_confirmation=(new_password_confirmation)
|
|
65
|
+
if credential = self.password_credential
|
|
66
|
+
credential.password_confirmation = new_password_confirmation
|
|
67
|
+
else
|
|
68
|
+
credentials << Credentials::Password.new(:password_confirmation =>
|
|
69
|
+
new_password_confirmation)
|
|
73
70
|
end
|
|
71
|
+
new_password_confirmation
|
|
74
72
|
end
|
|
75
73
|
end # module Authpwn::UserExtensions::PasswordField
|
|
76
74
|
|
|
@@ -40,26 +40,23 @@ module UserModel
|
|
|
40
40
|
end
|
|
41
41
|
end # module Authpwn::UserModel::ClassMethods
|
|
42
42
|
|
|
43
|
-
#
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
self.exuid ||= (Time.now.to_f * 1_000_000).to_i
|
|
61
|
-
end
|
|
62
|
-
end # module Authpwn::UserModel::InstanceMethods
|
|
43
|
+
# Checks if a credential is acceptable for authenticating a user.
|
|
44
|
+
#
|
|
45
|
+
# Returns nil if the credential is acceptable, or a String containing a
|
|
46
|
+
# user-visible reason why the credential is not acceptable.
|
|
47
|
+
def auth_bounce_reason(crdential)
|
|
48
|
+
nil
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
# Use e-mails instead of exposing ActiveRecord IDs.
|
|
52
|
+
def to_param
|
|
53
|
+
exuid
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
# :nodoc: sets exuid to a (hopefully) unique value before validations occur.
|
|
57
|
+
def set_default_exuid
|
|
58
|
+
self.exuid ||= (Time.now.to_f * 1_000_000).to_i
|
|
59
|
+
end
|
|
63
60
|
end # namespace Authpwn::UserModel
|
|
64
61
|
|
|
65
62
|
end # namespace Authpwn
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: authpwn_rails
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.10.
|
|
4
|
+
version: 0.10.5
|
|
5
5
|
prerelease:
|
|
6
6
|
platform: ruby
|
|
7
7
|
authors:
|
|
@@ -9,11 +9,11 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date:
|
|
12
|
+
date: 2012-01-07 00:00:00.000000000Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: fbgraph_rails
|
|
16
|
-
requirement: &
|
|
16
|
+
requirement: &70264140435420 !ruby/object:Gem::Requirement
|
|
17
17
|
none: false
|
|
18
18
|
requirements:
|
|
19
19
|
- - ! '>='
|
|
@@ -21,21 +21,21 @@ dependencies:
|
|
|
21
21
|
version: 0.2.2
|
|
22
22
|
type: :runtime
|
|
23
23
|
prerelease: false
|
|
24
|
-
version_requirements: *
|
|
24
|
+
version_requirements: *70264140435420
|
|
25
25
|
- !ruby/object:Gem::Dependency
|
|
26
26
|
name: rails
|
|
27
|
-
requirement: &
|
|
27
|
+
requirement: &70264140434940 !ruby/object:Gem::Requirement
|
|
28
28
|
none: false
|
|
29
29
|
requirements:
|
|
30
30
|
- - ! '>='
|
|
31
31
|
- !ruby/object:Gem::Version
|
|
32
|
-
version: 3.
|
|
32
|
+
version: 3.2.0.rc2
|
|
33
33
|
type: :runtime
|
|
34
34
|
prerelease: false
|
|
35
|
-
version_requirements: *
|
|
35
|
+
version_requirements: *70264140434940
|
|
36
36
|
- !ruby/object:Gem::Dependency
|
|
37
37
|
name: bundler
|
|
38
|
-
requirement: &
|
|
38
|
+
requirement: &70264140434460 !ruby/object:Gem::Requirement
|
|
39
39
|
none: false
|
|
40
40
|
requirements:
|
|
41
41
|
- - ~>
|
|
@@ -43,10 +43,10 @@ dependencies:
|
|
|
43
43
|
version: 1.0.0
|
|
44
44
|
type: :development
|
|
45
45
|
prerelease: false
|
|
46
|
-
version_requirements: *
|
|
46
|
+
version_requirements: *70264140434460
|
|
47
47
|
- !ruby/object:Gem::Dependency
|
|
48
48
|
name: flexmock
|
|
49
|
-
requirement: &
|
|
49
|
+
requirement: &70264140433980 !ruby/object:Gem::Requirement
|
|
50
50
|
none: false
|
|
51
51
|
requirements:
|
|
52
52
|
- - ~>
|
|
@@ -54,10 +54,10 @@ dependencies:
|
|
|
54
54
|
version: 0.9.0
|
|
55
55
|
type: :development
|
|
56
56
|
prerelease: false
|
|
57
|
-
version_requirements: *
|
|
57
|
+
version_requirements: *70264140433980
|
|
58
58
|
- !ruby/object:Gem::Dependency
|
|
59
59
|
name: jeweler
|
|
60
|
-
requirement: &
|
|
60
|
+
requirement: &70264140433480 !ruby/object:Gem::Requirement
|
|
61
61
|
none: false
|
|
62
62
|
requirements:
|
|
63
63
|
- - ~>
|
|
@@ -65,10 +65,10 @@ dependencies:
|
|
|
65
65
|
version: 1.6.0
|
|
66
66
|
type: :development
|
|
67
67
|
prerelease: false
|
|
68
|
-
version_requirements: *
|
|
68
|
+
version_requirements: *70264140433480
|
|
69
69
|
- !ruby/object:Gem::Dependency
|
|
70
70
|
name: rcov
|
|
71
|
-
requirement: &
|
|
71
|
+
requirement: &70264140432920 !ruby/object:Gem::Requirement
|
|
72
72
|
none: false
|
|
73
73
|
requirements:
|
|
74
74
|
- - ! '>='
|
|
@@ -76,10 +76,10 @@ dependencies:
|
|
|
76
76
|
version: '0'
|
|
77
77
|
type: :development
|
|
78
78
|
prerelease: false
|
|
79
|
-
version_requirements: *
|
|
79
|
+
version_requirements: *70264140432920
|
|
80
80
|
- !ruby/object:Gem::Dependency
|
|
81
81
|
name: sqlite3
|
|
82
|
-
requirement: &
|
|
82
|
+
requirement: &70264140432360 !ruby/object:Gem::Requirement
|
|
83
83
|
none: false
|
|
84
84
|
requirements:
|
|
85
85
|
- - ! '>='
|
|
@@ -87,7 +87,7 @@ dependencies:
|
|
|
87
87
|
version: 1.3.3
|
|
88
88
|
type: :development
|
|
89
89
|
prerelease: false
|
|
90
|
-
version_requirements: *
|
|
90
|
+
version_requirements: *70264140432360
|
|
91
91
|
description: Works with Facebook.
|
|
92
92
|
email: victor@costan.us
|
|
93
93
|
executables: []
|
|
@@ -167,7 +167,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
167
167
|
version: '0'
|
|
168
168
|
segments:
|
|
169
169
|
- 0
|
|
170
|
-
hash: -
|
|
170
|
+
hash: -981791370261009307
|
|
171
171
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
172
172
|
none: false
|
|
173
173
|
requirements:
|
|
@@ -176,7 +176,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
176
176
|
version: '0'
|
|
177
177
|
requirements: []
|
|
178
178
|
rubyforge_project:
|
|
179
|
-
rubygems_version: 1.8.
|
|
179
|
+
rubygems_version: 1.8.15
|
|
180
180
|
signing_key:
|
|
181
181
|
specification_version: 3
|
|
182
182
|
summary: User authentication for Rails 3 applications.
|