rodauth-rails 0.16.0 → 0.18.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +54 -0
- data/README.md +97 -36
- data/lib/generators/rodauth/install_generator.rb +11 -3
- data/lib/generators/rodauth/migration/base.erb +8 -2
- data/lib/generators/rodauth/templates/app/views/rodauth/_email_auth_request_form.html.erb +7 -4
- data/lib/generators/rodauth/templates/app/views/rodauth/_login_form.html.erb +26 -9
- data/lib/generators/rodauth/templates/app/views/rodauth/_login_form_footer.html.erb +7 -6
- data/lib/generators/rodauth/templates/app/views/rodauth/_login_form_header.html.erb +3 -3
- data/lib/generators/rodauth/templates/app/views/rodauth/add_recovery_codes.html.erb +7 -5
- data/lib/generators/rodauth/templates/app/views/rodauth/change_login.html.erb +29 -6
- data/lib/generators/rodauth/templates/app/views/rodauth/change_password.html.erb +29 -6
- data/lib/generators/rodauth/templates/app/views/rodauth/close_account.html.erb +15 -4
- data/lib/generators/rodauth/templates/app/views/rodauth/confirm_password.html.erb +13 -4
- data/lib/generators/rodauth/templates/app/views/rodauth/create_account.html.erb +37 -7
- data/lib/generators/rodauth/templates/app/views/rodauth/email_auth.html.erb +7 -3
- data/lib/generators/rodauth/templates/app/views/rodauth/login.html.erb +5 -3
- data/lib/generators/rodauth/templates/app/views/rodauth/logout.html.erb +16 -4
- data/lib/generators/rodauth/templates/app/views/rodauth/multi_phase_login.html.erb +5 -3
- data/lib/generators/rodauth/templates/app/views/rodauth/otp_auth.html.erb +17 -4
- data/lib/generators/rodauth/templates/app/views/rodauth/otp_disable.html.erb +15 -4
- data/lib/generators/rodauth/templates/app/views/rodauth/otp_setup.html.erb +30 -10
- data/lib/generators/rodauth/templates/app/views/rodauth/recovery_auth.html.erb +13 -4
- data/lib/generators/rodauth/templates/app/views/rodauth/recovery_codes.html.erb +15 -1
- data/lib/generators/rodauth/templates/app/views/rodauth/remember.html.erb +14 -9
- data/lib/generators/rodauth/templates/app/views/rodauth/reset_password.html.erb +21 -5
- data/lib/generators/rodauth/templates/app/views/rodauth/reset_password_request.html.erb +19 -9
- data/lib/generators/rodauth/templates/app/views/rodauth/sms_auth.html.erb +17 -4
- data/lib/generators/rodauth/templates/app/views/rodauth/sms_confirm.html.erb +17 -4
- data/lib/generators/rodauth/templates/app/views/rodauth/sms_disable.html.erb +15 -4
- data/lib/generators/rodauth/templates/app/views/rodauth/sms_request.html.erb +7 -3
- data/lib/generators/rodauth/templates/app/views/rodauth/sms_setup.html.erb +25 -5
- data/lib/generators/rodauth/templates/app/views/rodauth/two_factor_auth.html.erb +5 -3
- data/lib/generators/rodauth/templates/app/views/rodauth/two_factor_disable.html.erb +15 -4
- data/lib/generators/rodauth/templates/app/views/rodauth/two_factor_manage.html.erb +17 -15
- data/lib/generators/rodauth/templates/app/views/rodauth/unlock_account.html.erb +17 -5
- data/lib/generators/rodauth/templates/app/views/rodauth/unlock_account_request.html.erb +11 -5
- data/lib/generators/rodauth/templates/app/views/rodauth/verify_account.html.erb +23 -5
- data/lib/generators/rodauth/templates/app/views/rodauth/verify_account_resend.html.erb +19 -9
- data/lib/generators/rodauth/templates/app/views/rodauth/verify_login_change.html.erb +7 -3
- data/lib/generators/rodauth/templates/app/views/rodauth/webauthn_auth.html.erb +13 -9
- data/lib/generators/rodauth/templates/app/views/rodauth/webauthn_remove.html.erb +21 -9
- data/lib/generators/rodauth/templates/app/views/rodauth/webauthn_setup.html.erb +21 -9
- data/lib/generators/rodauth/templates/app/views/rodauth_mailer/email_auth.text.erb +1 -1
- data/lib/generators/rodauth/templates/app/views/rodauth_mailer/reset_password.text.erb +1 -1
- data/lib/generators/rodauth/templates/app/views/rodauth_mailer/unlock_account.text.erb +1 -1
- data/lib/generators/rodauth/templates/app/views/rodauth_mailer/verify_account.text.erb +1 -1
- data/lib/generators/rodauth/templates/app/views/rodauth_mailer/verify_login_change.text.erb +3 -3
- data/lib/generators/rodauth/views_generator.rb +55 -93
- data/lib/rodauth/rails/app.rb +4 -0
- data/lib/rodauth/rails/controller_methods.rb +1 -2
- data/lib/rodauth/rails/feature/base.rb +9 -0
- data/lib/rodauth/rails/feature/csrf.rb +15 -4
- data/lib/rodauth/rails/feature/internal_request.rb +16 -20
- data/lib/rodauth/rails/feature/render.rb +1 -1
- data/lib/rodauth/rails/model.rb +1 -1
- data/lib/rodauth/rails/railtie.rb +4 -2
- data/lib/rodauth/rails/version.rb +1 -1
- data/lib/rodauth/rails.rb +14 -7
- data/rodauth-rails.gemspec +1 -1
- metadata +4 -20
- data/lib/generators/rodauth/templates/app/views/rodauth/_field.html.erb +0 -10
- data/lib/generators/rodauth/templates/app/views/rodauth/_field_error.html.erb +0 -3
- data/lib/generators/rodauth/templates/app/views/rodauth/_global_logout_field.html.erb +0 -6
- data/lib/generators/rodauth/templates/app/views/rodauth/_login_confirm_field.html.erb +0 -4
- data/lib/generators/rodauth/templates/app/views/rodauth/_login_display.html.erb +0 -4
- data/lib/generators/rodauth/templates/app/views/rodauth/_login_field.html.erb +0 -4
- data/lib/generators/rodauth/templates/app/views/rodauth/_login_hidden_field.html.erb +0 -1
- data/lib/generators/rodauth/templates/app/views/rodauth/_new_password_field.html.erb +0 -4
- data/lib/generators/rodauth/templates/app/views/rodauth/_otp_auth_code_field.html.erb +0 -8
- data/lib/generators/rodauth/templates/app/views/rodauth/_password_confirm_field.html.erb +0 -4
- data/lib/generators/rodauth/templates/app/views/rodauth/_password_field.html.erb +0 -4
- data/lib/generators/rodauth/templates/app/views/rodauth/_recovery_code_field.html.erb +0 -4
- data/lib/generators/rodauth/templates/app/views/rodauth/_recovery_codes_form.html.erb +0 -6
- data/lib/generators/rodauth/templates/app/views/rodauth/_sms_code_field.html.erb +0 -8
- data/lib/generators/rodauth/templates/app/views/rodauth/_sms_phone_field.html.erb +0 -8
- data/lib/generators/rodauth/templates/app/views/rodauth/_submit.html.erb +0 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8eb9b3bee5cf4cd6741d7b05fa1d6869526a583ff3d9712b8a4adcb522c5a8d5
|
4
|
+
data.tar.gz: 37cba7e8de2b0c2aa07763ca4da38989692e3cd467a314440f22706380e9e2fe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8c027c266b03b2be2a68d19e847e31ce04d608e1befbf9785b38ffd94326962db2b01bf72b715311f9a690022fe62232c92a355094d451383330413096c57be5
|
7
|
+
data.tar.gz: bc2d33f6d773cc7884c5b655ef93630a6e1f1ec56fe9ce6f75aa8127120005496eecc976aa8f1689cc4ade3e784070b5ce5de1308eda674e8487e9eac5a5599e
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,57 @@
|
|
1
|
+
## 0.18.0 (2021-11-05)
|
2
|
+
|
3
|
+
* Disable Turbo on the generated login form (@janko)
|
4
|
+
|
5
|
+
* Generate controller views with `form_with` helper on Rails 5.1+ (@janko)
|
6
|
+
|
7
|
+
* Fix missing layout error when rendering Rodauth's built-in templates when using Turbo on Rails 6.0+ (@janko)
|
8
|
+
|
9
|
+
* Fix `Rodauth::Rails.middleware` config not actually affecting middleware insertion (@janko)
|
10
|
+
|
11
|
+
* Set page titles in generated view templates (@janko)
|
12
|
+
|
13
|
+
* Merge field and button partials into view templates (@janko)
|
14
|
+
|
15
|
+
* Raise error for unknown configuration in `Rodauth::Rails.model` (@janko)
|
16
|
+
|
17
|
+
* Generate views for all enabled features by default in `rodauth:views` generator (@janko)
|
18
|
+
|
19
|
+
* Add `Rodauth::Rails::App.rodauth!` which raises an error for unknown configuration (@janko)
|
20
|
+
|
21
|
+
* Remove deprecated `--features` option from `rodauth:views` generator (@janko)
|
22
|
+
|
23
|
+
* Inline `_recovery_codes_form.html.erb` partial into `recovery_codes.html.erb` (@janko)
|
24
|
+
|
25
|
+
* Use Rodauth helper methods for texts in generated views, for easier i18n (@janko)
|
26
|
+
|
27
|
+
* Allow setting passing a `Sequel::Model` to `:account` in `Rodauth::Rails.rodauth` (@janko)
|
28
|
+
|
29
|
+
## 0.17.1 (2021-10-20)
|
30
|
+
|
31
|
+
* Skip checking CSRF when request forgery protection wasn't loaded on the controller (@janko)
|
32
|
+
|
33
|
+
* Create partial unique index for `accounts.email` column when using `sqlite3` adapter (@janko)
|
34
|
+
|
35
|
+
* Revert setting `delete_account_on_close?` to `true` in generated `rodauth_app.rb` (@janko)
|
36
|
+
|
37
|
+
* Disable Turbo in `_recovery_codes_form.html.erb`, since viewing recovery codes isn't Turbo-compatible (@janko)
|
38
|
+
|
39
|
+
* Generate JSON configuration on `rodauth:install` for API-only with sessions enabled (@janko)
|
40
|
+
|
41
|
+
* Generate JWT configuration on `rodauth:install` only for API-only apps without sessions enabled (@janko)
|
42
|
+
|
43
|
+
* Don't generate JWT configuration when `rodauth:install --json` was run in API-only app (@janko)
|
44
|
+
|
45
|
+
* Use `config.action_mailer.default_url_options` in path_class_methods feature (@janko)
|
46
|
+
|
47
|
+
## 0.17.0 (2021-10-05)
|
48
|
+
|
49
|
+
* Set `delete_account_on_close?` to `true` in generated `rodauth_app.rb` (@janko)
|
50
|
+
|
51
|
+
* Change default `:dependent` option for associations to `:delete`/`:delete_all` (@janko)
|
52
|
+
|
53
|
+
* Add `rails_account_model` configuration method for when the account model cannot be inferred (@janko)
|
54
|
+
|
1
55
|
## 0.16.0 (2021-09-26)
|
2
56
|
|
3
57
|
* Add `#current_account` to methods defined on `ActionController::Base` (@janko)
|
data/README.md
CHANGED
@@ -49,7 +49,7 @@ For instructions on upgrading from previous rodauth-rails versions, see
|
|
49
49
|
Add the gem to your Gemfile:
|
50
50
|
|
51
51
|
```rb
|
52
|
-
gem "rodauth-rails", "~> 0.
|
52
|
+
gem "rodauth-rails", "~> 0.18"
|
53
53
|
|
54
54
|
# gem "jwt", require: false # for JWT feature
|
55
55
|
# gem "rotp", require: false # for OTP feature
|
@@ -150,6 +150,9 @@ current_account #=> #<Account id=123 email="user@example.com">
|
|
150
150
|
current_account.email #=> "user@example.com"
|
151
151
|
```
|
152
152
|
|
153
|
+
If the account doesn't exist in the database, the session will be cleared and
|
154
|
+
login required.
|
155
|
+
|
153
156
|
Pass the configuration name to retrieve accounts belonging to other Rodauth
|
154
157
|
configurations:
|
155
158
|
|
@@ -157,8 +160,19 @@ configurations:
|
|
157
160
|
current_account(:admin)
|
158
161
|
```
|
159
162
|
|
160
|
-
|
161
|
-
|
163
|
+
The `#current_account` method will try to infer the account model class from
|
164
|
+
the configured table name. If that fails, you can set the account model
|
165
|
+
manually:
|
166
|
+
|
167
|
+
```rb
|
168
|
+
# app/lib/rodauth_app.rb
|
169
|
+
class RodauthApp < Rodauth::Rails::App
|
170
|
+
configure do
|
171
|
+
# ...
|
172
|
+
rails_account_model Authentication::Account # custom model name
|
173
|
+
end
|
174
|
+
end
|
175
|
+
```
|
162
176
|
|
163
177
|
### Requiring authentication
|
164
178
|
|
@@ -268,12 +282,12 @@ copy Rodauth templates into your Rails app:
|
|
268
282
|
$ rails generate rodauth:views
|
269
283
|
```
|
270
284
|
|
271
|
-
This will generate views for
|
272
|
-
`app/views/rodauth` directory, provided that `RodauthController` is set for
|
273
|
-
main configuration.
|
285
|
+
This will generate views for Rodauth features you have currently enabled into
|
286
|
+
the `app/views/rodauth` directory, provided that `RodauthController` is set for
|
287
|
+
the main configuration.
|
274
288
|
|
275
289
|
You can pass a list of Rodauth features to the generator to create views for
|
276
|
-
these features (this will not remove
|
290
|
+
these features (this will not remove any existing views):
|
277
291
|
|
278
292
|
```sh
|
279
293
|
$ rails generate rodauth:views login create_account lockout otp
|
@@ -288,7 +302,7 @@ $ rails generate rodauth:views --all
|
|
288
302
|
Use `--name` to generate views for a different Rodauth configuration:
|
289
303
|
|
290
304
|
```sh
|
291
|
-
$ rails generate rodauth:views --name admin
|
305
|
+
$ rails generate rodauth:views webauthn --name admin
|
292
306
|
```
|
293
307
|
|
294
308
|
#### Layout
|
@@ -777,11 +791,52 @@ end
|
|
777
791
|
|
778
792
|
### Outside of a request
|
779
793
|
|
780
|
-
In some cases you might need to use Rodauth more programmatically. If you
|
781
|
-
|
782
|
-
with the [internal_request] feature just for that.
|
783
|
-
|
784
|
-
|
794
|
+
In some cases you might need to use Rodauth more programmatically. If you want
|
795
|
+
to perform authentication operations outside of request context, Rodauth ships
|
796
|
+
with the [internal_request] feature just for that.
|
797
|
+
|
798
|
+
```rb
|
799
|
+
# app/lib/rodauth_app.rb
|
800
|
+
class RodauthApp < Rodauth::Rails::App
|
801
|
+
configure do
|
802
|
+
enable :internal_request
|
803
|
+
end
|
804
|
+
end
|
805
|
+
```
|
806
|
+
```rb
|
807
|
+
# main configuration
|
808
|
+
RodauthApp.rodauth.create_account(login: "user@example.com", password: "secret")
|
809
|
+
RodauthApp.rodauth.verify_account(account_login: "user@example.com")
|
810
|
+
|
811
|
+
# secondary configuration
|
812
|
+
RodauthApp.rodauth(:admin).close_account(account_login: "admin@example.com")
|
813
|
+
```
|
814
|
+
|
815
|
+
The rodauth-rails gem additionally updates the internal rack env hash with your
|
816
|
+
`config.action_mailer.default_url_options`, which is used for generating email
|
817
|
+
links.
|
818
|
+
|
819
|
+
For generating authentication URLs outside of a request use the
|
820
|
+
[path_class_methods] plugin:
|
821
|
+
|
822
|
+
```rb
|
823
|
+
# app/lib/rodauth_app.rb
|
824
|
+
class RodauthApp < Rodauth::Rails::App
|
825
|
+
configure do
|
826
|
+
enable :path_class_methods
|
827
|
+
end
|
828
|
+
end
|
829
|
+
```
|
830
|
+
```rb
|
831
|
+
# main configuration
|
832
|
+
RodauthApp.rodauth.create_account_path
|
833
|
+
RodauthApp.rodauth.verify_account_url(key: "abc123")
|
834
|
+
|
835
|
+
# secondary configuration
|
836
|
+
RodauthApp.rodauth(:admin).close_account_path
|
837
|
+
```
|
838
|
+
|
839
|
+
#### Calling instance methods
|
785
840
|
|
786
841
|
If you need to access Rodauth methods not exposed as internal requests, you can
|
787
842
|
use `Rodauth::Rails.rodauth` to retrieve the Rodauth instance used by the
|
@@ -810,19 +865,12 @@ In addition to the `:account` option, the `Rodauth::Rails.rodauth`
|
|
810
865
|
method accepts any options supported by the internal_request feature.
|
811
866
|
|
812
867
|
```rb
|
813
|
-
|
814
|
-
|
815
|
-
|
816
|
-
params: { "param" => "value" },
|
817
|
-
# ...
|
818
|
-
)
|
819
|
-
```
|
868
|
+
# main configuration
|
869
|
+
Rodauth::Rails.rodauth(env: { "HTTP_USER_AGENT" => "programmatic" })
|
870
|
+
Rodauth::Rails.rodauth(session: { two_factor_auth_setup: true })
|
820
871
|
|
821
|
-
|
822
|
-
|
823
|
-
|
824
|
-
```rb
|
825
|
-
Rodauth::Rails.rodauth(:admin)
|
872
|
+
# secondary configuration
|
873
|
+
Rodauth::Rails.rodauth(:admin, params: { "param" => "value" })
|
826
874
|
```
|
827
875
|
|
828
876
|
## How it works
|
@@ -986,7 +1034,24 @@ end
|
|
986
1034
|
While Rodauth doesn't yet come with [OmniAuth] integration, we can build one
|
987
1035
|
ourselves using the existing Rodauth API.
|
988
1036
|
|
989
|
-
|
1037
|
+
Let's assume we're building Facebook login. We'll start by installing the
|
1038
|
+
necessary gems, and loading the Facebook OmniAuth strategy:
|
1039
|
+
|
1040
|
+
```rb
|
1041
|
+
# Gemfile
|
1042
|
+
gem "omniauth", "~> 2.0"
|
1043
|
+
gem "omniauth-rails_csrf_protection" # https://github.com/omniauth/omniauth/wiki/Resolving-CVE-2015-9284
|
1044
|
+
gem "omniauth-facebook"
|
1045
|
+
```
|
1046
|
+
```rb
|
1047
|
+
# config/initializers/omniauth.rb
|
1048
|
+
Rails.application.config.middleware.use OmniAuth::Builder do
|
1049
|
+
provider :facebook, ENV["FACEBOOK_APP_ID"], ENV["FACEBOOK_APP_SECRET"],
|
1050
|
+
scope: "email", callback_path: "/auth/facebook/callback"
|
1051
|
+
end
|
1052
|
+
```
|
1053
|
+
|
1054
|
+
Since users might potentially want to login with multiple external providers, let's
|
990
1055
|
create an `account_identities` table that will have a many-to-one relationship
|
991
1056
|
with the `accounts` table:
|
992
1057
|
|
@@ -1023,18 +1088,11 @@ class Account < ApplicationRecord
|
|
1023
1088
|
end
|
1024
1089
|
```
|
1025
1090
|
|
1026
|
-
|
1027
|
-
corresponding OmniAuth strategy to the middleware stack, together with an
|
1028
|
-
authorization link on the login form:
|
1091
|
+
Next, let's add a POST button pointing to the request URL to our login form:
|
1029
1092
|
|
1030
|
-
```rb
|
1031
|
-
Rails.application.config.middleware.use OmniAuth::Builder do
|
1032
|
-
provider :facebook, ENV["FACEBOOK_APP_ID"], ENV["FACEBOOK_APP_SECRET"],
|
1033
|
-
scope: "email", callback_path: "/auth/facebook/callback"
|
1034
|
-
end
|
1035
|
-
```
|
1036
1093
|
```erb
|
1037
|
-
<%=
|
1094
|
+
<%= button_to "Login via Facebook", "/auth/facebook",
|
1095
|
+
method: :post, data: { turbo: false }, class: "btn btn-link p-0" %>
|
1038
1096
|
```
|
1039
1097
|
|
1040
1098
|
Finally, let's implement the OmniAuth callback endpoint on our Rodauth
|
@@ -1107,6 +1165,7 @@ methods:
|
|
1107
1165
|
| `rails_check_csrf!` | Verifies the authenticity token for the current request. |
|
1108
1166
|
| `rails_controller_instance` | Instance of the controller with the request env context. |
|
1109
1167
|
| `rails_controller` | Controller class to use for rendering and CSRF protection. |
|
1168
|
+
| `rails_account_model` | Model class connected with the accounts table. |
|
1110
1169
|
|
1111
1170
|
The `Rodauth::Rails` module has a few config settings available as well:
|
1112
1171
|
|
@@ -1423,3 +1482,5 @@ conduct](https://github.com/janko/rodauth-rails/blob/master/CODE_OF_CONDUCT.md).
|
|
1423
1482
|
[account_expiration]: http://rodauth.jeremyevans.net/rdoc/files/doc/account_expiration_rdoc.html
|
1424
1483
|
[simple_ldap_authenticator]: https://github.com/jeremyevans/simple_ldap_authenticator
|
1425
1484
|
[internal_request]: http://rodauth.jeremyevans.net/rdoc/files/doc/internal_request_rdoc.html
|
1485
|
+
[composite_primary_keys]: https://github.com/composite-primary-keys/composite_primary_keys
|
1486
|
+
[path_class_methods]: https://rodauth.jeremyevans.net/rdoc/files/doc/path_class_methods_rdoc.html
|
@@ -60,7 +60,7 @@ module Rodauth
|
|
60
60
|
template "app/mailers/rodauth_mailer.rb"
|
61
61
|
|
62
62
|
MAILER_VIEWS.each do |view|
|
63
|
-
|
63
|
+
copy_file "app/views/rodauth_mailer/#{view}.text.erb"
|
64
64
|
end
|
65
65
|
end
|
66
66
|
|
@@ -95,11 +95,11 @@ module Rodauth
|
|
95
95
|
end
|
96
96
|
|
97
97
|
def json?
|
98
|
-
options[:json]
|
98
|
+
options[:json] || api_only? && session_store? && !options[:jwt]
|
99
99
|
end
|
100
100
|
|
101
101
|
def jwt?
|
102
|
-
options[:jwt] ||
|
102
|
+
options[:jwt] || api_only? && !session_store? && !options[:json]
|
103
103
|
end
|
104
104
|
|
105
105
|
def migration_features
|
@@ -107,6 +107,14 @@ module Rodauth
|
|
107
107
|
features << :remember unless jwt?
|
108
108
|
features
|
109
109
|
end
|
110
|
+
|
111
|
+
def session_store?
|
112
|
+
!!::Rails.application.config.session_store
|
113
|
+
end
|
114
|
+
|
115
|
+
def api_only?
|
116
|
+
Rodauth::Rails.api_only?
|
117
|
+
end
|
110
118
|
end
|
111
119
|
end
|
112
120
|
end
|
@@ -5,11 +5,17 @@ enable_extension "citext"
|
|
5
5
|
create_table :accounts<%= primary_key_type %> do |t|
|
6
6
|
<% case activerecord_adapter -%>
|
7
7
|
<% when "postgresql" -%>
|
8
|
-
t.citext :email, null: false
|
8
|
+
t.citext :email, null: false
|
9
9
|
<% else -%>
|
10
|
-
t.string :email, null: false
|
10
|
+
t.string :email, null: false
|
11
11
|
<% end -%>
|
12
12
|
t.string :status, null: false, default: "unverified"
|
13
|
+
<% case activerecord_adapter -%>
|
14
|
+
<% when "postgresql", "sqlite3" -%>
|
15
|
+
t.index :email, unique: true, where: "status IN ('unverified', 'verified')"
|
16
|
+
<% else -%>
|
17
|
+
t.index :email, unique: true
|
18
|
+
<% end -%>
|
13
19
|
end
|
14
20
|
|
15
21
|
# Used if storing password hashes in a separate table (default)
|
@@ -1,4 +1,7 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
1
|
+
<%= form_with url: rodauth.email_auth_request_path, method: :post do |form| %>
|
2
|
+
<%= form.hidden_field rodauth.login_param, value: params[rodauth.login_param] %>
|
3
|
+
|
4
|
+
<div class="form-group mb-3">
|
5
|
+
<%= form.submit rodauth.email_auth_request_button, class: "btn btn-primary" %>
|
6
|
+
</div>
|
7
|
+
<% end %>
|
@@ -1,9 +1,26 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
1
|
+
<%= form_with url: rodauth.login_path, method: :post, data: { turbo: false } do |form| %>
|
2
|
+
<% if rodauth.skip_login_field_on_login? %>
|
3
|
+
<div class="form-group mb-3">
|
4
|
+
<%= form.label "login", rodauth.login_label, class: "form-label" %>
|
5
|
+
<%= form.email_field rodauth.login_param, value: params[rodauth.login_param], id: "login", readonly: true, class: "form-control-plaintext" %>
|
6
|
+
</div>
|
7
|
+
<% else %>
|
8
|
+
<div class="form-group mb-3">
|
9
|
+
<%= form.label "login", rodauth.login_label, class: "form-label" %>
|
10
|
+
<%= form.email_field rodauth.login_param, value: params[rodauth.login_param], id: "login", autocomplete: "email", required: true, class: "form-control #{"is-invalid" if rodauth.field_error(rodauth.login_param)}", aria: ({ invalid: true, describedby: "login_error_message" } if rodauth.field_error(rodauth.login_param)) %>
|
11
|
+
<%= content_tag(:span, rodauth.field_error(rodauth.login_param), class: "invalid-feedback", id: "login_error_message") if rodauth.field_error(rodauth.login_param) %>
|
12
|
+
</div>
|
13
|
+
<% end %>
|
14
|
+
|
15
|
+
<% unless rodauth.skip_password_field_on_login? %>
|
16
|
+
<div class="form-group mb-3">
|
17
|
+
<%= form.label "password", rodauth.password_label, class: "form-label" %>
|
18
|
+
<%= form.password_field rodauth.password_param, value: "", id: "password", autocomplete: rodauth.password_field_autocomplete_value, required: true, class: "form-control #{"is-invalid" if rodauth.field_error(rodauth.password_param)}", aria: ({ invalid: true, describedby: "password_error_message" } if rodauth.field_error(rodauth.password_param)) %>
|
19
|
+
<%= content_tag(:span, rodauth.field_error(rodauth.password_param), class: "invalid-feedback", id: "password_error_message") if rodauth.field_error(rodauth.password_param) %>
|
20
|
+
</div>
|
21
|
+
<% end %>
|
22
|
+
|
23
|
+
<div class="form-group mb-3">
|
24
|
+
<%= form.submit rodauth.login_button, class: "btn btn-primary" %>
|
25
|
+
</div>
|
26
|
+
<% end %>
|
@@ -1,8 +1,9 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
<% unless rodauth.login_form_footer_links.empty? %>
|
2
|
+
<%== rodauth.login_form_footer_links_heading %>
|
3
|
+
|
3
4
|
<ul>
|
4
|
-
|
5
|
-
<li
|
6
|
-
|
5
|
+
<% rodauth.login_form_footer_links.sort.each do |_, link, text| %>
|
6
|
+
<li><%= link_to text, link %></li>
|
7
|
+
<% end %>
|
7
8
|
</ul>
|
8
|
-
|
9
|
+
<% end %>
|
@@ -1,3 +1,3 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
1
|
+
<% if rodauth.field_error(rodauth.password_param) && rodauth.features.include?(:reset_password) %>
|
2
|
+
<%= render template: "rodauth/reset_password_request", layout: false %>
|
3
|
+
<% end %>
|
@@ -1,6 +1,8 @@
|
|
1
|
-
|
1
|
+
<% content_for :title, rodauth.add_recovery_codes_page_title %>
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
3
|
+
<pre id="recovery-codes"><%= rodauth.recovery_codes.map { |s| h(s) }.join("\n\n") %></pre>
|
4
|
+
|
5
|
+
<% if rodauth.can_add_recovery_codes? %>
|
6
|
+
<%== rodauth.add_recovery_codes_heading %>
|
7
|
+
<%= render template: "rodauth/recovery_codes", layout: false %>
|
8
|
+
<% end %>
|
@@ -1,6 +1,29 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
1
|
+
<% content_for :title, rodauth.change_login_page_title %>
|
2
|
+
|
3
|
+
<%= form_with url: rodauth.change_login_path, method: :post do |form| %>
|
4
|
+
<div class="form-group mb-3">
|
5
|
+
<%= form.label "login", rodauth.login_label, class: "form-label" %>
|
6
|
+
<%= form.email_field rodauth.login_param, value: params[rodauth.login_param], id: "login", autocomplete: "email", required: true, class: "form-control #{"is-invalid" if rodauth.field_error(rodauth.login_param)}", aria: ({ invalid: true, describedby: "login_error_message" } if rodauth.field_error(rodauth.login_param)) %>
|
7
|
+
<%= content_tag(:span, rodauth.field_error(rodauth.login_param), class: "invalid-feedback", id: "login_error_message") if rodauth.field_error(rodauth.login_param) %>
|
8
|
+
</div>
|
9
|
+
|
10
|
+
<% if rodauth.require_login_confirmation? %>
|
11
|
+
<div class="form-group mb-3">
|
12
|
+
<%= form.label "login-confirm", rodauth.login_confirm_label, class: "form-label" %>
|
13
|
+
<%= form.email_field rodauth.login_confirm_param, value: params[rodauth.login_confirm_param], id: "login-confirm", autocomplete: "email", required: true, class: "form-control #{"is-invalid" if rodauth.field_error(rodauth.login_confirm_param)}", aria: ({ invalid: true, describedby: "login-confirm_error_message" } if rodauth.field_error(rodauth.login_confirm_param)) %>
|
14
|
+
<%= content_tag(:span, rodauth.field_error(rodauth.login_confirm_param), class: "invalid-feedback", id: "login-confirm_error_message") if rodauth.field_error(rodauth.login_confirm_param) %>
|
15
|
+
</div>
|
16
|
+
<% end %>
|
17
|
+
|
18
|
+
<% if rodauth.change_login_requires_password? %>
|
19
|
+
<div class="form-group mb-3">
|
20
|
+
<%= form.label "password", rodauth.password_label, class: "form-label" %>
|
21
|
+
<%= form.password_field rodauth.password_param, value: "", id: "password", autocomplete: rodauth.password_field_autocomplete_value, required: true, class: "form-control #{"is-invalid" if rodauth.field_error(rodauth.password_param)}", aria: ({ invalid: true, describedby: "password_error_message" } if rodauth.field_error(rodauth.password_param)) %>
|
22
|
+
<%= content_tag(:span, rodauth.field_error(rodauth.password_param), class: "invalid-feedback", id: "password_error_message") if rodauth.field_error(rodauth.password_param) %>
|
23
|
+
</div>
|
24
|
+
<% end %>
|
25
|
+
|
26
|
+
<div class="form-group mb-3">
|
27
|
+
<%= form.submit rodauth.change_login_button, class: "btn btn-primary" %>
|
28
|
+
</div>
|
29
|
+
<% end %>
|
@@ -1,6 +1,29 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
1
|
+
<% content_for :title, rodauth.change_password_page_title %>
|
2
|
+
|
3
|
+
<%= form_with url: rodauth.change_password_path, method: :post do |form| %>
|
4
|
+
<% if rodauth.change_password_requires_password? %>
|
5
|
+
<div class="form-group mb-3">
|
6
|
+
<%= form.label "password", rodauth.password_label, class: "form-label" %>
|
7
|
+
<%= form.password_field rodauth.password_param, value: "", id: "password", autocomplete: rodauth.password_field_autocomplete_value, required: true, class: "form-control #{"is-invalid" if rodauth.field_error(rodauth.password_param)}", aria: ({ invalid: true, describedby: "password_error_message" } if rodauth.field_error(rodauth.password_param)) %>
|
8
|
+
<%= content_tag(:span, rodauth.field_error(rodauth.password_param), class: "invalid-feedback", id: "password_error_message") if rodauth.field_error(rodauth.password_param) %>
|
9
|
+
</div>
|
10
|
+
<% end %>
|
11
|
+
|
12
|
+
<div class="form-group mb-3">
|
13
|
+
<%= form.label "new-password", rodauth.new_password_label, class: "form-label" %>
|
14
|
+
<%= form.password_field rodauth.new_password_param, value: "", id: "new-password", autocomplete: "new-password", required: true, class: "form-control #{"is-invalid" if rodauth.field_error(rodauth.new_password_param)}", aria: ({ invalid: true, describedby: "new-password_error_message" } if rodauth.field_error(rodauth.new_password_param)) %>
|
15
|
+
<%= content_tag(:span, rodauth.field_error(rodauth.new_password_param), class: "invalid-feedback", id: "new-password_error_message") if rodauth.field_error(rodauth.new_password_param) %>
|
16
|
+
</div>
|
17
|
+
|
18
|
+
<% if rodauth.require_password_confirmation? %>
|
19
|
+
<div class="form-group mb-3">
|
20
|
+
<%= form.label "password-confirm", rodauth.password_confirm_label, class: "form-label" %>
|
21
|
+
<%= form.password_field rodauth.password_confirm_param, value: "", id: "password-confirm", autocomplete: "new-password", required: true, class: "form-control #{"is-invalid" if rodauth.field_error(rodauth.password_confirm_param)}", aria: ({ invalid: true, describedby: "password-confirm_error_message" } if rodauth.field_error(rodauth.password_confirm_param)) %>
|
22
|
+
<%= content_tag(:span, rodauth.field_error(rodauth.password_confirm_param), class: "invalid-feedback", id: "password-confirm_error_message") if rodauth.field_error(rodauth.password_confirm_param) %>
|
23
|
+
</div>
|
24
|
+
<% end %>
|
25
|
+
|
26
|
+
<div class="form-group mb-3">
|
27
|
+
<%= form.submit rodauth.change_password_button, class: "btn btn-primary" %>
|
28
|
+
</div>
|
29
|
+
<% end %>
|
@@ -1,4 +1,15 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
1
|
+
<% content_for :title, rodauth.close_account_page_title %>
|
2
|
+
|
3
|
+
<%= form_with url: rodauth.close_account_path, method: :post do |form| %>
|
4
|
+
<% if rodauth.close_account_requires_password? %>
|
5
|
+
<div class="form-group mb-3">
|
6
|
+
<%= form.label "password", rodauth.password_label, class: "form-label" %>
|
7
|
+
<%= form.password_field rodauth.password_param, value: "", id: "password", autocomplete: rodauth.password_field_autocomplete_value, required: true, class: "form-control #{"is-invalid" if rodauth.field_error(rodauth.password_param)}", aria: ({ invalid: true, describedby: "password_error_message" } if rodauth.field_error(rodauth.password_param)) %>
|
8
|
+
<%= content_tag(:span, rodauth.field_error(rodauth.password_param), class: "invalid-feedback", id: "password_error_message") if rodauth.field_error(rodauth.password_param) %>
|
9
|
+
</div>
|
10
|
+
<% end %>
|
11
|
+
|
12
|
+
<div class="form-group mb-3">
|
13
|
+
<%= form.submit rodauth.close_account_button, class: "btn btn-danger" %>
|
14
|
+
</div>
|
15
|
+
<% end %>
|
@@ -1,4 +1,13 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
1
|
+
<% content_for :title, rodauth.confirm_password_page_title %>
|
2
|
+
|
3
|
+
<%= form_with url: rodauth.confirm_password_path, method: :post do |form| %>
|
4
|
+
<div class="form-group mb-3">
|
5
|
+
<%= form.label "password", rodauth.password_label, class: "form-label" %>
|
6
|
+
<%= form.password_field rodauth.password_param, value: "", id: "password", autocomplete: rodauth.password_field_autocomplete_value, required: true, class: "form-control #{"is-invalid" if rodauth.field_error(rodauth.password_param)}", aria: ({ invalid: true, describedby: "password_error_message" } if rodauth.field_error(rodauth.password_param)) %>
|
7
|
+
<%= content_tag(:span, rodauth.field_error(rodauth.password_param), class: "invalid-feedback", id: "password_error_message") if rodauth.field_error(rodauth.password_param) %>
|
8
|
+
</div>
|
9
|
+
|
10
|
+
<div class="form-group mb-3">
|
11
|
+
<%= form.submit rodauth.confirm_password_button, class: "btn btn-primary" %>
|
12
|
+
</div>
|
13
|
+
<% end %>
|
@@ -1,7 +1,37 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
1
|
+
<% content_for :title, rodauth.create_account_page_title %>
|
2
|
+
|
3
|
+
<%= form_with url: rodauth.create_account_path, method: :post do |form| %>
|
4
|
+
<div class="form-group mb-3">
|
5
|
+
<%= form.label "login", rodauth.login_label, class: "form-label" %>
|
6
|
+
<%= form.email_field rodauth.login_param, value: params[rodauth.login_param], id: "login", autocomplete: "email", required: true, class: "form-control #{"is-invalid" if rodauth.field_error(rodauth.login_param)}", aria: ({ invalid: true, describedby: "login_error_message" } if rodauth.field_error(rodauth.login_param)) %>
|
7
|
+
<%= content_tag(:span, rodauth.field_error(rodauth.login_param), class: "invalid-feedback", id: "login_error_message") if rodauth.field_error(rodauth.login_param) %>
|
8
|
+
</div>
|
9
|
+
|
10
|
+
<% if rodauth.require_login_confirmation? %>
|
11
|
+
<div class="form-group mb-3">
|
12
|
+
<%= form.label "login-confirm", rodauth.login_confirm_label, class: "form-label" %>
|
13
|
+
<%= form.email_field rodauth.login_confirm_param, value: params[rodauth.login_confirm_param], id: "login-confirm", autocomplete: "email", required: true, class: "form-control #{"is-invalid" if rodauth.field_error(rodauth.login_confirm_param)}", aria: ({ invalid: true, describedby: "login-confirm_error_message" } if rodauth.field_error(rodauth.login_confirm_param)) %>
|
14
|
+
<%= content_tag(:span, rodauth.field_error(rodauth.login_confirm_param), class: "invalid-feedback", id: "login-confirm_error_message") if rodauth.field_error(rodauth.login_confirm_param) %>
|
15
|
+
</div>
|
16
|
+
<% end %>
|
17
|
+
|
18
|
+
<% if rodauth.create_account_set_password? %>
|
19
|
+
<div class="form-group mb-3">
|
20
|
+
<%= form.label "password", rodauth.password_label, class: "form-label" %>
|
21
|
+
<%= form.password_field rodauth.password_param, value: "", id: "password", autocomplete: rodauth.password_field_autocomplete_value, required: true, class: "form-control #{"is-invalid" if rodauth.field_error(rodauth.password_param)}", aria: ({ invalid: true, describedby: "password_error_message" } if rodauth.field_error(rodauth.password_param)) %>
|
22
|
+
<%= content_tag(:span, rodauth.field_error(rodauth.password_param), class: "invalid-feedback", id: "password_error_message") if rodauth.field_error(rodauth.password_param) %>
|
23
|
+
</div>
|
24
|
+
|
25
|
+
<% if rodauth.require_password_confirmation? %>
|
26
|
+
<div class="form-group mb-3">
|
27
|
+
<%= form.label "password-confirm", rodauth.password_confirm_label, class: "form-label" %>
|
28
|
+
<%= form.password_field rodauth.password_confirm_param, value: "", id: "password-confirm", autocomplete: "new-password", required: true, class: "form-control #{"is-invalid" if rodauth.field_error(rodauth.password_confirm_param)}", aria: ({ invalid: true, describedby: "password-confirm_error_message" } if rodauth.field_error(rodauth.password_confirm_param)) %>
|
29
|
+
<%= content_tag(:span, rodauth.field_error(rodauth.password_confirm_param), class: "invalid-feedback", id: "password-confirm_error_message") if rodauth.field_error(rodauth.password_confirm_param) %>
|
30
|
+
</div>
|
31
|
+
<% end %>
|
32
|
+
<% end %>
|
33
|
+
|
34
|
+
<div class="form-group mb-3">
|
35
|
+
<%= form.submit rodauth.create_account_button, class: "btn btn-primary" %>
|
36
|
+
</div>
|
37
|
+
<% end %>
|
@@ -1,3 +1,7 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
1
|
+
<% content_for :title, rodauth.email_auth_page_title %>
|
2
|
+
|
3
|
+
<%= form_with url: rodauth.email_auth_path, method: :post do |form| %>
|
4
|
+
<div class="form-group mb-3">
|
5
|
+
<%= form.submit rodauth.login_button, class: "btn btn-primary" %>
|
6
|
+
</div>
|
7
|
+
<% end %>
|
@@ -1,4 +1,16 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
1
|
+
<% content_for :title, rodauth.logout_page_title %>
|
2
|
+
|
3
|
+
<%= form_with url: rodauth.logout_path, method: :post do |form| %>
|
4
|
+
<% if rodauth.features.include?(:active_sessions) %>
|
5
|
+
<div class="form-group mb-3">
|
6
|
+
<div class="form-check">
|
7
|
+
<%= form.check_box rodauth.global_logout_param, id: "global-logout", class: "form-check-input" %>
|
8
|
+
<%= form.label "global-logout", rodauth.global_logout_label, class: "form-check-label" %>
|
9
|
+
</div>
|
10
|
+
</div>
|
11
|
+
<% end %>
|
12
|
+
|
13
|
+
<div class="form-group mb-3">
|
14
|
+
<%= form.submit rodauth.logout_button, class: "btn btn-warning" %>
|
15
|
+
</div>
|
16
|
+
<% end %>
|