authentication-zero 2.0.0 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (37) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +1 -1
  3. data/README.md +3 -4
  4. data/lib/authentication_zero/version.rb +1 -1
  5. data/lib/generators/authentication/authentication_generator.rb +1 -1
  6. data/lib/generators/authentication/templates/controllers/api/sessions_controller.rb.tt +2 -2
  7. data/lib/generators/authentication/templates/controllers/html/cancellations_controller.rb.tt +1 -1
  8. data/lib/generators/authentication/templates/controllers/html/emails_controller.rb.tt +1 -1
  9. data/lib/generators/authentication/templates/controllers/html/password_resets_controller.rb.tt +1 -1
  10. data/lib/generators/authentication/templates/controllers/html/passwords_controller.rb.tt +1 -1
  11. data/lib/generators/authentication/templates/controllers/html/registrations_controller.rb.tt +1 -8
  12. data/lib/generators/authentication/templates/controllers/html/sessions_controller.rb.tt +2 -2
  13. data/lib/generators/authentication/templates/erb/session_mailer/signed_in.html.erb.tt +21 -0
  14. data/lib/generators/authentication/templates/erb/session_mailer/signed_in.text.erb.tt +17 -0
  15. data/lib/generators/authentication/templates/mailers/password_mailer.rb.tt +1 -5
  16. data/lib/generators/authentication/templates/mailers/session_mailer.rb.tt +6 -0
  17. data/lib/generators/authentication/templates/models/model.rb.tt +0 -12
  18. data/lib/generators/authentication/templates/models/session.rb.tt +4 -0
  19. data/lib/generators/authentication/templates/test_unit/controllers/api/emails_controller_test.rb.tt +2 -7
  20. data/lib/generators/authentication/templates/test_unit/controllers/api/passwords_controller_test.rb.tt +2 -7
  21. data/lib/generators/authentication/templates/test_unit/controllers/api/sessions_controller_test.rb.tt +2 -0
  22. data/lib/generators/authentication/templates/test_unit/controllers/html/cancellations_controller_test.rb.tt +1 -1
  23. data/lib/generators/authentication/templates/test_unit/controllers/html/emails_controller_test.rb.tt +3 -8
  24. data/lib/generators/authentication/templates/test_unit/controllers/html/passwords_controller_test.rb.tt +3 -8
  25. data/lib/generators/authentication/templates/test_unit/controllers/html/registrations_controller_test.rb.tt +1 -3
  26. data/lib/generators/authentication/templates/test_unit/controllers/html/sessions_controller_test.rb.tt +4 -2
  27. data/lib/generators/authentication/templates/test_unit/sessions.yml.tt +1 -1
  28. data/lib/generators/authentication/templates/test_unit/system/cancellations_test.rb.tt +2 -2
  29. data/lib/generators/authentication/templates/test_unit/system/emails_test.rb.tt +2 -2
  30. data/lib/generators/authentication/templates/test_unit/system/password_resets_test.rb.tt +1 -1
  31. data/lib/generators/authentication/templates/test_unit/system/passwords_test.rb.tt +2 -2
  32. metadata +4 -6
  33. data/lib/generators/authentication/templates/erb/email_mailer/changed.html.erb.tt +0 -11
  34. data/lib/generators/authentication/templates/erb/email_mailer/changed.text.erb.tt +0 -9
  35. data/lib/generators/authentication/templates/erb/password_mailer/changed.html.erb.tt +0 -7
  36. data/lib/generators/authentication/templates/erb/password_mailer/changed.text.erb.tt +0 -5
  37. data/lib/generators/authentication/templates/mailers/email_mailer.rb.tt +0 -6
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c0359a2a997ced43e3eb97612156d7ffe3206aa8a75ede90ad37dbdf0d0a9269
4
- data.tar.gz: 9a50df4bf9804a3da3bb1ee753b7ecd027a336f0624de5a9c5d1cfec1b5354b1
3
+ metadata.gz: 759478647a894dc33bcf8611a439a285cbf32d00c713ac2cc87a2cc385125a7b
4
+ data.tar.gz: eb58361a0c6d3a72e1176e041e13675bd21389ee58a32df12247bcd4bf83b9df
5
5
  SHA512:
6
- metadata.gz: 45b51a6f24b135e1273d076683c1d406755e30ec012c4e5ec632a158ef0bb8432cb9c461254b044ba7c491717eaa95571e1cce85bb6560b19f35cf1ac03a7000
7
- data.tar.gz: 2dd271538d229d7a88df027a44f06e59a4f0092cdc6bb8de214596dfde3cb52c2339e5659c6a8331ba69440a25030ec6c2620255f5d483e0f980a042277a28ae
6
+ metadata.gz: c56ce0caad6ea538bb4c0ba8752f35e19ad0562bbb424baa43c20fc2e38f58e008ed5832f9a7730e83df849cd55b4db5f9a61cd60da058448274712159e0257f
7
+ data.tar.gz: b33dc32e1783d49ee48e09b7ccff9959533f71d661e4aab54b50aa870fac7b674586591e4e00b1a973e846a66483619e96892fd464ed9bca1192e8cd74de4389
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- authentication-zero (2.0.0)
4
+ authentication-zero (2.1.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/README.md CHANGED
@@ -4,14 +4,14 @@ The purpose of authentication zero is to generate a pre-built authentication sys
4
4
 
5
5
  ## Features
6
6
 
7
+ - **Simplest code ever**
7
8
  - Sign up
8
9
  - Email and password validations
9
10
  - Reset the user password and send reset instructions
10
11
  - Authentication by cookie (html)
11
12
  - Authentication by token (api)
12
- - Manage sessions
13
- - Send e-mail when email is changed
14
- - Send e-mail when password is changed
13
+ - Send e-mail when sign-in to your account
14
+ - Manage multiple sessions
15
15
  - Cancel my account
16
16
  - Log out
17
17
 
@@ -22,7 +22,6 @@ The purpose of authentication zero is to generate a pre-built authentication sys
22
22
  - [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.
23
23
  - [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.
24
24
  - [Current attributes](https://api.rubyonrails.org/classes/ActiveSupport/CurrentAttributes.html): Abstract super class that provides a thread-isolated attributes singleton, which resets automatically before and after each request.
25
- - [Callbacks](https://api.rubyonrails.org/classes/ActiveRecord/Callbacks.html): We use callbacks to send emails after changing an email or password.
26
25
  - [Action mailer](https://api.rubyonrails.org/classes/ActionMailer/Base.html): Action Mailer allows you to send email from your application using a mailer model and views.
27
26
  - [Log filtering](https://guides.rubyonrails.org/action_controller_overview.html#log-filtering): Parameters 'token' and 'password' are marked [FILTERED] in the log.
28
27
  - [Functional Tests](https://guides.rubyonrails.org/testing.html#functional-tests-for-your-controllers): In Rails, testing the various actions of a controller is a form of writing functional tests.
@@ -1,3 +1,3 @@
1
1
  module AuthenticationZero
2
- VERSION = "2.0.0"
2
+ VERSION = "2.1.0"
3
3
  end
@@ -81,7 +81,7 @@ class AuthenticationGenerator < Rails::Generators::NamedBase
81
81
 
82
82
  def create_views
83
83
  if options.api
84
- directory "erb/email_mailer", "app/views/email_mailer"
84
+ directory "erb/session_mailer", "app/views/session_mailer"
85
85
  directory "erb/password_mailer", "app/views/password_mailer"
86
86
  else
87
87
  directory "#{template_engine}", "app/views"
@@ -20,7 +20,7 @@ class SessionsController < ApplicationController
20
20
 
21
21
  render json: session, status: :created
22
22
  else
23
- render json: { error: "Invalid email or password" }, status: :unauthorized
23
+ render json: { error: "That email or password is incorrect" }, status: :unauthorized
24
24
  end
25
25
  end
26
26
 
@@ -30,7 +30,7 @@ class SessionsController < ApplicationController
30
30
 
31
31
  private
32
32
  def set_session
33
- @session = Current.user.sessions.find(params[:id])
33
+ @session = Current.<%= singular_table_name %>.sessions.find(params[:id])
34
34
  end
35
35
 
36
36
  def session_params
@@ -4,6 +4,6 @@ class CancellationsController < ApplicationController
4
4
 
5
5
  def create
6
6
  Current.<%= singular_table_name %>.destroy
7
- redirect_to sign_in_path, notice: "Bye! Your account has been successfully cancelled"
7
+ redirect_to sign_in_path, notice: "Your account is closed"
8
8
  end
9
9
  end
@@ -8,7 +8,7 @@ class EmailsController < ApplicationController
8
8
  if !@<%= singular_table_name %>.authenticate(params[:current_password])
9
9
  redirect_to edit_emails_path, alert: "The current password you entered is incorrect"
10
10
  elsif @<%= singular_table_name %>.update(<%= "#{singular_table_name}_params" %>)
11
- redirect_to root_path, notice: "Your email has been changed successfully"
11
+ redirect_to root_path, notice: "Your email has been changed"
12
12
  else
13
13
  render :edit, status: :unprocessable_entity
14
14
  end
@@ -12,7 +12,7 @@ class PasswordResetsController < ApplicationController
12
12
  def create
13
13
  if @<%= singular_table_name %> = <%= class_name %>.find_by_email(params[:email])
14
14
  PasswordMailer.with(<%= singular_table_name %>: @<%= singular_table_name %>).reset.deliver_later
15
- redirect_to sign_in_path, notice: "You will receive an email with instructions on how to reset your password in a few minutes"
15
+ redirect_to sign_in_path, notice: "Check your email for reset instructions"
16
16
  else
17
17
  redirect_to new_password_resets_path, alert: "Sorry, we didn't recognize that email address"
18
18
  end
@@ -8,7 +8,7 @@ class PasswordsController < ApplicationController
8
8
  if !@<%= singular_table_name %>.authenticate(params[:current_password])
9
9
  redirect_to edit_passwords_path, alert: "The current password you entered is incorrect"
10
10
  elsif @<%= singular_table_name %>.update(<%= "#{singular_table_name}_params" %>)
11
- redirect_to root_path, notice: "Your password has been changed successfully"
11
+ redirect_to root_path, notice: "Your password has been changed"
12
12
  else
13
13
  render :edit, status: :unprocessable_entity
14
14
  end
@@ -9,10 +9,7 @@ class RegistrationsController < ApplicationController
9
9
  @<%= singular_table_name %> = <%= class_name %>.new(<%= "#{singular_table_name}_params" %>)
10
10
 
11
11
  if @<%= singular_table_name %>.save
12
- @session = @user.sessions.create!(session_params)
13
- cookies.signed.permanent[:session_token] = { value: @session.id, httponly: true }
14
-
15
- redirect_to root_path, notice: "Welcome! You have signed up successfully"
12
+ redirect_to sign_in_path, notice: "Welcome! You have signed up successfully"
16
13
  else
17
14
  render :new, status: :unprocessable_entity
18
15
  end
@@ -22,8 +19,4 @@ class RegistrationsController < ApplicationController
22
19
  def <%= "#{singular_table_name}_params" %>
23
20
  params.require(:<%= singular_table_name %>).permit(:email, :password, :password_confirmation)
24
21
  end
25
-
26
- def session_params
27
- { user_agent: request.user_agent, ip_address: request.remote_ip }
28
- end
29
22
  end
@@ -20,7 +20,7 @@ class SessionsController < ApplicationController
20
20
 
21
21
  redirect_to root_path, notice: "Signed in successfully"
22
22
  else
23
- redirect_to sign_in_path(email_hint: params[:email]), alert: "Invalid email or password"
23
+ redirect_to sign_in_path(email_hint: params[:email]), alert: "That email or password is incorrect"
24
24
  end
25
25
  end
26
26
 
@@ -31,7 +31,7 @@ class SessionsController < ApplicationController
31
31
 
32
32
  private
33
33
  def set_session
34
- @session = Current.user.sessions.find(params[:id])
34
+ @session = Current.<%= singular_table_name %>.sessions.find(params[:id])
35
35
  end
36
36
 
37
37
  def session_params
@@ -0,0 +1,21 @@
1
+ <p>Hey there,</p>
2
+
3
+ <p>A new device just signed in to your account (<%%= @session.<%= singular_table_name %>.email %>).</p>
4
+
5
+ <p>
6
+ <strong><%%= @session.user_agent %></strong>
7
+ <br>
8
+ <%%= @session.created_at %>
9
+ <br>
10
+ IP address: <%%= @session.ip_address %>
11
+ </p>
12
+
13
+ <p><strong>If this was you, carry on.</strong> We won't notify you about sign-ins from this device again.</p>
14
+
15
+ <p><strong>If you don't recognize this device</strong>, someone else may have accessed your account. You should immediately <%%= link_to "change your password", new_password_resets_url %>.</p>
16
+
17
+ <p><strong>Tip:</strong> It's a good idea to periodically review all of the <%%= link_to "devices and sessions", sessions_url %> in your account for suspicious activity.</p>
18
+
19
+ <hr>
20
+
21
+ <p>Have questions or need help? Just reply to this email and our support team will help you sort it out.</p>
@@ -0,0 +1,17 @@
1
+ Hey there,
2
+
3
+ A new device just signed in to your account (<%%= @session.<%= singular_table_name %>.email %>).
4
+
5
+ <%%= @session.user_agent %>
6
+
7
+ <%%= @session.created_at %>
8
+
9
+ <%%= @session.ip_address %>
10
+
11
+ If this was you, carry on. We won't notify you about sign-ins from this device again.
12
+
13
+ If you don't recognize this device, someone else may have accessed your account. You should immediately [change your password]<%%= new_password_resets_url %>.
14
+
15
+ Tip: It's a good idea to periodically review all of the [devices and sessions]<%%= sessions_url %> in your account for suspicious activity.
16
+
17
+ <p>Have questions or need help? Just reply to this email and our support team will help you sort it out.
@@ -1,10 +1,6 @@
1
1
  class PasswordMailer < ApplicationMailer
2
- def changed
3
- mail to: params[:<%= singular_table_name %>].email
4
- end
5
-
6
2
  def reset
7
3
  @signed_id = params[:<%= singular_table_name %>].signed_id(purpose: :password_reset, expires_in: 20.minutes)
8
- mail to: params[:<%= singular_table_name %>].email
4
+ mail to: params[:<%= singular_table_name %>].email, subject: "Reset your password"
9
5
  end
10
6
  end
@@ -0,0 +1,6 @@
1
+ class SessionMailer < ApplicationMailer
2
+ def signed_in
3
+ @session = params[:session]
4
+ mail to: @session.<%= singular_table_name %>.email, subject: "New sign-in to your account"
5
+ end
6
+ end
@@ -10,16 +10,4 @@ class <%= class_name %> < ApplicationRecord
10
10
  before_validation do
11
11
  self.email = email.downcase.strip
12
12
  end
13
-
14
- after_update_commit do
15
- if self.email_previously_changed?
16
- EmailMailer.with(change: self.email_previous_change).changed.deliver_later
17
- end
18
- end
19
-
20
- after_update_commit do
21
- if self.password_digest_previously_changed?
22
- PasswordMailer.with(<%= singular_table_name %>: self).changed.deliver_later
23
- end
24
- end
25
13
  end
@@ -1,3 +1,7 @@
1
1
  class Session < ApplicationRecord
2
2
  belongs_to :<%= singular_table_name %>
3
+
4
+ after_create_commit do
5
+ SessionMailer.with(session: self).signed_in.deliver_later
6
+ end
3
7
  end
@@ -6,17 +6,12 @@ class EmailsControllerTest < ActionDispatch::IntegrationTest
6
6
  end
7
7
 
8
8
  test "should update email" do
9
- assert_enqueued_email_with EmailMailer, :changed, args: { change: [@<%= singular_table_name %>.email, "new_email@hey.com"] } do
10
- patch emails_url, params: { current_password: "secret123", email: "new_email@hey.com" }, headers: { "Authorization" => "Bearer #{@token}" }
11
- end
12
-
9
+ patch emails_url, params: { current_password: "secret123", email: "new_email@hey.com" }, headers: { "Authorization" => "Bearer #{@token}" }
13
10
  assert_response :success
14
11
  end
15
12
 
16
13
  test "should not update email with wrong current password" do
17
- assert_no_enqueued_emails do
18
- patch emails_url, params: { current_password: "wrong_password", email: @<%= singular_table_name %>.email }, headers: { "Authorization" => "Bearer #{@token}" }
19
- end
14
+ patch emails_url, params: { current_password: "wrong_password", email: @<%= singular_table_name %>.email }, headers: { "Authorization" => "Bearer #{@token}" }
20
15
 
21
16
  assert_response :bad_request
22
17
  assert_equal "The current password you entered is incorrect", response.parsed_body["error"]
@@ -6,17 +6,12 @@ class PasswordsControllerTest < ActionDispatch::IntegrationTest
6
6
  end
7
7
 
8
8
  test "should update password" do
9
- assert_enqueued_email_with PasswordMailer, :changed, args: { <%= singular_table_name %>: @<%= singular_table_name %> } do
10
- patch passwords_url, params: { current_password: "secret123", password: "new_password", password_confirmation: "new_password" }, headers: { "Authorization" => "Bearer #{@token}" }
11
- end
12
-
9
+ patch passwords_url, params: { current_password: "secret123", password: "new_password", password_confirmation: "new_password" }, headers: { "Authorization" => "Bearer #{@token}" }
13
10
  assert_response :success
14
11
  end
15
12
 
16
13
  test "should not update password with wrong current password" do
17
- assert_no_enqueued_emails do
18
- patch passwords_url, params: { current_password: "wrong_password", password: "new_password", password_confirmation: "new_password" }, headers: { "Authorization" => "Bearer #{@token}" }
19
- end
14
+ patch passwords_url, params: { current_password: "wrong_password", password: "new_password", password_confirmation: "new_password" }, headers: { "Authorization" => "Bearer #{@token}" }
20
15
 
21
16
  assert_response :bad_request
22
17
  assert_equal "The current password you entered is incorrect", response.parsed_body["error"]
@@ -17,6 +17,8 @@ class SessionsControllerTest < ActionDispatch::IntegrationTest
17
17
 
18
18
  test "should sign in" do
19
19
  post sign_in_url, params: { email: @<%= singular_table_name %>.email, password: "secret123" }
20
+
21
+ assert_enqueued_email_with SessionMailer, :signed_in, args: { session: @<%= singular_table_name %>.sessions.last }
20
22
  assert_response :created
21
23
  end
22
24
 
@@ -19,6 +19,6 @@ class CancellationsControllerTest < ActionDispatch::IntegrationTest
19
19
  end
20
20
 
21
21
  def sign_in_as(<%= singular_table_name %>)
22
- post(sign_in_url, params: { email: <%= singular_table_name %>.email, password: "secret123" }); user
22
+ post(sign_in_url, params: { email: <%= singular_table_name %>.email, password: "secret123" }); <%= singular_table_name %>
23
23
  end
24
24
  end
@@ -11,23 +11,18 @@ class EmailsControllerTest < ActionDispatch::IntegrationTest
11
11
  end
12
12
 
13
13
  test "should update email" do
14
- assert_enqueued_email_with EmailMailer, :changed, args: { change: [@<%= singular_table_name %>.email, "new_email@hey.com"] } do
15
- patch emails_url, params: { current_password: "secret123", <%= singular_table_name %>: { email: "new_email@hey.com" } }
16
- end
17
-
14
+ patch emails_url, params: { current_password: "secret123", <%= singular_table_name %>: { email: "new_email@hey.com" } }
18
15
  assert_redirected_to root_path
19
16
  end
20
17
 
21
18
  test "should not update email with wrong current password" do
22
- assert_no_enqueued_emails do
23
- patch emails_url, params: { current_password: "wrong_password", <%= singular_table_name %>: { email: @<%= singular_table_name %>.email } }
24
- end
19
+ patch emails_url, params: { current_password: "wrong_password", <%= singular_table_name %>: { email: @<%= singular_table_name %>.email } }
25
20
 
26
21
  assert_redirected_to edit_emails_path
27
22
  assert_equal "The current password you entered is incorrect", flash[:alert]
28
23
  end
29
24
 
30
25
  def sign_in_as(<%= singular_table_name %>)
31
- post(sign_in_url, params: { email: <%= singular_table_name %>.email, password: "secret123" }); user
26
+ post(sign_in_url, params: { email: <%= singular_table_name %>.email, password: "secret123" }); <%= singular_table_name %>
32
27
  end
33
28
  end
@@ -11,23 +11,18 @@ class PasswordsControllerTest < ActionDispatch::IntegrationTest
11
11
  end
12
12
 
13
13
  test "should update password" do
14
- assert_enqueued_email_with PasswordMailer, :changed, args: { <%= singular_table_name %>: @<%= singular_table_name %> } do
15
- patch passwords_url, params: { current_password: "secret123", <%= singular_table_name %>: { password: "new_password", password_confirmation: "new_password" } }
16
- end
17
-
14
+ patch passwords_url, params: { current_password: "secret123", <%= singular_table_name %>: { password: "new_password", password_confirmation: "new_password" } }
18
15
  assert_redirected_to root_path
19
16
  end
20
17
 
21
18
  test "should not update password with wrong current password" do
22
- assert_no_enqueued_emails do
23
- patch passwords_url, params: { current_password: "wrong_password", <%= singular_table_name %>: { password: "new_password", password_confirmation: "new_password" } }
24
- end
19
+ patch passwords_url, params: { current_password: "wrong_password", <%= singular_table_name %>: { password: "new_password", password_confirmation: "new_password" } }
25
20
 
26
21
  assert_redirected_to edit_passwords_path
27
22
  assert_equal "The current password you entered is incorrect", flash[:alert]
28
23
  end
29
24
 
30
25
  def sign_in_as(<%= singular_table_name %>)
31
- post(sign_in_url, params: { email: <%= singular_table_name %>.email, password: "secret123" }); user
26
+ post(sign_in_url, params: { email: <%= singular_table_name %>.email, password: "secret123" }); <%= singular_table_name %>
32
27
  end
33
28
  end
@@ -10,9 +10,7 @@ class RegistrationsControllerTest < ActionDispatch::IntegrationTest
10
10
  assert_difference("<%= class_name %>.count") do
11
11
  post sign_up_url, params: { <%= singular_table_name %>: { email: "lazaronixon@hey.com", password: "secret123", password_confirmation: "secret123" } }
12
12
  end
13
- assert_redirected_to root_url
14
13
 
15
- follow_redirect!
16
- assert_response :success
14
+ assert_redirected_to sign_in_url
17
15
  end
18
16
  end
@@ -19,6 +19,8 @@ class SessionsControllerTest < ActionDispatch::IntegrationTest
19
19
 
20
20
  test "should sign in" do
21
21
  post sign_in_url, params: { email: @<%= singular_table_name %>.email, password: "secret123" }
22
+ assert_enqueued_email_with SessionMailer, :signed_in, args: { session: @<%= singular_table_name %>.sessions.last }
23
+
22
24
  assert_redirected_to root_url
23
25
 
24
26
  get root_url
@@ -28,7 +30,7 @@ class SessionsControllerTest < ActionDispatch::IntegrationTest
28
30
  test "should not sign in with wrong credentials" do
29
31
  post sign_in_url, params: { email: @<%= singular_table_name %>.email, password: "wrong_password" }
30
32
  assert_redirected_to sign_in_url(email_hint: @<%= singular_table_name %>.email)
31
- assert_equal "Invalid email or password", flash[:alert]
33
+ assert_equal "That email or password is incorrect", flash[:alert]
32
34
 
33
35
  get root_url
34
36
  assert_redirected_to sign_in_path
@@ -45,6 +47,6 @@ class SessionsControllerTest < ActionDispatch::IntegrationTest
45
47
  end
46
48
 
47
49
  def sign_in_as(<%= singular_table_name %>)
48
- post(sign_in_url, params: { email: <%= singular_table_name %>.email, password: "secret123" }); user
50
+ post(sign_in_url, params: { email: <%= singular_table_name %>.email, password: "secret123" }); <%= singular_table_name %>
49
51
  end
50
52
  end
@@ -1,6 +1,6 @@
1
1
  # Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
2
2
 
3
3
  lazaro_nixon_ios:
4
- user: lazaro_nixon
4
+ <%= singular_table_name %>: lazaro_nixon
5
5
  user_agent: Device iOS
6
6
  ip_address: 127.0.0.1
@@ -9,7 +9,7 @@ class CancellationsTest < ApplicationSystemTestCase
9
9
  click_on "Cancel my account & delete my data"
10
10
  click_on "OK, close my account"
11
11
 
12
- assert_text "Bye! Your account has been successfully cancelled"
12
+ assert_text "Your account is closed"
13
13
  end
14
14
 
15
15
  def sign_in_as(<%= singular_table_name %>)
@@ -19,5 +19,5 @@ class CancellationsTest < ApplicationSystemTestCase
19
19
  click_on "Sign in"
20
20
 
21
21
  return <%= singular_table_name %>
22
- end
22
+ end
23
23
  end
@@ -12,7 +12,7 @@ class EmailsTest < ApplicationSystemTestCase
12
12
  fill_in "New email", with: "new_email@hey.com"
13
13
  click_on "Save changes"
14
14
 
15
- assert_text "Your email has been changed successfully"
15
+ assert_text "Your email has been changed"
16
16
  end
17
17
 
18
18
  def sign_in_as(<%= singular_table_name %>)
@@ -22,5 +22,5 @@ class EmailsTest < ApplicationSystemTestCase
22
22
  click_on "Sign in"
23
23
 
24
24
  return <%= singular_table_name %>
25
- end
25
+ end
26
26
  end
@@ -13,7 +13,7 @@ class PasswordResetsTest < ApplicationSystemTestCase
13
13
  fill_in "Email", with: @<%= singular_table_name %>.email
14
14
  click_on "Send password reset email"
15
15
 
16
- assert_text "You will receive an email with instructions on how to reset your password in a few minutes"
16
+ assert_text "Check your email for reset instructions"
17
17
  end
18
18
 
19
19
  test "updating password" do
@@ -13,7 +13,7 @@ class PasswordsTest < ApplicationSystemTestCase
13
13
  fill_in "Confirm new password", with: "new_password"
14
14
  click_on "Save changes"
15
15
 
16
- assert_text "Your password has been changed successfully"
16
+ assert_text "Your password has been changed"
17
17
  end
18
18
 
19
19
  def sign_in_as(<%= singular_table_name %>)
@@ -23,5 +23,5 @@ class PasswordsTest < ApplicationSystemTestCase
23
23
  click_on "Sign in"
24
24
 
25
25
  return <%= singular_table_name %>
26
- end
26
+ end
27
27
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: authentication-zero
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nixon
@@ -44,21 +44,19 @@ files:
44
44
  - lib/generators/authentication/templates/controllers/html/registrations_controller.rb.tt
45
45
  - lib/generators/authentication/templates/controllers/html/sessions_controller.rb.tt
46
46
  - lib/generators/authentication/templates/erb/cancellations/new.html.erb.tt
47
- - lib/generators/authentication/templates/erb/email_mailer/changed.html.erb.tt
48
- - lib/generators/authentication/templates/erb/email_mailer/changed.text.erb.tt
49
47
  - lib/generators/authentication/templates/erb/emails/edit.html.erb.tt
50
- - lib/generators/authentication/templates/erb/password_mailer/changed.html.erb.tt
51
- - lib/generators/authentication/templates/erb/password_mailer/changed.text.erb.tt
52
48
  - lib/generators/authentication/templates/erb/password_mailer/reset.html.erb.tt
53
49
  - lib/generators/authentication/templates/erb/password_mailer/reset.text.erb.tt
54
50
  - lib/generators/authentication/templates/erb/password_resets/edit.html.erb.tt
55
51
  - lib/generators/authentication/templates/erb/password_resets/new.html.erb.tt
56
52
  - lib/generators/authentication/templates/erb/passwords/edit.html.erb.tt
57
53
  - lib/generators/authentication/templates/erb/registrations/new.html.erb.tt
54
+ - lib/generators/authentication/templates/erb/session_mailer/signed_in.html.erb.tt
55
+ - lib/generators/authentication/templates/erb/session_mailer/signed_in.text.erb.tt
58
56
  - lib/generators/authentication/templates/erb/sessions/index.html.erb.tt
59
57
  - lib/generators/authentication/templates/erb/sessions/new.html.erb.tt
60
- - lib/generators/authentication/templates/mailers/email_mailer.rb.tt
61
58
  - lib/generators/authentication/templates/mailers/password_mailer.rb.tt
59
+ - lib/generators/authentication/templates/mailers/session_mailer.rb.tt
62
60
  - lib/generators/authentication/templates/migrations/create_sessions_migration.rb.tt
63
61
  - lib/generators/authentication/templates/migrations/create_table_migration.rb.tt
64
62
  - lib/generators/authentication/templates/models/current.rb.tt
@@ -1,11 +0,0 @@
1
- <p>Hey there,</p>
2
-
3
- <p>We just wanted to confirm that your email address has been updated.</p>
4
-
5
- <p><strong>Before, it was: <%%= @previous_email %></strong></p>
6
-
7
- <p><strong>Now it is set to: <%%= @current_email %></strong></p>
8
-
9
- <hr>
10
-
11
- <p>If you didn't make this change, someone else may have access to your account. If you think that may be the case, please reply to this email and our support team will help you out.</p>
@@ -1,9 +0,0 @@
1
- Hey there,
2
-
3
- We just wanted to confirm that your email address has been updated.
4
-
5
- Before, it was: <%%= @previous_email %>
6
-
7
- Now it is set to: <%%= @current_email %>
8
-
9
- If you didn't make this change, someone else may have access to your account. If you think that may be the case, please reply to this email and our support team will help you out.
@@ -1,7 +0,0 @@
1
- <p>Hey there,</p>
2
-
3
- <p>We just wanted to confirm that your password has been updated.</p>
4
-
5
- <hr>
6
-
7
- <p>If you didn't make this change, someone else may have access to your account. If you think that may be the case, please reply to this email and our support team will help you out.</p>
@@ -1,5 +0,0 @@
1
- Hey there,
2
-
3
- We just wanted to confirm that your password has been updated.
4
-
5
- If you didn't make this change, someone else may have access to your account. If you think that may be the case, please reply to this email and our support team will help you out.
@@ -1,6 +0,0 @@
1
- class EmailMailer < ApplicationMailer
2
- def changed
3
- @previous_email, @current_email = params[:change]
4
- mail to: @previous_email
5
- end
6
- end