rails_authentication 0.6.0 → 0.8.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.
Files changed (74) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +100 -10
  3. data/lib/generators/authentication/authentication_generator.rb +135 -8
  4. data/lib/generators/authentication/features/confirmable.rb +5 -5
  5. data/lib/generators/authentication/features/invitable.rb +5 -5
  6. data/lib/generators/authentication/features/lockable.rb +5 -5
  7. data/lib/generators/authentication/features/magic_link.rb +5 -5
  8. data/lib/generators/authentication/features/ott.rb +5 -5
  9. data/lib/generators/authentication/features/recoverable.rb +8 -6
  10. data/lib/generators/authentication/features/rememberable.rb +8 -3
  11. data/lib/generators/authentication/templates/app/controllers/concerns/authentication.rb.tt +67 -15
  12. data/lib/generators/authentication/templates/app/controllers/confirmations_controller.rb.tt +11 -7
  13. data/lib/generators/authentication/templates/app/controllers/invitations_controller.rb.tt +14 -5
  14. data/lib/generators/authentication/templates/app/controllers/magic_links_controller.rb.tt +10 -8
  15. data/lib/generators/authentication/templates/app/controllers/otts_controller.rb.tt +18 -15
  16. data/lib/generators/authentication/templates/app/controllers/passkey_sessions_controller.rb.tt +9 -7
  17. data/lib/generators/authentication/templates/app/controllers/passwords_controller.rb.tt +22 -9
  18. data/lib/generators/authentication/templates/app/controllers/registrations_controller.rb.tt +8 -6
  19. data/lib/generators/authentication/templates/app/controllers/sessions_controller.rb.tt +11 -9
  20. data/lib/generators/authentication/templates/app/controllers/unlocks_controller.rb.tt +8 -6
  21. data/lib/generators/authentication/templates/app/controllers/webauthn_credentials_controller.rb.tt +8 -4
  22. data/lib/generators/authentication/templates/app/mailers/confirmations_mailer.rb.tt +4 -2
  23. data/lib/generators/authentication/templates/app/mailers/invitations_mailer.rb.tt +3 -1
  24. data/lib/generators/authentication/templates/app/mailers/magic_links_mailer.rb.tt +3 -1
  25. data/lib/generators/authentication/templates/app/mailers/otts_mailer.rb.tt +3 -1
  26. data/lib/generators/authentication/templates/app/mailers/passwords_mailer.rb.tt +3 -1
  27. data/lib/generators/authentication/templates/app/mailers/unlocks_mailer.rb.tt +3 -1
  28. data/lib/generators/authentication/templates/app/models/concerns/confirmable_concern.rb.tt +16 -11
  29. data/lib/generators/authentication/templates/app/models/concerns/invitable_concern.rb.tt +13 -2
  30. data/lib/generators/authentication/templates/app/models/concerns/lockable_concern.rb.tt +8 -0
  31. data/lib/generators/authentication/templates/app/models/concerns/magic_link_concern.rb.tt +2 -0
  32. data/lib/generators/authentication/templates/app/models/concerns/ott_concern.rb.tt +2 -0
  33. data/lib/generators/authentication/templates/app/models/concerns/passkey_concern.rb.tt +2 -0
  34. data/lib/generators/authentication/templates/app/models/concerns/recoverable_concern.rb.tt +8 -0
  35. data/lib/generators/authentication/templates/app/models/concerns/timeoutable_concern.rb.tt +2 -0
  36. data/lib/generators/authentication/templates/app/models/concerns/trackable_concern.rb.tt +2 -0
  37. data/lib/generators/authentication/templates/app/models/concerns/validatable_concern.rb.tt +6 -4
  38. data/lib/generators/authentication/templates/app/models/session.rb.tt +45 -0
  39. data/lib/generators/authentication/templates/app/models/user_auth.rb.tt +5 -3
  40. data/lib/generators/authentication/templates/app/models/webauthn_credential.rb.tt +2 -0
  41. data/lib/generators/authentication/templates/app/views/confirmations/new.html.erb.tt +3 -3
  42. data/lib/generators/authentication/templates/app/views/confirmations_mailer/confirmation_instructions.html.erb.tt +3 -3
  43. data/lib/generators/authentication/templates/app/views/confirmations_mailer/confirmation_instructions.text.erb.tt +2 -2
  44. data/lib/generators/authentication/templates/app/views/invitations/edit.html.erb.tt +4 -4
  45. data/lib/generators/authentication/templates/app/views/invitations/new.html.erb.tt +3 -3
  46. data/lib/generators/authentication/templates/app/views/invitations_mailer/invitation_instructions.html.erb.tt +3 -3
  47. data/lib/generators/authentication/templates/app/views/invitations_mailer/invitation_instructions.text.erb.tt +2 -2
  48. data/lib/generators/authentication/templates/app/views/magic_links/new.html.erb.tt +4 -4
  49. data/lib/generators/authentication/templates/app/views/magic_links_mailer/magic_link.html.erb.tt +3 -3
  50. data/lib/generators/authentication/templates/app/views/magic_links_mailer/magic_link.text.erb.tt +2 -3
  51. data/lib/generators/authentication/templates/app/views/otts/edit.html.erb.tt +7 -7
  52. data/lib/generators/authentication/templates/app/views/otts_mailer/ott.html.erb.tt +3 -3
  53. data/lib/generators/authentication/templates/app/views/otts_mailer/ott.text.erb.tt +3 -3
  54. data/lib/generators/authentication/templates/app/views/passwords/edit.html.erb.tt +9 -0
  55. data/lib/generators/authentication/templates/app/views/passwords/new.html.erb.tt +8 -0
  56. data/lib/generators/authentication/templates/app/views/passwords_mailer/reset.html.erb.tt +3 -3
  57. data/lib/generators/authentication/templates/app/views/passwords_mailer/reset.text.erb.tt +2 -2
  58. data/lib/generators/authentication/templates/app/views/registrations/edit.html.erb.tt +7 -7
  59. data/lib/generators/authentication/templates/app/views/registrations/new.html.erb.tt +6 -6
  60. data/lib/generators/authentication/templates/app/views/sessions/new.html.erb.tt +20 -16
  61. data/lib/generators/authentication/templates/app/views/unlocks/new.html.erb.tt +3 -3
  62. data/lib/generators/authentication/templates/app/views/unlocks_mailer/unlock_instructions.html.erb.tt +3 -3
  63. data/lib/generators/authentication/templates/app/views/unlocks_mailer/unlock_instructions.text.erb.tt +3 -3
  64. data/lib/generators/authentication/templates/app/views/webauthn_credentials/index.html.erb.tt +5 -5
  65. data/lib/generators/authentication/templates/app/views/webauthn_credentials/new.html.erb.tt +12 -6
  66. data/lib/generators/authentication/templates/config/initializers/webauthn.rb.tt +2 -0
  67. data/lib/generators/authentication/templates/config/locales/authentication.en.yml.tt +421 -0
  68. data/lib/generators/authentication/templates/db/migrate/add_confirmable_to_users.rb.tt +1 -1
  69. data/lib/generators/authentication/templates/db/migrate/add_rememberable_to_sessions.rb.tt +5 -0
  70. data/lib/generators/authentication/templates/db/migrate/remove_remember_created_at_from_users.rb.tt +11 -0
  71. data/lib/rails_authentication/version.rb +1 -1
  72. metadata +8 -3
  73. data/lib/generators/authentication/templates/app/models/concerns/rememberable_concern.rb.tt +0 -15
  74. data/lib/generators/authentication/templates/db/migrate/add_rememberable_to_users.rb.tt +0 -5
@@ -0,0 +1,5 @@
1
+ class AddRememberableToSessions < ActiveRecord::Migration<%= migration_version %>
2
+ def change
3
+ add_column :sessions, :remembered_at, :datetime
4
+ end
5
+ end
@@ -0,0 +1,11 @@
1
+ class RemoveRememberCreatedAtFromUsers < ActiveRecord::Migration<%= migration_version %>
2
+ # "Remember me" moved from users to sessions (see add_rememberable_to_sessions). Apps generated
3
+ # before that have this column; new apps don't, so it's a no-op for them.
4
+ def up
5
+ remove_column :users, :remember_created_at if column_exists?(:users, :remember_created_at)
6
+ end
7
+
8
+ def down
9
+ add_column :users, :remember_created_at, :datetime unless column_exists?(:users, :remember_created_at)
10
+ end
11
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RailsAuthentication
4
- VERSION = "0.6.0"
4
+ VERSION = "0.8.0"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails_authentication
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Freerksen
@@ -70,10 +70,10 @@ files:
70
70
  - lib/generators/authentication/templates/app/models/concerns/ott_concern.rb.tt
71
71
  - lib/generators/authentication/templates/app/models/concerns/passkey_concern.rb.tt
72
72
  - lib/generators/authentication/templates/app/models/concerns/recoverable_concern.rb.tt
73
- - lib/generators/authentication/templates/app/models/concerns/rememberable_concern.rb.tt
74
73
  - lib/generators/authentication/templates/app/models/concerns/timeoutable_concern.rb.tt
75
74
  - lib/generators/authentication/templates/app/models/concerns/trackable_concern.rb.tt
76
75
  - lib/generators/authentication/templates/app/models/concerns/validatable_concern.rb.tt
76
+ - lib/generators/authentication/templates/app/models/session.rb.tt
77
77
  - lib/generators/authentication/templates/app/models/user_auth.rb.tt
78
78
  - lib/generators/authentication/templates/app/models/webauthn_credential.rb.tt
79
79
  - lib/generators/authentication/templates/app/views/confirmations/new.html.erb.tt
@@ -89,6 +89,8 @@ files:
89
89
  - lib/generators/authentication/templates/app/views/otts/edit.html.erb.tt
90
90
  - lib/generators/authentication/templates/app/views/otts_mailer/ott.html.erb.tt
91
91
  - lib/generators/authentication/templates/app/views/otts_mailer/ott.text.erb.tt
92
+ - lib/generators/authentication/templates/app/views/passwords/edit.html.erb.tt
93
+ - lib/generators/authentication/templates/app/views/passwords/new.html.erb.tt
92
94
  - lib/generators/authentication/templates/app/views/passwords_mailer/reset.html.erb.tt
93
95
  - lib/generators/authentication/templates/app/views/passwords_mailer/reset.text.erb.tt
94
96
  - lib/generators/authentication/templates/app/views/registrations/edit.html.erb.tt
@@ -100,16 +102,18 @@ files:
100
102
  - lib/generators/authentication/templates/app/views/webauthn_credentials/index.html.erb.tt
101
103
  - lib/generators/authentication/templates/app/views/webauthn_credentials/new.html.erb.tt
102
104
  - lib/generators/authentication/templates/config/initializers/webauthn.rb.tt
105
+ - lib/generators/authentication/templates/config/locales/authentication.en.yml.tt
103
106
  - lib/generators/authentication/templates/db/migrate/add_confirmable_to_users.rb.tt
104
107
  - lib/generators/authentication/templates/db/migrate/add_invitable_to_users.rb.tt
105
108
  - lib/generators/authentication/templates/db/migrate/add_lockable_to_users.rb.tt
106
109
  - lib/generators/authentication/templates/db/migrate/add_magic_link_to_users.rb.tt
107
110
  - lib/generators/authentication/templates/db/migrate/add_ott_to_users.rb.tt
108
111
  - lib/generators/authentication/templates/db/migrate/add_recoverable_to_users.rb.tt
109
- - lib/generators/authentication/templates/db/migrate/add_rememberable_to_users.rb.tt
112
+ - lib/generators/authentication/templates/db/migrate/add_rememberable_to_sessions.rb.tt
110
113
  - lib/generators/authentication/templates/db/migrate/add_webauthn_id_to_users.rb.tt
111
114
  - lib/generators/authentication/templates/db/migrate/create_user_auths.rb.tt
112
115
  - lib/generators/authentication/templates/db/migrate/create_webauthn_credentials.rb.tt
116
+ - lib/generators/authentication/templates/db/migrate/remove_remember_created_at_from_users.rb.tt
113
117
  - lib/rails_authentication.rb
114
118
  - lib/rails_authentication/version.rb
115
119
  homepage: https://github.com/dfreerksen/rails_authentication
@@ -118,6 +122,7 @@ licenses:
118
122
  metadata:
119
123
  homepage_uri: https://github.com/dfreerksen/rails_authentication
120
124
  source_code_uri: https://github.com/dfreerksen/rails_authentication
125
+ rubygems_mfa_required: 'true'
121
126
  rdoc_options: []
122
127
  require_paths:
123
128
  - lib
@@ -1,15 +0,0 @@
1
- module RememberableConcern
2
- extend ActiveSupport::Concern
3
-
4
- def remembered?
5
- remember_created_at.present?
6
- end
7
-
8
- def remember_me!
9
- update!(remember_created_at: Time.current)
10
- end
11
-
12
- def forget_me!
13
- update!(remember_created_at: nil) if remember_created_at.present?
14
- end
15
- end
@@ -1,5 +0,0 @@
1
- class AddRememberableToUsers < ActiveRecord::Migration<%= migration_version %>
2
- def change
3
- add_column :users, :remember_created_at, :datetime
4
- end
5
- end