authentication-zero 2.16.12 → 2.16.14

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4cba615fcc2174e4662ce5f805c6b2499638058c9dbcef5bfe520789290c1db2
4
- data.tar.gz: 4f73d414bdbaad60361f592f739214d4b97711d7df08f1dc29522f8b03ed942e
3
+ metadata.gz: e0f83db44ee39461a039edbf34e4ab4b1af7698fc537361607b120310e3d828e
4
+ data.tar.gz: ecbf7f8578a9612f30bd7d19d9c482c7d9dbf62e2a28fa148f25c7cb5eb3bad6
5
5
  SHA512:
6
- metadata.gz: 930bd997605a77a12d755b59469365124832403a6dddac106350a78c9893329c6f47bf9650e9e9c8ade54a8a648af265dd894cf1818934147fb23ea7ffa7f647
7
- data.tar.gz: 4161d49cdecf59dd3d5b412281394373010a4ac08fcb2f07a20fb64b56788c17e40d1445270072efa2e48780dc7659f66091f1a2074786679cd09bcd6350e2e1
6
+ metadata.gz: c8b1ed8282c418a5941295a522640ec2bcbc43fcd5dd8f6743333a860051c7c2858301d019f4f3400e217e2a385527809ab7bee61ef49306e4f6aba88bbdad38
7
+ data.tar.gz: 48220896d353c7aa5c37584f84ec4bd75d189f2205440fe754256fd2cfb885d31a2e87859d8756ec54502ef1e5f6cad51eede0662b664a26dc9f2daa066ea8e6
@@ -5,9 +5,7 @@
5
5
  # This workflow will install a prebuilt Ruby version, install dependencies, and
6
6
  # run tests and linters.
7
7
  name: "Generate sample app and run tests"
8
- on:
9
- push:
10
- branches: ["*"]
8
+ on: [push]
11
9
  jobs:
12
10
  test_html:
13
11
  name: 🧪 Run HTML Tests
@@ -26,16 +24,36 @@ jobs:
26
24
  - name: Install the latest Rails gem
27
25
  run: gem install rails
28
26
 
29
- - name: Create fresh Rails app then run generator and tests
30
- env:
31
- CI: true
27
+ - name: Create fresh Rails app and run generator
32
28
  run: |
33
29
  rails new test-app
34
30
  cd test-app
31
+ wget https://raw.githubusercontent.com/lazaronixon/authentication-zero/master/.rubocop.yml
35
32
  bundle add authentication-zero --github ${{ github.repository }} --branch ${{ github.ref_name }}
36
33
  bin/rails generate authentication
37
34
  bundle install
38
35
  bin/rails db:migrate
36
+
37
+
38
+ - name: Install Rubocop
39
+ run: gem install rubocop rubocop-performance rubocop-minitest rubocop-packaging rubocop-minitest rubocop-rails
40
+
41
+ - name: Rubocop
42
+ run: |
43
+ cd test-app
44
+ rubocop
45
+
46
+ - name: Install brakeman
47
+ run: gem install brakeman
48
+
49
+ - name: Brakeman
50
+ run: |
51
+ cd test-app
52
+ brakeman
53
+
54
+ - name: Tests
55
+ run: |
56
+ cd test-app
39
57
  bin/rails test
40
58
  bin/rails test:system
41
59
  test_api:
@@ -55,14 +73,34 @@ jobs:
55
73
  - name: Install the latest Rails gem
56
74
  run: gem install rails
57
75
 
58
- - name: Create fresh Rails app then run generator and tests
59
- env:
60
- CI: true
76
+ - name: Create fresh Rails app and run generator
61
77
  run: |
62
- rails new test-app --api
78
+ rails new test-app
63
79
  cd test-app
80
+ wget https://raw.githubusercontent.com/lazaronixon/authentication-zero/master/.rubocop.yml
64
81
  bundle add authentication-zero --github ${{ github.repository }} --branch ${{ github.ref_name }}
65
- bin/rails generate authentication
82
+ bin/rails generate authentication --api
66
83
  bundle install
67
84
  bin/rails db:migrate
85
+
86
+ - name: Install Rubocop
87
+ run: gem install rubocop rubocop-performance rubocop-minitest rubocop-packaging rubocop-minitest rubocop-rails
88
+
89
+ - name: Rubocop
90
+ run: |
91
+ cd test-app
92
+ rubocop
93
+
94
+ - name: Install brakeman
95
+ run: gem install brakeman
96
+
97
+ - name: Brakeman
98
+ run: |
99
+ cd test-app
100
+ brakeman
101
+
102
+ - name: Tests
103
+ run: |
104
+ cd test-app
68
105
  bin/rails test
106
+
data/.rubocop.yml CHANGED
@@ -1,15 +1,8 @@
1
- inherit_from: https://raw.githubusercontent.com/rails/rails/master/.rubocop.yml
1
+ inherit_from: https://raw.githubusercontent.com/rails/rails/v7.0.4/.rubocop.yml
2
2
 
3
- Performance:
3
+ Style/HashSyntax:
4
4
  Exclude:
5
- - 'test/**/*'
5
+ - Gemfile
6
6
 
7
7
  Style/FrozenStringLiteralComment:
8
8
  Enabled: false
9
-
10
- Style/StringLiterals:
11
- Enabled: true
12
- EnforcedStyle: double_quotes
13
- Include:
14
- - 'app/**/*'
15
- - 'test/**/*'
data/CHANGELOG.md CHANGED
@@ -1,3 +1,14 @@
1
+ ## Authentication Zero 2.16.14 ##
2
+
3
+ * Remove password requirements
4
+ * Rubocop compliant
5
+ * Brakeman compliant
6
+
7
+ ## Authentication Zero 2.16.13 ##
8
+
9
+ * Enable resend invitation
10
+ * Refactor first_or_initialize -> find_or_initialize_by
11
+
1
12
  ## Authentication Zero 2.16.12 ##
2
13
 
3
14
  * Bring back --sudoable, just for html and you should set before_action yourself
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- authentication-zero (2.16.12)
4
+ authentication-zero (2.16.14)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -1,3 +1,3 @@
1
1
  module AuthenticationZero
2
- VERSION = "2.16.12"
2
+ VERSION = "2.16.14"
3
3
  end
@@ -125,7 +125,7 @@ class AuthenticationGenerator < Rails::Generators::Base
125
125
  end
126
126
 
127
127
  def add_routes
128
- route "root 'home#index'" unless options.api?
128
+ route 'root "home#index"' unless options.api?
129
129
 
130
130
  if sudoable?
131
131
  route "resource :sudo, only: [:new, :create]", namespace: :sessions
@@ -136,9 +136,9 @@ class AuthenticationGenerator < Rails::Generators::Base
136
136
  end
137
137
 
138
138
  if omniauthable?
139
- route "post '/auth/:provider/callback', to: 'sessions/omniauth#create'"
140
- route "get '/auth/:provider/callback', to: 'sessions/omniauth#create'"
141
- route "get '/auth/failure', to: 'sessions/omniauth#failure'"
139
+ route 'post "/auth/:provider/callback", to: "sessions/omniauth#create"'
140
+ route 'get "/auth/:provider/callback", to: "sessions/omniauth#create"'
141
+ route 'get "/auth/failure", to: "sessions/omniauth#failure"'
142
142
  end
143
143
 
144
144
  if two_factor?
@@ -153,13 +153,14 @@ class AuthenticationGenerator < Rails::Generators::Base
153
153
  route "resource :password_reset, only: [:new, :edit, :create, :update]", namespace: :identity
154
154
  route "resource :email_verification, only: [:show, :create]", namespace: :identity
155
155
  route "resource :email, only: [:edit, :update]", namespace: :identity
156
+
156
157
  route "resource :invitation, only: [:new, :create]" if invitable?
157
158
  route "resource :password, only: [:edit, :update]"
158
159
  route "resources :sessions, only: [:index, :show, :destroy]"
159
- route "post 'sign_up', to: 'registrations#create'"
160
- route "get 'sign_up', to: 'registrations#new'" unless options.api?
161
- route "post 'sign_in', to: 'sessions#create'"
162
- route "get 'sign_in', to: 'sessions#new'" unless options.api?
160
+ route 'post "sign_up", to: "registrations#create"'
161
+ route 'get "sign_up", to: "registrations#new"' unless options.api?
162
+ route 'post "sign_in", to: "sessions#create"'
163
+ route 'get "sign_in", to: "sessions#new"' unless options.api?
163
164
  end
164
165
 
165
166
  def create_test_files
@@ -2,7 +2,7 @@ class Identity::EmailsController < ApplicationController
2
2
  before_action :set_user
3
3
 
4
4
  def update
5
- if !@user.authenticate(params[:current_password])
5
+ if !@user.authenticate(params[:current_password])
6
6
  render json: { error: "The password you entered is incorrect" }, status: :bad_request
7
7
  elsif @user.update(user_params)
8
8
  render_show
@@ -5,7 +5,7 @@ class Identity::EmailsController < ApplicationController
5
5
  end
6
6
 
7
7
  def update
8
- if !@user.authenticate(params[:current_password])
8
+ if !@user.authenticate(params[:current_password])
9
9
  redirect_to edit_identity_email_path, alert: "The password you entered is incorrect"
10
10
  elsif @user.update(user_params)
11
11
  redirect_to_root
@@ -4,7 +4,7 @@ class InvitationsController < ApplicationController
4
4
  end
5
5
 
6
6
  def create
7
- @user = User.new(user_params)
7
+ @user = User.create_with(user_params).find_or_initialize_by(email: params[:email])
8
8
 
9
9
  if @user.save
10
10
  send_invitation_instructions
@@ -16,7 +16,7 @@ class InvitationsController < ApplicationController
16
16
 
17
17
  private
18
18
  def user_params
19
- params.permit(:email).merge(password: SecureRandom::base58, verified: true)
19
+ params.permit(:email).merge(password: SecureRandom.base58, verified: true)
20
20
  end
21
21
 
22
22
  def send_invitation_instructions
@@ -3,7 +3,7 @@ class Sessions::OmniauthController < ApplicationController
3
3
  skip_before_action :authenticate
4
4
 
5
5
  def create
6
- @user = User.where(omniauth_params).first_or_initialize(user_params)
6
+ @user = User.create_with(user_params).find_or_initialize_by(omniauth_params)
7
7
 
8
8
  if @user.save
9
9
  session = @user.sessions.create!
@@ -20,12 +20,12 @@ class Sessions::OmniauthController < ApplicationController
20
20
  end
21
21
 
22
22
  private
23
- def omniauth_params
24
- { provider: omniauth.provider, uid: omniauth.uid }
23
+ def user_params
24
+ { email: omniauth.info.email, password: SecureRandom.base58, verified: true }
25
25
  end
26
26
 
27
- def user_params
28
- { email: omniauth.info.email, password: SecureRandom::base58, verified: true }
27
+ def omniauth_params
28
+ { provider: omniauth.provider, uid: omniauth.uid }
29
29
  end
30
30
 
31
31
  def omniauth
@@ -16,7 +16,7 @@ class User < ApplicationRecord
16
16
  <%- end -%>
17
17
 
18
18
  validates :email, presence: true, uniqueness: true, format: { with: URI::MailTo::EMAIL_REGEXP }
19
- validates :password, allow_nil: true, length: { minimum: 12 }, format: { with: /(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])/ }
19
+ validates :password, allow_nil: true, length: { minimum: 12 }
20
20
  <%- if options.pwned? -%>
21
21
  validates :password, not_pwned: { message: "might easily be guessed" }
22
22
  <%- end -%>
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: authentication-zero
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.16.12
4
+ version: 2.16.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nixon
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-04-03 00:00:00.000000000 Z
11
+ date: 2023-04-06 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description:
14
14
  email: