bullet_train 1.21.0 → 1.21.1
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 +4 -4
- data/app/controllers/account/two_factors_controller.rb +2 -0
- data/app/controllers/concerns/sessions/controller_base.rb +0 -4
- data/app/javascript/controllers/index.js +2 -0
- data/app/javascript/controllers/otp_response_controller.js +26 -0
- data/app/views/account/two_factors/create.html.erb +1 -0
- data/app/views/account/two_factors/destroy.html.erb +1 -0
- data/app/views/account/two_factors/verify.html.erb +1 -0
- data/app/views/devise/registrations/_two_factor.html.erb +51 -49
- data/app/views/devise/sessions/new.html.erb +2 -3
- data/app/views/devise/sessions/pre_otp.turbo_stream.erb +7 -0
- data/config/locales/en/users.en.yml +2 -0
- data/lib/bullet_train/version.rb +1 -1
- metadata +6 -5
- data/app/views/account/two_factors/create.js.erb +0 -1
- data/app/views/account/two_factors/destroy.js.erb +0 -1
- data/app/views/account/two_factors/verify.js.erb +0 -1
- data/app/views/devise/sessions/pre_otp.js.erb +0 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c1da30f86aa0ef66affbb136577d126f234f8eedbd3e58c7a8f73b517ceb063d
|
4
|
+
data.tar.gz: 2022e1d4979ad8d9a6bafeb8a2c68cd34682fbabf15cbde1ce3db64bac44cf08
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 49582c3f10e09877b70b3a357a5ad939c14ed0b533390b40163b173218e4a0323d4e2c86d6eaa4e02634617be6ae9c85b2947c560a671a23d106ad8aaab0022a
|
7
|
+
data.tar.gz: a09dd5dc0a2346c3c5fd402ecd3840233f7163694f1ad93e9b19a151e915418fdcfdb24283f48b8a7c9094ea41b7cc29b8358d4fe077286c45bace6f8603ddb2
|
@@ -9,6 +9,7 @@ import MobileMenuController from './mobile_menu_controller'
|
|
9
9
|
import TextToggleController from './text_toggle_controller'
|
10
10
|
import SelectAllController from './select_all_controller'
|
11
11
|
import ConnectionWorkflowController from './connection_workflow_controller'
|
12
|
+
import OtpResponseController from './otp_response_controller'
|
12
13
|
|
13
14
|
export const controllerDefinitions = [
|
14
15
|
[BulkActionFormController, 'bulk_action_form_controller.js'],
|
@@ -20,6 +21,7 @@ export const controllerDefinitions = [
|
|
20
21
|
[TextToggleController, 'text_toggle_controller.js'],
|
21
22
|
[SelectAllController, 'select_all_controller.js'],
|
22
23
|
[ConnectionWorkflowController, 'connection_workflow_controller.js'],
|
24
|
+
[OtpResponseController, 'otp_response_controller.js'],
|
23
25
|
].map(function(d) {
|
24
26
|
const key = d[1]
|
25
27
|
const controller = d[0]
|
@@ -0,0 +1,26 @@
|
|
1
|
+
import { Controller } from "@hotwired/stimulus"
|
2
|
+
|
3
|
+
// Connects to data-controller="otp-response"
|
4
|
+
export default class extends Controller {
|
5
|
+
static values = {
|
6
|
+
otpRequired: Boolean,
|
7
|
+
};
|
8
|
+
|
9
|
+
connect() {
|
10
|
+
document.querySelector("#step-1").classList.add("hidden");
|
11
|
+
document.querySelector("#step-2").classList.remove("hidden");
|
12
|
+
if (this.otpRequiredValue) {
|
13
|
+
document.querySelector("#step-2-otp").classList.remove("hidden");
|
14
|
+
}
|
15
|
+
setTimeout(function() {
|
16
|
+
document.querySelector("#user_password").focus();
|
17
|
+
document.querySelector("#new_user").setAttribute('action', '/users/sign_in')
|
18
|
+
document.querySelector("#new_user").setAttribute('data-remote', 'false');
|
19
|
+
|
20
|
+
// TODO: Why do we need this? How is the button getting disabled?
|
21
|
+
// Does Turbo automatically disable submit buttons in a turbo form when it is submitted?
|
22
|
+
document.querySelector("#sign_in_submit").removeAttribute('disabled');
|
23
|
+
}, 1);
|
24
|
+
this.element.remove();
|
25
|
+
}
|
26
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= render "devise/registrations/two_factor" %>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= render "devise/registrations/two_factor" %>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= render "devise/registrations/two_factor", locals: {verified: @verified} %>
|
@@ -1,62 +1,64 @@
|
|
1
|
-
<%=
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
<% if
|
6
|
-
<%
|
7
|
-
|
8
|
-
<%=
|
9
|
-
|
1
|
+
<%= turbo_frame_tag "two-factor-frame" do %>
|
2
|
+
<%= render 'account/shared/box', divider: @backup_codes do |box| %>
|
3
|
+
<% box.title t("users.edit.two_factor.header") %>
|
4
|
+
<% box.description t("users.edit.two_factor.description_#{@user.otp_required_for_login? ? 'enabled' : 'disabled'}") %>
|
5
|
+
<% if current_user.otp_secret %>
|
6
|
+
<% if @backup_codes %>
|
7
|
+
<% box.body do %>
|
8
|
+
<%= render 'account/shared/alert' do %>
|
9
|
+
<%= t('users.edit.two_factor.warning').html_safe %>
|
10
|
+
<% end %>
|
10
11
|
|
11
|
-
|
12
|
+
<p><%= t('users.edit.two_factor.instructions').html_safe %></p>
|
12
13
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
14
|
+
<center class="py-4">
|
15
|
+
<%= current_user.otp_qr_code.as_svg(
|
16
|
+
offset: 0,
|
17
|
+
color: '000',
|
18
|
+
shape_rendering: 'crispEdges',
|
19
|
+
module_size: 4,
|
20
|
+
standalone: true
|
21
|
+
).html_safe %>
|
22
|
+
</center>
|
22
23
|
|
23
|
-
|
24
|
+
<p><%= t('users.edit.two_factor.recovery_codes').html_safe %></p>
|
24
25
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
26
|
+
<center>
|
27
|
+
<% @backup_codes.each do |code| %>
|
28
|
+
<p><code><%= code %></code></p>
|
29
|
+
<% end %>
|
30
|
+
</center>
|
30
31
|
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
32
|
+
<%= form_for current_user, url: verify_account_two_factor_path, method: :post, remote:true, html: {class: 'form'} do |form| %>
|
33
|
+
<div class="py-4">
|
34
|
+
<%= render 'shared/fields/text_field', form: form, method: :otp_attempt %>
|
35
|
+
</div>
|
36
|
+
<%= form.submit t('users.edit.two_factor.buttons.verify'), class: 'button' %>
|
37
|
+
<% end %>
|
38
|
+
<% end %>
|
37
39
|
<% end %>
|
38
40
|
<% end %>
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
<%
|
47
|
-
|
48
|
-
|
49
|
-
|
41
|
+
<% box.actions do %>
|
42
|
+
<div class="<%= 'hidden' if @backup_codes %> space-y">
|
43
|
+
<% if local_assigns.has_key? :verified %>
|
44
|
+
<% if verified %>
|
45
|
+
<%= render 'account/shared/alert', color: 'blue' do %>
|
46
|
+
<%= t('users.edit.two_factor.verification_success').html_safe %>
|
47
|
+
<% end %>
|
48
|
+
<% else %>
|
49
|
+
<%= render 'account/shared/alert' do %>
|
50
|
+
<%= t('users.edit.two_factor.verification_fail').html_safe %>
|
51
|
+
<% end %>
|
50
52
|
<% end %>
|
51
53
|
<% end %>
|
52
|
-
<% end %>
|
53
54
|
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
55
|
+
<% if current_user.otp_required_for_login? %>
|
56
|
+
<%= link_to t('users.edit.two_factor.buttons.disable'), account_two_factor_path, data:{turbo_method: :delete, turbo_confirm: t('users.edit.two_factor.buttons.confirmations.disable')}, class: "button" %>
|
57
|
+
<% else %>
|
58
|
+
<%= link_to t('users.edit.two_factor.buttons.enable'), account_two_factor_path, data:{turbo_method: :post}, class: "button" %>
|
59
|
+
<% end %>
|
60
|
+
</div>
|
61
|
+
<% end %>
|
60
62
|
<% end %>
|
61
63
|
<% end %>
|
62
64
|
|
@@ -2,8 +2,7 @@
|
|
2
2
|
<% box.title t('devise.headers.sign_in') %>
|
3
3
|
<% box.body do %>
|
4
4
|
<% within_fields_namespace(:self) do %>
|
5
|
-
|
6
|
-
<%= form_for resource, as: resource_name, url: two_factor_authentication_enabled? ? users_pre_otp_path : session_path(resource_name), remote: two_factor_authentication_enabled?, html: {class: 'form'}, authenticity_token: true, data: {turbo: false} do |form| %>
|
5
|
+
<%= form_for resource, as: resource_name, url: two_factor_authentication_enabled? ? users_pre_otp_path : session_path(resource_name), html: {class: 'form'}, authenticity_token: true do |form| %>
|
7
6
|
<% with_field_settings form: form do %>
|
8
7
|
<%= render 'account/shared/notices', form: form %>
|
9
8
|
<%= render 'account/shared/forms/errors', form: form %>
|
@@ -40,7 +39,7 @@
|
|
40
39
|
</div>
|
41
40
|
<% end %>
|
42
41
|
|
43
|
-
<%= form.submit t('global.buttons.sign_in'), class: 'button full' %>
|
42
|
+
<%= form.submit t('global.buttons.sign_in'), class: 'button full', id: 'sign_in_submit' %>
|
44
43
|
</div>
|
45
44
|
|
46
45
|
<% if devise_mapping.rememberable? %>
|
data/lib/bullet_train/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bullet_train
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.21.
|
4
|
+
version: 1.21.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Culver
|
@@ -433,6 +433,7 @@ files:
|
|
433
433
|
- app/javascript/controllers/form_controller.js
|
434
434
|
- app/javascript/controllers/index.js
|
435
435
|
- app/javascript/controllers/mobile_menu_controller.js
|
436
|
+
- app/javascript/controllers/otp_response_controller.js
|
436
437
|
- app/javascript/controllers/select_all_controller.js
|
437
438
|
- app/javascript/controllers/text_toggle_controller.js
|
438
439
|
- app/javascript/electron/index.js
|
@@ -496,9 +497,9 @@ files:
|
|
496
497
|
- app/views/account/teams/edit.html.erb
|
497
498
|
- app/views/account/teams/index.html.erb
|
498
499
|
- app/views/account/teams/new.html.erb
|
499
|
-
- app/views/account/two_factors/create.
|
500
|
-
- app/views/account/two_factors/destroy.
|
501
|
-
- app/views/account/two_factors/verify.
|
500
|
+
- app/views/account/two_factors/create.html.erb
|
501
|
+
- app/views/account/two_factors/destroy.html.erb
|
502
|
+
- app/views/account/two_factors/verify.html.erb
|
502
503
|
- app/views/account/users/_breadcrumbs.html.erb
|
503
504
|
- app/views/account/users/_fields.html.erb
|
504
505
|
- app/views/account/users/_form.html.erb
|
@@ -518,7 +519,7 @@ files:
|
|
518
519
|
- app/views/devise/registrations/edit.html.erb
|
519
520
|
- app/views/devise/registrations/new.html.erb
|
520
521
|
- app/views/devise/sessions/new.html.erb
|
521
|
-
- app/views/devise/sessions/pre_otp.
|
522
|
+
- app/views/devise/sessions/pre_otp.turbo_stream.erb
|
522
523
|
- app/views/devise/shared/_links.html.erb
|
523
524
|
- app/views/devise/shared/_oauth.html.erb
|
524
525
|
- app/views/devise/unlocks/new.html.erb
|
@@ -1 +0,0 @@
|
|
1
|
-
jQuery("#two-factor").html("<%= j render partial: "devise/registrations/two_factor"%>");
|
@@ -1 +0,0 @@
|
|
1
|
-
jQuery("#two-factor").html("<%= j render partial: "devise/registrations/two_factor"%>");
|
@@ -1 +0,0 @@
|
|
1
|
-
jQuery("#two-factor").html("<%= j render partial: "devise/registrations/two_factor", locals: {verified: @verified}%>");
|
@@ -1,12 +0,0 @@
|
|
1
|
-
<% if @email %>
|
2
|
-
document.querySelector("#step-1").classList.add("hidden");
|
3
|
-
document.querySelector("#step-2").classList.remove("hidden");
|
4
|
-
<% if @user&.otp_required_for_login %>
|
5
|
-
document.querySelector("#step-2-otp").classList.remove("hidden");
|
6
|
-
<% end %>
|
7
|
-
setTimeout(function() {
|
8
|
-
document.querySelector("#user_password").focus();
|
9
|
-
document.querySelector("#new_user").setAttribute('action', '/users/sign_in')
|
10
|
-
document.querySelector("#new_user").setAttribute('data-remote', 'false');
|
11
|
-
}, 1);
|
12
|
-
<% end %>
|