better_authy 0.1.0 → 0.2.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 +4 -4
- data/README.md +1 -1
- data/app/controllers/better_authy/base_controller.rb +1 -0
- data/app/controllers/better_authy/registrations_controller.rb +7 -0
- data/app/views/better_authy/sessions/new.html.erb +9 -7
- data/lib/better_authy/scope_configuration.rb +7 -1
- data/lib/better_authy/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 2693e675abcb3ae3c4644e289aae00407020371666dd7c2e8753467251b58578
|
|
4
|
+
data.tar.gz: 02fa828bcb116d82ecdf8160fa2adc221217c9902b03034d2c4322644504d0f7
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 2ed512366330a01ea77e91e69521c44514144cd1784b7a93534276e9a5938156ac8b48bcbd77033e748349fa2d22e33937c52a10dcbd6ed9f6c238b7a9f5cf24
|
|
7
|
+
data.tar.gz: 6ea42213032ced5d1ffe35280fea43d68e6e6463b8ed0529090742045b056993cbf418e2464fd8d4f427dbf2fdc371ec3d71195e3d5b544532751f8abfbb1970
|
data/README.md
CHANGED
|
@@ -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
|
-
<%
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
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
|
data/lib/better_authy/version.rb
CHANGED