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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e9776c5aa80187c9368f044da7036cb46c872e3e
4
- data.tar.gz: 2df0b77fc051007d52ea662efb289bedcbbd6ead
3
+ metadata.gz: 32109345928f563a79ad4bcf0eb49d53012a0ee9
4
+ data.tar.gz: 23a263174be62eb9853a7a74aea220156c319cd9
5
5
  SHA512:
6
- metadata.gz: 3a3c415f26386f64090d662398eee705a573ecf6f10cff87ae754eb3f2e65d26f729e4cc6ac91d494c8f36acc4a560a1520b711b99d933e6609dee2d2c151e26
7
- data.tar.gz: 261ff309c4d7c7b8bc404d13b4fe7da501801f68c2b4881d9fa55a573ef253bb7f54c16106aa17b2d51d6b53d2843887afa1f9b1e0d52bf5752275f8c1561201
6
+ metadata.gz: c1fe2c3cbc72389b9d776c54a081e90b09bb988f7bc24bfe9efcba25372372b61e1788a02e88f8cd4ac9f8e2079228cf22c2cd2513ba935cf5a1eb084c61f569
7
+ data.tar.gz: 7033ce674a9e6e87dcb8c6c693d80677e12f4c96cc0a9b397814ac7745313af7bf0e85dda9138645f4f3f044b62e9b33cfe5a9cf8e2968446a8d802ca524c12e
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.17.0
1
+ 0.17.1
@@ -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.0 ruby lib
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.0"
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
@@ -12,7 +12,7 @@ module PasswordField
12
12
  extend ActiveSupport::Concern
13
13
 
14
14
  included do
15
- validates :password, presence: { on: :create },
15
+ validates :password, length: { minimum: 1, on: :create, allow_nil: true },
16
16
  confirmation: { allow_nil: true }
17
17
  end
18
18
 
@@ -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.create!
98
- Credentials::Email.create! user: user, email: email, verified: true
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 required' do
22
- @user.password = @user.password_confirmation = nil
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
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.17.0
4
+ version: 0.17.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Victor Costan