authentication-zero 3.0.0.alpha1 → 3.0.0

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
  SHA256:
3
- metadata.gz: a1c102d5a72628c6d1ffbe5d5e7724b5e0ffdfe52259754d4f39c09bd900622a
4
- data.tar.gz: 679af3cd9f3120b50a46abb4e460eac87612116f21bb182456c76de3010a8e5f
3
+ metadata.gz: 1a3d3b8586f1e31b0110ad4dab428c38798c8a014f3f305a128bd90b8f51efe0
4
+ data.tar.gz: 4064bc5928d671f0403c12537d4b65adbbc4940d0efa8e8cfbaffd709b7677e4
5
5
  SHA512:
6
- metadata.gz: 778ea21bb5f23e80f16a773cd095146737eb646d5688fe238a4eb6604b234230c092ecf85af31c6e15dbddb3934d936a582307651a4e6737280fbaa03715247b
7
- data.tar.gz: 9e42dcc5bd6ff6dbc4731326f3c25555e90c26c37e683e1666b0de862276615ef0235e4dc03991ce66e94a95460bcdaff315d0293dbd82eaf5eb04c8e5dbb48b
6
+ metadata.gz: e08062d6b3710305fa2e7ac251bf816761cfd80aa8a4d0662b03cef95f072bc6a2a60803d66150e7d34830fd54abf33d20073730e6818a4aaf009a421beb9971
7
+ data.tar.gz: c0388c5e3a9f2eb9628a4fd1bd031543f4dbd56072631d5da7312cd3fbc3b4bd9d0ba873037218c274cecb25522154ca4ad6ed40221def8e1607d4ed410984de
@@ -18,10 +18,11 @@ jobs:
18
18
  - name: Install Ruby and gems
19
19
  uses: ruby/setup-ruby@v1
20
20
  with:
21
+ ruby-version: "3.2"
21
22
  bundler-cache: true
22
23
 
23
24
  - name: Install the latest Rails gem
24
- run: gem install rails -v "~> 7.0.0"
25
+ run: gem install rails -v "7.1.0"
25
26
 
26
27
  - name: Install Rubocop
27
28
  run: gem install rubocop rubocop-performance rubocop-minitest rubocop-packaging rubocop-minitest rubocop-rails
@@ -31,7 +32,7 @@ jobs:
31
32
 
32
33
  - name: Create fresh Rails app and run generator
33
34
  run: |
34
- rails new test-app --main
35
+ rails new test-app --skip-action-mailbox --skip-action-text --skip-active-storage
35
36
  cp .rubocop.yml test-app/.rubocop.yml
36
37
  cd test-app
37
38
  bundle add authentication-zero --path ..
@@ -61,10 +62,11 @@ jobs:
61
62
  - name: Install Ruby and gems
62
63
  uses: ruby/setup-ruby@v1
63
64
  with:
65
+ ruby-version: "3.2"
64
66
  bundler-cache: true
65
67
 
66
68
  - name: Install the latest Rails gem
67
- run: gem install rails -v "~> 7.0.0"
69
+ run: gem install rails -v "7.1.0"
68
70
 
69
71
  - name: Install Rubocop
70
72
  run: gem install rubocop rubocop-performance rubocop-minitest rubocop-packaging rubocop-minitest rubocop-rails
@@ -74,7 +76,7 @@ jobs:
74
76
 
75
77
  - name: Create fresh Rails app and run generator
76
78
  run: |
77
- rails new test-app --main
79
+ rails new test-app --skip-action-mailbox --skip-action-text --skip-active-storage
78
80
  cp .rubocop.yml test-app/.rubocop.yml
79
81
  cd test-app
80
82
  bundle add authentication-zero --path ..
data/.rubocop.yml CHANGED
@@ -4,5 +4,13 @@ Style/HashSyntax:
4
4
  Exclude:
5
5
  - Gemfile
6
6
 
7
+ Layout/EmptyLinesAroundBlockBody:
8
+ Exclude:
9
+ - Gemfile
10
+
11
+ Layout/TrailingWhitespace:
12
+ Exclude:
13
+ - config/initializers/filter_parameter_logging.rb
14
+
7
15
  Style/FrozenStringLiteralComment:
8
16
  Enabled: false
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- authentication-zero (3.0.0.alpha1)
4
+ authentication-zero (3.0.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/README.md CHANGED
@@ -5,7 +5,13 @@ The purpose of authentication zero is to generate a pre-built authentication sys
5
5
  ## Installation
6
6
 
7
7
  ```
8
- $ bundle add authentication-zero --version=3.0.0.alpha1
8
+ $ bundle add authentication-zero
9
+ ```
10
+
11
+ If you are using Rails < 7.1, you must use version 2.
12
+
13
+ ```
14
+ $ bundle add authentication-zero --version "~> 2"
9
15
  ```
10
16
 
11
17
  ## Usage
@@ -51,6 +57,8 @@ Since Authentication Zero generates this code into your application instead of b
51
57
  ## Generated code
52
58
 
53
59
  - [has_secure_password](https://api.rubyonrails.org/classes/ActiveModel/SecurePassword/ClassMethods.html#method-i-has_secure_password): Adds methods to set and authenticate against a bcrypt password.
60
+ - [authenticate_by](https://edgeapi.rubyonrails.org/classes/ActiveRecord/SecurePassword/ClassMethods.html#method-i-authenticate_by): Given a set of attributes, finds a record using the non-password attributes, and then authenticates that record using the password attributes.
61
+ - [generates_token_for](https://edgeapi.rubyonrails.org/classes/ActiveRecord/TokenFor/ClassMethods.html#method-i-generates_token_for): Defines the behavior of tokens generated for a specific purpose.
54
62
  - [signed cookies](https://api.rubyonrails.org/classes/ActionDispatch/Cookies.html): Returns a jar that'll automatically generate a signed representation of cookie value and verify it when reading from the cookie again.
55
63
  - [httponly cookies](https://api.rubyonrails.org/classes/ActionDispatch/Cookies.html): A cookie with the httponly attribute is inaccessible to the JavaScript, this precaution helps mitigate cross-site scripting (XSS) attacks.
56
64
  - [signed_id](https://api.rubyonrails.org/classes/ActiveRecord/SignedId.html): Returns a signed id that is tamper proof, so it's safe to send in an email or otherwise share with the outside world.
@@ -1,3 +1,3 @@
1
1
  module AuthenticationZero
2
- VERSION = "3.0.0.alpha1"
2
+ VERSION = "3.0.0"
3
3
  end
@@ -6,13 +6,11 @@ class AccountMiddleware
6
6
  def call(env)
7
7
  request = ActionDispatch::Request.new(env)
8
8
 
9
- _, account_id, request_path = request.path.split("/", 3)
10
-
11
- if account_id !~ /\D/
9
+ if m = /\A(\/(\d{1,}))/.match(request.path_info)
10
+ script_name, account_id, path_info = [m[1], m[2], m.post_match]
11
+ request.script_name = script_name
12
+ request.path_info = path_info.presence || "/"
12
13
  set_current_account(account_id)
13
-
14
- request.script_name = "/#{account_id}"
15
- request.path_info = "/#{request_path}"
16
14
  @app.call(request.env)
17
15
  else
18
16
  @app.call(request.env)
@@ -3,7 +3,6 @@ class User < ApplicationRecord
3
3
 
4
4
  generates_token_for :email_verification, expires_in: 2.days { email }
5
5
  generates_token_for :password_reset, expires_in: 20.minutes { password_salt.last(10) }
6
-
7
6
  <%- if options.tenantable? %>
8
7
  belongs_to :account
9
8
  <%- 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: 3.0.0.alpha1
4
+ version: 3.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nixon
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-07-19 00:00:00.000000000 Z
11
+ date: 2023-10-05 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description:
14
14
  email:
@@ -152,11 +152,11 @@ required_ruby_version: !ruby/object:Gem::Requirement
152
152
  version: '0'
153
153
  required_rubygems_version: !ruby/object:Gem::Requirement
154
154
  requirements:
155
- - - ">"
155
+ - - ">="
156
156
  - !ruby/object:Gem::Version
157
- version: 1.3.1
157
+ version: '0'
158
158
  requirements: []
159
- rubygems_version: 3.4.10
159
+ rubygems_version: 3.4.19
160
160
  signing_key:
161
161
  specification_version: 4
162
162
  summary: An authentication system generator for Rails applications