authentication-zero 0.0.6 → 0.0.10

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.
Files changed (20) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +1 -1
  3. data/lib/authentication_zero/version.rb +1 -1
  4. data/lib/generators/authentication/authentication_generator.rb +3 -3
  5. data/lib/generators/authentication/templates/controllers/api/password_resets_controller.rb.tt +6 -1
  6. data/lib/generators/authentication/templates/controllers/html/password_resets_controller.rb.tt +2 -1
  7. data/lib/generators/authentication/templates/mailers/password_mailer.rb.tt +1 -1
  8. data/lib/generators/authentication/templates/views/{html/cancellations → cancellations}/new.html.erb.tt +1 -1
  9. data/lib/generators/authentication/templates/views/password_mailer/reset.html.erb.tt +11 -0
  10. data/lib/generators/authentication/templates/views/password_mailer/reset.text.erb.tt +9 -0
  11. data/lib/generators/authentication/templates/views/{html/password_resets → password_resets}/edit.html.erb.tt +4 -10
  12. data/lib/generators/authentication/templates/views/{html/password_resets → password_resets}/new.html.erb.tt +1 -8
  13. data/lib/generators/authentication/templates/views/{html/passwords → passwords}/edit.html.erb.tt +3 -2
  14. data/lib/generators/authentication/templates/views/{html/registrations → registrations}/new.html.erb.tt +2 -7
  15. data/lib/generators/authentication/templates/views/{html/sessions → sessions}/new.html.erb.tt +0 -0
  16. metadata +10 -12
  17. data/lib/generators/authentication/templates/views/api/password_mailer/reset.html.erb.tt +0 -7
  18. data/lib/generators/authentication/templates/views/api/password_mailer/reset.text.erb.tt +0 -7
  19. data/lib/generators/authentication/templates/views/html/password_mailer/reset.html.erb.tt +0 -7
  20. data/lib/generators/authentication/templates/views/html/password_mailer/reset.text.erb.tt +0 -7
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2f6baaecd5d394f4a5a589851c45638015379cf53022c6ca601b7aa49b46b1da
4
- data.tar.gz: 93a28f7c9762aa2534672e45d25ee75b7708ec2e53fd629497bee70c77d1bbd4
3
+ metadata.gz: ff917e8d503041f0656c5897b5ccf89d2304b73633dc41198089052b3eeab2b5
4
+ data.tar.gz: c6c2d8e0be204bc3eb59bdf62aebe98a8b1de24e8610d2653bf8b274db3c3813
5
5
  SHA512:
6
- metadata.gz: 60439dd077e66f946f61663ffc1a0d395a3dcffd25793764eb0399b1163c9061b7917cbacd98ce74695c84bb5d363d42eb04dc09a8c2ceafb33413743f101683
7
- data.tar.gz: 56756318409dbe854b7db0566e3a510f80d668aa399e38744b78aa9c3d604dd0b8a6321563b36f202dc618149ccb551ecbaf81c23b3afdbb03c766e50bb5fdac
6
+ metadata.gz: 54a53d0d0124155b3187ee51d568310834bb63fbab8c99520ecd816bdad57ad3bdc450105509b721fce934d13952f43db08d35178c8365e63526baa940f1e32e
7
+ data.tar.gz: 629dccfe0f036adea1bdb3655d574bbbe713259ac55a56769f475405cfcb27c6006199a0b33225ca0dc6826db87e3c21ac84a9e4a1813210d304997f59acbe0d
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- authentication-zero (0.0.6)
4
+ authentication-zero (0.0.10)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -1,3 +1,3 @@
1
1
  module AuthenticationZero
2
- VERSION = "0.0.6"
2
+ VERSION = "0.0.10"
3
3
  end
@@ -21,9 +21,9 @@ class AuthenticationGenerator < Rails::Generators::NamedBase
21
21
 
22
22
  def create_views
23
23
  if options.api
24
- directory "views/api", "app/views"
24
+ directory "views/password_mailer", "app/views/password_mailer"
25
25
  else
26
- directory "views/html", "app/views"
26
+ directory "views", "app/views"
27
27
  end
28
28
  end
29
29
 
@@ -47,7 +47,7 @@ class AuthenticationGenerator < Rails::Generators::NamedBase
47
47
  route "post 'cancellation', to: 'cancellations#destroy'"
48
48
  route "get 'password_reset/new', to: 'password_resets#new'" unless options.api?
49
49
  route "post 'password_reset', to: 'password_resets#create'"
50
- route "get 'password_reset/edit', to: 'password_resets#edit'" unless options.api?
50
+ route "get 'password_reset/edit', to: 'password_resets#edit'"
51
51
  route "patch 'password_reset', to: 'password_resets#update'"
52
52
  route "delete 'sign_out', to: 'sessions#destroy'"
53
53
  end
@@ -1,7 +1,12 @@
1
1
  class PasswordResetsController < ApplicationController
2
- before_action :set_<%= singular_table_name %>, only: :update
3
2
  skip_before_action :authenticate
4
3
 
4
+ before_action :set_<%= singular_table_name %>, only: %i[ edit update ]
5
+
6
+ def edit
7
+ render json: { error: "Open this link in your device" }, status: :not_found
8
+ end
9
+
5
10
  def create
6
11
  if @<%= singular_table_name %> = <%= class_name %>.find_by_email(params[:email])
7
12
  PasswordMailer.with(<%= singular_table_name %>: @<%= singular_table_name %>).reset.deliver_later
@@ -1,7 +1,8 @@
1
1
  class PasswordResetsController < ApplicationController
2
- before_action :set_<%= singular_table_name %>, only: %i[ edit update ]
3
2
  skip_before_action :authenticate
4
3
 
4
+ before_action :set_<%= singular_table_name %>, only: %i[ edit update ]
5
+
5
6
  def new
6
7
  end
7
8
 
@@ -1,6 +1,6 @@
1
1
  class PasswordMailer < ApplicationMailer
2
2
  def reset
3
- @token = params[:<%= singular_table_name %>].signed_id(purpose: "password_reset", expires_in: 15.minutes)
3
+ @token = params[:<%= singular_table_name %>].signed_id(purpose: "password_reset", expires_in: 20.minutes)
4
4
  mail to: params[:<%= singular_table_name %>].email
5
5
  end
6
6
  end
@@ -7,5 +7,5 @@
7
7
  <br>
8
8
 
9
9
  <div>
10
- <%%= button_to "OK, close my account", cancellation_path, method: :post %>
10
+ <%%= button_to "OK, close my account", cancellation_path %>
11
11
  </div>
@@ -0,0 +1,11 @@
1
+ <p>Hey there,</p>
2
+
3
+ <p>Can’t remember your password for <strong><%%= params[:<%= singular_table_name %>].email %></strong>? That’s OK, it happens. Just hit the link below to set a new one.</p>
4
+
5
+ <p><%%= link_to "Reset my password", password_reset_edit_url(token: @token) %></p>
6
+
7
+ <p>If you did not request a password reset you can safely ignore this email, it expires in 20 minutes. Only someone with access to this email account can reset your password.</p>
8
+
9
+ <hr>
10
+
11
+ <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,9 @@
1
+ Hey there,
2
+
3
+ Can’t remember your password for <%%= params[:<%= singular_table_name %>].email %>? That’s OK, it happens. Just hit the link below to set a new one.
4
+
5
+ [Reset my password]<%%= password_reset_edit_url(token: @token) %>
6
+
7
+ If you did not request a password reset you can safely ignore this email, it expires in 20 minutes. Only someone with access to this email account can reset your password.
8
+
9
+ Have questions or need help? Just reply to this email and our support team will help you sort it out.
@@ -14,23 +14,17 @@
14
14
  <%% end %>
15
15
 
16
16
  <div>
17
- <%%= form.label :password, "New password (8 characters minimum)", style: "display: block" %>
17
+ <%%= form.label :password, "New password", style: "display: block" %>
18
18
  <%%= form.password_field :password, autofocus: true, autocomplete: "new-password" %>
19
+ <div>8 characters minimum.</div>
19
20
  </div>
20
21
 
21
22
  <div>
22
- <%%= form.label :password_confirmation, style: "display: block" %>
23
+ <%%= form.label :password_confirmation, "Confirm new password", style: "display: block" %>
23
24
  <%%= form.password_field :password_confirmation, autocomplete: "new-password" %>
24
25
  </div>
25
26
 
26
27
  <div>
27
- <%%= form.submit "Reset password" %>
28
+ <%%= form.submit "Save changes" %>
28
29
  </div>
29
30
  <%% end %>
30
-
31
- <br>
32
-
33
- <div>
34
- <%%= link_to "Sign in", sign_in_path %> |
35
- <%%= link_to "Sign up", sign_up_path %>
36
- </div>
@@ -5,17 +5,10 @@
5
5
  <%%= form_with(url: password_reset_path) do |form| %>
6
6
  <div>
7
7
  <%%= form.label :email, style: "display: block" %>
8
- <%%= form.email_field :email, autofocus: true, required: true, autocomplete: "email" %>
8
+ <%%= form.email_field :email, autofocus: true, required: true %>
9
9
  </div>
10
10
 
11
11
  <div>
12
12
  <%%= form.submit "Send password reset email" %>
13
13
  </div>
14
14
  <%% end %>
15
-
16
- <br>
17
-
18
- <div>
19
- <%%= link_to "Sign in", sign_in_path %> |
20
- <%%= link_to "Sign up", sign_up_path %>
21
- </div>
@@ -21,12 +21,13 @@
21
21
  </div>
22
22
 
23
23
  <div>
24
- <%%= form.label :password, "New password (8 characters minimum)", style: "display: block" %>
24
+ <%%= form.label :password, "New password", style: "display: block" %>
25
25
  <%%= form.password_field :password, autocomplete: "new-password" %>
26
+ <div>8 characters minimum.</div>
26
27
  </div>
27
28
 
28
29
  <div>
29
- <%%= form.label :password_confirmation, style: "display: block" %>
30
+ <%%= form.label :password_confirmation, "Confirm new password", style: "display: block" %>
30
31
  <%%= form.password_field :password_confirmation, autocomplete: "new-password" %>
31
32
  </div>
32
33
 
@@ -19,8 +19,9 @@
19
19
  </div>
20
20
 
21
21
  <div>
22
- <%%= form.label :password, "Password (8 characters minimum)", style: "display: block" %>
22
+ <%%= form.label :password, style: "display: block" %>
23
23
  <%%= form.password_field :password, autocomplete: "new-password" %>
24
+ <div>8 characters minimum.</div>
24
25
  </div>
25
26
 
26
27
  <div>
@@ -32,9 +33,3 @@
32
33
  <%%= form.submit "Sign up" %>
33
34
  </div>
34
35
  <%% end %>
35
-
36
- <br>
37
-
38
- <div>
39
- <%%= link_to "Sign in", sign_in_path %>
40
- </div>
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: authentication-zero
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nixon
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-02-15 00:00:00.000000000 Z
11
+ date: 2022-02-16 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description:
14
14
  email:
@@ -45,16 +45,14 @@ files:
45
45
  - lib/generators/authentication/templates/migration.rb.tt
46
46
  - lib/generators/authentication/templates/models/current.rb.tt
47
47
  - lib/generators/authentication/templates/models/resource.rb.tt
48
- - lib/generators/authentication/templates/views/api/password_mailer/reset.html.erb.tt
49
- - lib/generators/authentication/templates/views/api/password_mailer/reset.text.erb.tt
50
- - lib/generators/authentication/templates/views/html/cancellations/new.html.erb.tt
51
- - lib/generators/authentication/templates/views/html/password_mailer/reset.html.erb.tt
52
- - lib/generators/authentication/templates/views/html/password_mailer/reset.text.erb.tt
53
- - lib/generators/authentication/templates/views/html/password_resets/edit.html.erb.tt
54
- - lib/generators/authentication/templates/views/html/password_resets/new.html.erb.tt
55
- - lib/generators/authentication/templates/views/html/passwords/edit.html.erb.tt
56
- - lib/generators/authentication/templates/views/html/registrations/new.html.erb.tt
57
- - lib/generators/authentication/templates/views/html/sessions/new.html.erb.tt
48
+ - lib/generators/authentication/templates/views/cancellations/new.html.erb.tt
49
+ - lib/generators/authentication/templates/views/password_mailer/reset.html.erb.tt
50
+ - lib/generators/authentication/templates/views/password_mailer/reset.text.erb.tt
51
+ - lib/generators/authentication/templates/views/password_resets/edit.html.erb.tt
52
+ - lib/generators/authentication/templates/views/password_resets/new.html.erb.tt
53
+ - lib/generators/authentication/templates/views/passwords/edit.html.erb.tt
54
+ - lib/generators/authentication/templates/views/registrations/new.html.erb.tt
55
+ - lib/generators/authentication/templates/views/sessions/new.html.erb.tt
58
56
  homepage: https://github.com/lazaronixon/authentication-zero
59
57
  licenses:
60
58
  - MIT
@@ -1,7 +0,0 @@
1
- Hi <%%= params[:<%= singular_table_name %>].email %>,
2
-
3
- Someone requested a reset of your password.
4
-
5
- If this was you, use this token to reset your password. The token will expire automatically in 15 minutes.
6
-
7
- <%%= @token %>
@@ -1,7 +0,0 @@
1
- Hi <%%= params[:<%= singular_table_name %>].email %>,
2
-
3
- Someone requested a reset of your password.
4
-
5
- If this was you, use this token to reset your password. The token will expire automatically in 15 minutes.
6
-
7
- <%%= @token %>
@@ -1,7 +0,0 @@
1
- Hi <%%= params[:<%= singular_table_name %>].email %>,
2
-
3
- Someone requested a reset of your password.
4
-
5
- If this was you, click the link to reset your password. The link will expire automatically in 15 minutes.
6
-
7
- <%%= link_to "Reset password", password_reset_edit_url(token: @token) %>
@@ -1,7 +0,0 @@
1
- Hi <%%= params[:<%= singular_table_name %>].email %>,
2
-
3
- Someone requested a reset of your password.
4
-
5
- If this was you, click the link to reset your password. The link will expire automatically in 15 minutes.
6
-
7
- <%%= password_reset_edit_url(token: @token) %>