registration_generator 0.3.2 → 0.5.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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d49091967da23472106aae6e58e031dc3213195cebc148dad32aa5ba88412426
|
4
|
+
data.tar.gz: 848fe98cf806153c3baedc90252ea1329e9a35d270340644fc9c266c8bca9735
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b9f225fbdb6cb7ef692eeb30dacb8b1fab63c5e9c84117d6363cf90409a48eeeb22bd08c28f93ec324115fb1953f91787ac2ac9dfe860644296e0a442532f997
|
7
|
+
data.tar.gz: 3c842bc0ae5740980357bbf2b0517842bbc4764117769201eb841c44c2fbe604cb74df07da7c425fe4c7e376b1d3567edf1e36dfac3d698d48456f697eb4ad9d
|
@@ -6,27 +6,27 @@ module Registration
|
|
6
6
|
source_root File.expand_path("templates", __dir__)
|
7
7
|
|
8
8
|
def create_view
|
9
|
-
template
|
9
|
+
template "registration_form.html.erb", "app/views/registrations/new.html.erb"
|
10
10
|
end
|
11
11
|
|
12
12
|
def create_sign_in
|
13
|
-
template
|
13
|
+
template "sign_in_form.html.erb", "app/views/sessions/new.html.erb", force: true
|
14
14
|
end
|
15
15
|
|
16
16
|
def create_controller
|
17
|
-
template
|
17
|
+
template "registrations_controller.rb", "app/controllers/registrations_controller.rb"
|
18
18
|
end
|
19
19
|
|
20
20
|
def add_routes
|
21
21
|
route "resource :registration, only: [:new, :create]"
|
22
|
-
route "get
|
23
|
-
route "delete
|
22
|
+
route "get \"sign_in\", to: \"sessions#new\", as: :sign_in"
|
23
|
+
route "delete \"sign_out\", to: \"sessions#destroy\", as: :sign_out"
|
24
24
|
end
|
25
25
|
|
26
26
|
def create_helper
|
27
27
|
create_file "app/helpers/authentication_helper.rb", <<~RUBY
|
28
28
|
module AuthenticationHelper
|
29
|
-
def link_to_sign_in_or_out
|
29
|
+
def link_to_sign_in_or_out
|
30
30
|
if authenticated?
|
31
31
|
button_to "Sign Out", sign_out_path, method: :delete
|
32
32
|
else
|
@@ -34,10 +34,9 @@ module Registration
|
|
34
34
|
end
|
35
35
|
end
|
36
36
|
|
37
|
-
def show_username_if_signed_in
|
37
|
+
def show_username_if_signed_in
|
38
38
|
if authenticated?
|
39
|
-
|
40
|
-
content.html_safe
|
39
|
+
"Signed in as \#{Current.user.email_address}"
|
41
40
|
end
|
42
41
|
end
|
43
42
|
end
|
@@ -48,17 +47,5 @@ module Registration
|
|
48
47
|
include AuthenticationHelper
|
49
48
|
RUBY
|
50
49
|
end
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
def add_name_method_to_user
|
55
|
-
inject_into_class "app/models/user.rb", User, <<-RUBY
|
56
|
-
|
57
|
-
def name
|
58
|
-
email_address
|
59
|
-
end
|
60
|
-
|
61
|
-
RUBY
|
62
|
-
end
|
63
50
|
end
|
64
|
-
end
|
51
|
+
end
|
@@ -2,16 +2,15 @@ class RegistrationsController < ApplicationController
|
|
2
2
|
allow_unauthenticated_access
|
3
3
|
|
4
4
|
def new
|
5
|
-
redirect_to root_path if authenticated?
|
6
5
|
@user = User.new
|
7
6
|
end
|
8
7
|
|
9
8
|
def create
|
10
9
|
@user = User.new(user_params)
|
11
|
-
|
10
|
+
|
12
11
|
if @user.save
|
13
12
|
start_new_session_for @user
|
14
|
-
redirect_to
|
13
|
+
redirect_to after_authentication_url, notice: "You have successfully registered!"
|
15
14
|
else
|
16
15
|
render :new, status: :unprocessable_entity
|
17
16
|
end
|
@@ -6,7 +6,7 @@
|
|
6
6
|
<%%= form.password_field :password, required: true, autocomplete: "current-password", placeholder: "Enter your password", maxlength: 72 %><br>
|
7
7
|
<%%= form.submit "Sign in" %>
|
8
8
|
<%% end %>
|
9
|
-
<
|
10
|
-
|
9
|
+
<p>
|
11
10
|
<%%= link_to "Forgot password?", new_password_path %> |
|
12
|
-
<%%= link_to "Register", new_registration_path %>
|
11
|
+
<%%= link_to "No Account? Register here", new_registration_path %>
|
12
|
+
</p>
|
data/lib/generators/version.rb
CHANGED