FEATURE: even if users have 2fa enabled still show GitHub association

FEATURE: even if users have 2fa enabled still show GitHub association
From c1ee54af77fd680dacae10efe496689429bcdbe1 Mon Sep 17 00:00:00 2001
From: Sam <sam.saffron@gmail.com>
Date: Mon, 10 Dec 2018 10:17:42 +1100
Subject: [PATCH] FEATURE: even if users have 2fa enabled still show GitHub
 association


diff --git a/assets/javascripts/discourse/initializers/init-code-review.js.es6 b/assets/javascripts/discourse/initializers/init-code-review.js.es6
index 246fc31..dad593a 100644
--- a/assets/javascripts/discourse/initializers/init-code-review.js.es6
+++ b/assets/javascripts/discourse/initializers/init-code-review.js.es6
@@ -21,6 +21,14 @@ function initialize(api) {
   api.addPostSmallActionIcon("followup", "far-clock");
   api.addPostSmallActionIcon("approved", "thumbs-up");
 
+  // we need to allow unconditional association even with 2fa
+  // core hides this section if 2fa is on for a user
+  api.modifyClass("controller:preferences/account", {
+    canUpdateAssociatedAccounts: function() {
+      return this.get("authProviders.length") > 0;
+    }.property("authProviders")
+  });
+
   function allowUser() {
     const currentUser = api.getCurrentUser();
     if (!currentUser) {

GitHub

2 Likes