about summary refs log tree commit diff
diff options
context:
space:
mode:
authorThibaut Girka <thib@sitedethib.com>2020-08-30 17:26:18 +0200
committerThibaut Girka <thib@sitedethib.com>2020-08-30 17:26:18 +0200
commita68ec50e4e38898e88a7dcc33bd0032adc946dda (patch)
tree8137b48a716e05424ca544210d86e91818085ba7
parenta340e653df30a90910675f09284059055a598d46 (diff)
Adapt 2FA changes to glitch-soc's theming system
-rw-r--r--app/controllers/settings/two_factor_authentication/webauthn_credentials_controller.rb4
-rw-r--r--app/javascript/core/auth.js2
-rw-r--r--app/javascript/core/theme.yml2
-rw-r--r--app/javascript/core/two_factor_authentication.js (renamed from app/javascript/packs/two_factor_authentication.js)0
-rw-r--r--app/views/auth/sessions/two_factor.html.haml2
-rw-r--r--app/views/settings/two_factor_authentication/webauthn_credentials/new.html.haml2
6 files changed, 7 insertions, 5 deletions
diff --git a/app/controllers/settings/two_factor_authentication/webauthn_credentials_controller.rb b/app/controllers/settings/two_factor_authentication/webauthn_credentials_controller.rb
index a19c604f3..ee5392785 100644
--- a/app/controllers/settings/two_factor_authentication/webauthn_credentials_controller.rb
+++ b/app/controllers/settings/two_factor_authentication/webauthn_credentials_controller.rb
@@ -85,6 +85,10 @@ module Settings
 
       private
 
+      def set_pack
+        use_pack 'auth'
+      end
+
       def require_otp_enabled
         unless current_user.otp_enabled?
           flash[:error] = t('webauthn_credentials.otp_required')
diff --git a/app/javascript/core/auth.js b/app/javascript/core/auth.js
new file mode 100644
index 000000000..ca04730a3
--- /dev/null
+++ b/app/javascript/core/auth.js
@@ -0,0 +1,2 @@
+import './settings';
+import './two_factor_authentication';
diff --git a/app/javascript/core/theme.yml b/app/javascript/core/theme.yml
index dc641772c..b9144e43a 100644
--- a/app/javascript/core/theme.yml
+++ b/app/javascript/core/theme.yml
@@ -3,7 +3,7 @@
 pack:
   about:
   admin: admin.js
-  auth: settings.js
+  auth: auth.js
   common:
     filename: common.js
     stylesheet: true
diff --git a/app/javascript/packs/two_factor_authentication.js b/app/javascript/core/two_factor_authentication.js
index dde06be8c..dde06be8c 100644
--- a/app/javascript/packs/two_factor_authentication.js
+++ b/app/javascript/core/two_factor_authentication.js
diff --git a/app/views/auth/sessions/two_factor.html.haml b/app/views/auth/sessions/two_factor.html.haml
index f2f6fe19d..1867ec7f8 100644
--- a/app/views/auth/sessions/two_factor.html.haml
+++ b/app/views/auth/sessions/two_factor.html.haml
@@ -1,8 +1,6 @@
 - content_for :page_title do
   = t('auth.login')
 
-=javascript_pack_tag 'two_factor_authentication', integrity: true, crossorigin: 'anonymous'
-
 - if @webauthn_enabled
   = render partial: 'auth/sessions/two_factor/webauthn_form', locals: { hidden: @scheme_type != 'webauthn' }
 
diff --git a/app/views/settings/two_factor_authentication/webauthn_credentials/new.html.haml b/app/views/settings/two_factor_authentication/webauthn_credentials/new.html.haml
index 0b23bb689..c5a323ee5 100644
--- a/app/views/settings/two_factor_authentication/webauthn_credentials/new.html.haml
+++ b/app/views/settings/two_factor_authentication/webauthn_credentials/new.html.haml
@@ -12,5 +12,3 @@
 
   .actions
     = f.button :button, t('webauthn_credentials.add'), class: 'js-webauthn', type: :submit
-
-= javascript_pack_tag 'two_factor_authentication', integrity: true, crossorigin: 'anonymous'