authpwn_rails 0.17.0 → 0.17.1
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.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/authpwn_rails.gemspec +2 -2
- data/lib/authpwn_rails/generators/templates/session_controller_test.rb +10 -0
- data/lib/authpwn_rails/user_extensions/password_field.rb +1 -1
- data/lib/authpwn_rails/user_model.rb +3 -2
- data/test/user_extensions/password_field_test.rb +13 -8
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 32109345928f563a79ad4bcf0eb49d53012a0ee9
|
4
|
+
data.tar.gz: 23a263174be62eb9853a7a74aea220156c319cd9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c1fe2c3cbc72389b9d776c54a081e90b09bb988f7bc24bfe9efcba25372372b61e1788a02e88f8cd4ac9f8e2079228cf22c2cd2513ba935cf5a1eb084c61f569
|
7
|
+
data.tar.gz: 7033ce674a9e6e87dcb8c6c693d80677e12f4c96cc0a9b397814ac7745313af7bf0e85dda9138645f4f3f044b62e9b33cfe5a9cf8e2968446a8d802ca524c12e
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.17.
|
1
|
+
0.17.1
|
data/authpwn_rails.gemspec
CHANGED
@@ -2,11 +2,11 @@
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
3
|
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
|
-
# stub: authpwn_rails 0.17.
|
5
|
+
# stub: authpwn_rails 0.17.1 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "authpwn_rails"
|
9
|
-
s.version = "0.17.
|
9
|
+
s.version = "0.17.1"
|
10
10
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
12
12
|
s.require_paths = ["lib"]
|
@@ -140,4 +140,14 @@ class SessionControllerTest < ActionController::TestCase
|
|
140
140
|
assert_nil Tokens::Base.with_code(old_token.code).first,
|
141
141
|
'old session not purged'
|
142
142
|
end
|
143
|
+
|
144
|
+
test "OmniAuth login via developer strategy and new account" do
|
145
|
+
request.env['omniauth.auth'] = {
|
146
|
+
'provider' => @omniauth_credential.provider,
|
147
|
+
'uid' => 'new_user_gmail_com_uid',
|
148
|
+
'info' => { 'email' => 'new_user@gmail.com' } }
|
149
|
+
post :omniauth, provider: @omniauth_credential.provider
|
150
|
+
assert_not_nil session_current_user, 'session'
|
151
|
+
assert_redirected_to session_url
|
152
|
+
end
|
143
153
|
end
|
@@ -94,8 +94,9 @@ module UserModel
|
|
94
94
|
def create_from_omniauth(omniauth_hash)
|
95
95
|
info_hash = omniauth_hash['info']
|
96
96
|
return nil unless email = info_hash && info_hash['email']
|
97
|
-
user = User.
|
98
|
-
Credentials::Email.
|
97
|
+
user = User.new
|
98
|
+
user.credentials << Credentials::Email.new(email: email, verified: true)
|
99
|
+
user.save!
|
99
100
|
user
|
100
101
|
end
|
101
102
|
end # module Authpwn::UserModel::ClassMethods
|
@@ -8,31 +8,36 @@ class PasswordFieldTest < ActiveSupport::TestCase
|
|
8
8
|
def setup
|
9
9
|
@user = UserWithPassword.new password: 'awesome',
|
10
10
|
password_confirmation: 'awesome'
|
11
|
-
|
11
|
+
|
12
12
|
@john = UserWithPassword.find_by_id(users(:john).id)
|
13
13
|
@jane = UserWithPassword.find_by_id(users(:jane).id)
|
14
14
|
@bill = UserWithPassword.find_by_id(users(:bill).id)
|
15
15
|
end
|
16
|
-
|
16
|
+
|
17
17
|
test 'setup' do
|
18
18
|
assert @user.valid?
|
19
19
|
end
|
20
|
-
|
21
|
-
test 'password
|
22
|
-
|
20
|
+
|
21
|
+
test 'password can be missing for non-password logins' do
|
22
|
+
user = UserWithPassword.new
|
23
|
+
assert user.valid?
|
24
|
+
end
|
25
|
+
|
26
|
+
test 'password cannot be empty' do
|
27
|
+
@user.password = @user.password_confirmation = ''
|
23
28
|
assert !@user.valid?
|
24
29
|
end
|
25
|
-
|
30
|
+
|
26
31
|
test 'password assumed ok for existing records' do
|
27
32
|
@john.save!
|
28
33
|
assert @john.valid?
|
29
34
|
end
|
30
|
-
|
35
|
+
|
31
36
|
test 'password confirmation' do
|
32
37
|
@user.password_confirmation = 'not awesome'
|
33
38
|
assert !@user.valid?
|
34
39
|
end
|
35
|
-
|
40
|
+
|
36
41
|
test 'password_credential' do
|
37
42
|
assert_equal credentials(:john_password), @john.password_credential
|
38
43
|
assert_equal credentials(:jane_password), @jane.password_credential
|