better_authy 0.1.0 → 0.2.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
  SHA256:
3
- metadata.gz: 2cd343402586a23dd2212844efaa3a7007be3a0777b5012264d9380852b060c8
4
- data.tar.gz: b0bde974d6e6c64172d8453193fe4c0727cd3d101b9548093928ab7a33259a0d
3
+ metadata.gz: d60709f816110518de73bf83a19a81674d895a2fed0bf1868b5ce4baa96c5aab
4
+ data.tar.gz: e92177fee4d1c3af0cff42ddfd4df1ac1264910967053006a0b351b21265225e
5
5
  SHA512:
6
- metadata.gz: 7f58ca868ea2d945e6f2ec0e22b4c255295efa4354a277648c32d9547d3525e8515f705d595a0c4671225cdf77e4ae070891832dfb96fb1d95fefce52a267b94
7
- data.tar.gz: df65aa3eb2b1afb41e9c386d92e045e8f9deb3763c512d5d381d9e7256becefc1dcfe8a08fb16a8671fbfa12bf995948096e04b0c6816eb9ce30abee277ea50a
6
+ metadata.gz: 0fa2c932e25d23cdcb0d2874ce05929c99b1f8630b69fb6c4ca36cc0d97545bd25a5e4a407912087b53c04d1c39f6457e68a56d10511dc7d80708314433daf46
7
+ data.tar.gz: 32a7ff554e3fab1bcad427eced6b7a9728c774be22ea1078cebfb64ff9b3b3fb8ec007a35a06d625189454934fa6f9457e440d713a13af1d638a7f39c75b900b
data/README.md CHANGED
@@ -15,7 +15,7 @@ A flexible authentication engine for Rails 8.0+ with multi-scope support. Enable
15
15
  ### 1. Add to Gemfile
16
16
 
17
17
  ```ruby
18
- gem "better_authy", "~> 0.1.0"
18
+ gem "better_authy", "~> 0.2.0"
19
19
  ```
20
20
 
21
21
  ### 2. Configure scope
@@ -3,6 +3,7 @@
3
3
  module BetterAuthy
4
4
  class BaseController < ::ApplicationController
5
5
  helper BetterAuthy::ApplicationHelper
6
+ helper_method :scope_config
6
7
 
7
8
  layout :resolve_layout
8
9
  protect_from_forgery with: :exception
@@ -2,6 +2,7 @@
2
2
 
3
3
  module BetterAuthy
4
4
  class RegistrationsController < BaseController
5
+ before_action :ensure_sign_up_enabled
5
6
  before_action :redirect_if_signed_in, only: %i[new create]
6
7
 
7
8
  def new
@@ -20,6 +21,12 @@ module BetterAuthy
20
21
 
21
22
  private
22
23
 
24
+ def ensure_sign_up_enabled
25
+ return if scope_config.sign_up_enabled?
26
+
27
+ raise ActionController::RoutingError, "Not Found"
28
+ end
29
+
23
30
  def resource_params
24
31
  params.require(scope_name).permit(:email, :password, :password_confirmation)
25
32
  end
@@ -68,13 +68,15 @@
68
68
  <% end %>
69
69
  <% end %>
70
70
 
71
- <% card.with_footer do %>
72
- <p class="text-center text-sm text-grayscale-600">
73
- <%= t("better_authy.sessions.no_account") %>
74
- <%= link_to t("better_authy.sessions.signup_link"),
75
- send(:"#{params[:scope]}_signup_path"),
76
- class: "font-medium text-primary-600 hover:text-primary-500" %>
77
- </p>
71
+ <% if scope_config.sign_up_enabled? %>
72
+ <% card.with_footer do %>
73
+ <p class="text-center text-sm text-grayscale-600">
74
+ <%= t("better_authy.sessions.no_account") %>
75
+ <%= link_to t("better_authy.sessions.signup_link"),
76
+ send(:"#{params[:scope]}_signup_path"),
77
+ class: "font-medium text-primary-600 hover:text-primary-500" %>
78
+ </p>
79
+ <% end %>
78
80
  <% end %>
79
81
  <% end %>
80
82
  </div>
@@ -4,7 +4,8 @@ module BetterAuthy
4
4
  class ScopeConfiguration
5
5
  attr_reader :name
6
6
  attr_accessor :model_name, :session_key, :remember_cookie, :remember_for,
7
- :sign_in_path, :after_sign_in_path, :layout, :password_reset_within
7
+ :sign_in_path, :after_sign_in_path, :layout, :password_reset_within,
8
+ :enable_sign_up
8
9
 
9
10
  def initialize(name)
10
11
  @name = name.to_sym
@@ -15,6 +16,11 @@ module BetterAuthy
15
16
  @sign_in_path = "/auth/#{name}/login"
16
17
  @after_sign_in_path = "/"
17
18
  @layout = "better_authy/application"
19
+ @enable_sign_up = true
20
+ end
21
+
22
+ def sign_up_enabled?
23
+ @enable_sign_up
18
24
  end
19
25
 
20
26
  def model_class
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module BetterAuthy
4
- VERSION = "0.1.0"
4
+ VERSION = "0.2.1"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: better_authy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Umberto Peserico
@@ -61,16 +61,22 @@ dependencies:
61
61
  name: better_ui
62
62
  requirement: !ruby/object:Gem::Requirement
63
63
  requirements:
64
- - - "~>"
64
+ - - ">="
65
65
  - !ruby/object:Gem::Version
66
66
  version: 0.7.1
67
+ - - "<"
68
+ - !ruby/object:Gem::Version
69
+ version: '1'
67
70
  type: :runtime
68
71
  prerelease: false
69
72
  version_requirements: !ruby/object:Gem::Requirement
70
73
  requirements:
71
- - - "~>"
74
+ - - ">="
72
75
  - !ruby/object:Gem::Version
73
76
  version: 0.7.1
77
+ - - "<"
78
+ - !ruby/object:Gem::Version
79
+ version: '1'
74
80
  description: A flexible authentication engine supporting multiple authenticatable
75
81
  models via scopes
76
82
  email: