authentication_with_registration_generator 0.3.7 → 0.4.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: c4789ca10d281551213ea556cd5c4c4e20ad34f6a2326491a3ac1878ddf47237
4
- data.tar.gz: 2bd3283c0dfe7f0f8e2ade71d331ad4efab0e6715eb9f5f33f1d7bf8e5ebc62b
3
+ metadata.gz: f0b23f75ebcd6eb2f59c6de139f976c9fef290c3c815d0dff6ae7a94d1ee6551
4
+ data.tar.gz: 37fd9f913c6a36515c64a4490fdd43869d13de837db2b6f840b9c26bb3af5189
5
5
  SHA512:
6
- metadata.gz: a5ef356ae177579a35b82a6bc84b68e7d5488f73d73f6015541d521998334057d61165ff2588e90208020e7486e4a57b5a93c45d9db8e5a54e84281f15e02762
7
- data.tar.gz: 3270af7ffc23f2c5d4361dae4baf8d211d2188eb1732014a54fb0bab921f56b0236c070a8caad881a34c909ce77d527a7bb4cc3e89befdf527fc96139dba30f3
6
+ metadata.gz: d1ff85084c2c42ab83cd6d5858d55cacb5d83bf7617b415b9d067c97109f5ef45102dd01eec8e6e420571c68d8cdaca34f29763a85506e8a934ad0ef630251cf
7
+ data.tar.gz: 2084a38f791e245e7e6eb6a30dff29344a770b8597ee3863246d4a6c285ffcbbabe048688b61c1a086753794b7352ef42ac4fa91091ad53cec3b1b7f5d2473b9
data/README.md CHANGED
@@ -6,26 +6,24 @@ A Rails Generator that adds registration pages to the Authentication Generator a
6
6
  * Adds a registration page which will create a new user with an email address and password.
7
7
  * Adds a link to the registration page on the sign_in page
8
8
  * Adds `new_registration_path` and `registration_path` routes
9
- * Adds '/sign_in' and '/sign_out' routes as alias to '/session/new' and 'session', these can be accessed using the `sign_in_path` and `sign_out_path` helpers
9
+ * Adds '/sign_in' and '/sign_out' routes as alias to '/session/new' and 'session', these can be accessed using the `sign_in_path` and `sign_out_path, method: :delete` helpers
10
10
  * Adds a `link_to_sign_in_or_out` helper that will display a sign out or sign in link depending on if a user is authenticated or not
11
11
  * Adds a `show_user_if_signed_in` method that displays a "signed in as username" message if the user is signed in
12
12
 
13
- Much of this was based on [this excellent tutorial](https://www.rubanonrails.com/courses/rails-cookie-authentication/lessons/introduction) by @alexandreruban (https://github.com/alexandreruban) that will help you understand how the Authentication Generator works.
14
-
15
13
  ## Installation
16
14
 
17
15
  Install the gem and add to the application's Gemfile by executing:
18
16
 
19
- $ bundle add authentication_with_registration_generator
17
+ $ bundle add registration_generator
20
18
 
21
19
  If bundler is not being used to manage dependencies, install the gem by executing:
22
20
 
23
- $ gem install authentication_with_registration_generator
21
+ $ gem install registration_generator
24
22
 
25
23
  ## Usage
26
24
 
27
25
  ```bash
28
- rails generate authentication
26
+ rails generate registration
29
27
  ```
30
28
 
31
29
  ## Development
@@ -42,7 +42,7 @@ module Authentication
42
42
  if File.exist?(session_view_path)
43
43
  # Replace the "Forgot password?" link with the new links
44
44
  gsub_file session_view_path, /<br>\s*<%= link_to "Forgot password\?", new_password_path %>/ do |match|
45
- "<p>\n <%= link_to 'Forgot password?', new_password_path %> | \n <%= link_to 'No Account? Register here', new_registration_path %>\n</p>"
45
+ "<p>\n <%%= link_to 'Forgot password?', new_password_path %> | \n <%= link_to 'No Account? Register here', new_registration_path %>\n</p>"
46
46
  end
47
47
  else
48
48
  # If the file doesn't exist, handle it accordingly (e.g., raise an error or create the file)
@@ -57,13 +57,13 @@ module Authentication
57
57
  def link_to_sign_in_or_out
58
58
  if authenticated?
59
59
  # Return the form as a string
60
- "<form class=\\"button_to\\" action=\\"\#{sign_out_path}\\" accept-charset=\\"UTF-8\\" method=\\"post\\">
61
- <input type=\\"hidden\\" name=\\"_method\\" value=\\"delete\\" autocomplete=\\"off\\" />
62
- <button type=\\"submit\\">Sign Out</button>
63
- <input type=\\"hidden\\" name=\\"authenticity_token\\" value=\\"\#{form_authenticity_token}\\" autocomplete=\\"off\\" />
60
+ "<form class=\"button_to\" action=\"\#{sign_out_path}\" accept-charset=\"UTF-8\" method=\"post\">
61
+ <input type=\"hidden\" name=\"_method\" value=\"delete\" autocomplete=\"off\" />
62
+ <button type=\"submit\">Sign Out</button>
63
+ <input type=\"hidden\" name=\"authenticity_token\" value=\"\#{form_authenticity_token}\" autocomplete=\"off\" />
64
64
  </form>".html_safe
65
65
  else
66
- "<a href=\\"\#{sign_in_path}\\">Sign In</a>".html_safe
66
+ "<a href=\"\#{sign_in_path}\">Sign In</a>".html_safe
67
67
  end
68
68
  end
69
69
 
@@ -1,24 +1,24 @@
1
1
  class RegistrationsController < ApplicationController
2
2
  allow_unauthenticated_access
3
3
 
4
- def new
5
- @user = User.new
6
- end
4
+ def new
5
+ @user = User.new
6
+ end
7
7
 
8
- def create
9
- @user = User.new(user_params)
8
+ def create
9
+ @user = User.new(user_params)
10
10
 
11
- if @user.save
12
- start_new_session_for @user
13
- redirect_to after_authentication_url, notice: "You have successfully registered!"
14
- else
15
- render :new, status: :unprocessable_entity
16
- end
17
- end
11
+ if @user.save
12
+ start_new_session_for @user
13
+ redirect_to after_authentication_url, notice: "You have successfully registered!"
14
+ else
15
+ render :new, status: :unprocessable_entity
16
+ end
17
+ end
18
18
 
19
- private
19
+ private
20
20
 
21
- def user_params
22
- params.expect(user: [ :email_address, :password ])
23
- end
21
+ def user_params
22
+ params.require(:user).permit(:email_address, :password)
23
+ end
24
24
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module AuthenticationGenerator
4
- VERSION = "0.3.7"
4
+ VERSION = "0.4.0"
5
5
  end
metadata CHANGED
@@ -1,13 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: authentication_with_registration_generator
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.7
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - DAZ
8
+ autorequire:
8
9
  bindir: bin
9
10
  cert_chain: []
10
- date: 2025-03-09 00:00:00.000000000 Z
11
+ date: 2025-02-28 00:00:00.000000000 Z
11
12
  dependencies:
12
13
  - !ruby/object:Gem::Dependency
13
14
  name: rails
@@ -38,10 +39,11 @@ files:
38
39
  - lib/generators/authentication/templates/registrations_controller.rb
39
40
  - lib/generators/authentication_generator.rb
40
41
  - lib/generators/version.rb
41
- homepage: https://github.com/daz4126/authentication_with_registration_generator
42
+ homepage: https://github.com/your_username/registration_generator
42
43
  licenses:
43
44
  - MIT
44
45
  metadata: {}
46
+ post_install_message:
45
47
  rdoc_options: []
46
48
  require_paths:
47
49
  - lib
@@ -56,7 +58,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
56
58
  - !ruby/object:Gem::Version
57
59
  version: '0'
58
60
  requirements: []
59
- rubygems_version: 3.6.3
61
+ rubygems_version: 3.5.11
62
+ signing_key:
60
63
  specification_version: 4
61
64
  summary: A Rails generator for user authenticatin with extra registration pages, routes
62
65
  and helpers