Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F2682546
D25452.1734663599.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Award Token
Flag For Later
Advanced/Developer...
View Handle
View Hovercard
Size
7 KB
Referenced Files
None
Subscribers
None
D25452.1734663599.diff
View Options
diff --git a/src/applications/auth/controller/contact/PhabricatorAuthContactNumberDisableController.php b/src/applications/auth/controller/contact/PhabricatorAuthContactNumberDisableController.php
--- a/src/applications/auth/controller/contact/PhabricatorAuthContactNumberDisableController.php
+++ b/src/applications/auth/controller/contact/PhabricatorAuthContactNumberDisableController.php
@@ -7,16 +7,19 @@
$viewer = $request->getViewer();
$id = $request->getURIData('id');
- $number = id(new PhabricatorAuthContactNumberQuery())
- ->setViewer($viewer)
- ->withIDs(array($id))
- ->requireCapabilities(
- array(
- PhabricatorPolicyCapability::CAN_VIEW,
- PhabricatorPolicyCapability::CAN_EDIT,
- ))
- ->executeOne();
- if (!$number) {
+ $sms_auth_factor = new PhabricatorSMSAuthFactor();
+ if ($sms_auth_factor->isSMSMailerConfigured()) {
+ $number = id(new PhabricatorAuthContactNumberQuery())
+ ->setViewer($viewer)
+ ->withIDs(array($id))
+ ->requireCapabilities(
+ array(
+ PhabricatorPolicyCapability::CAN_VIEW,
+ PhabricatorPolicyCapability::CAN_EDIT,
+ ))
+ ->executeOne();
+ }
+ if (!isset($number) || !$number) {
return new Aphront404Response();
}
diff --git a/src/applications/auth/controller/contact/PhabricatorAuthContactNumberEditController.php b/src/applications/auth/controller/contact/PhabricatorAuthContactNumberEditController.php
--- a/src/applications/auth/controller/contact/PhabricatorAuthContactNumberEditController.php
+++ b/src/applications/auth/controller/contact/PhabricatorAuthContactNumberEditController.php
@@ -4,9 +4,14 @@
extends PhabricatorAuthContactNumberController {
public function handleRequest(AphrontRequest $request) {
- return id(new PhabricatorAuthContactNumberEditEngine())
- ->setController($this)
- ->buildResponse();
+ $sms_auth_factor = new PhabricatorSMSAuthFactor();
+ if ($sms_auth_factor->isSMSMailerConfigured()) {
+ return id(new PhabricatorAuthContactNumberEditEngine())
+ ->setController($this)
+ ->buildResponse();
+ } else {
+ return new Aphront404Response();
+ }
}
}
diff --git a/src/applications/auth/controller/contact/PhabricatorAuthContactNumberPrimaryController.php b/src/applications/auth/controller/contact/PhabricatorAuthContactNumberPrimaryController.php
--- a/src/applications/auth/controller/contact/PhabricatorAuthContactNumberPrimaryController.php
+++ b/src/applications/auth/controller/contact/PhabricatorAuthContactNumberPrimaryController.php
@@ -7,16 +7,19 @@
$viewer = $request->getViewer();
$id = $request->getURIData('id');
- $number = id(new PhabricatorAuthContactNumberQuery())
- ->setViewer($viewer)
- ->withIDs(array($id))
- ->requireCapabilities(
- array(
- PhabricatorPolicyCapability::CAN_VIEW,
- PhabricatorPolicyCapability::CAN_EDIT,
- ))
- ->executeOne();
- if (!$number) {
+ $sms_auth_factor = new PhabricatorSMSAuthFactor();
+ if ($sms_auth_factor->isSMSMailerConfigured()) {
+ $number = id(new PhabricatorAuthContactNumberQuery())
+ ->setViewer($viewer)
+ ->withIDs(array($id))
+ ->requireCapabilities(
+ array(
+ PhabricatorPolicyCapability::CAN_VIEW,
+ PhabricatorPolicyCapability::CAN_EDIT,
+ ))
+ ->executeOne();
+ }
+ if (!isset($number) || !$number) {
return new Aphront404Response();
}
diff --git a/src/applications/auth/controller/contact/PhabricatorAuthContactNumberTestController.php b/src/applications/auth/controller/contact/PhabricatorAuthContactNumberTestController.php
--- a/src/applications/auth/controller/contact/PhabricatorAuthContactNumberTestController.php
+++ b/src/applications/auth/controller/contact/PhabricatorAuthContactNumberTestController.php
@@ -7,16 +7,19 @@
$viewer = $request->getViewer();
$id = $request->getURIData('id');
- $number = id(new PhabricatorAuthContactNumberQuery())
- ->setViewer($viewer)
- ->withIDs(array($id))
- ->requireCapabilities(
- array(
- PhabricatorPolicyCapability::CAN_VIEW,
- PhabricatorPolicyCapability::CAN_EDIT,
- ))
- ->executeOne();
- if (!$number) {
+ $sms_auth_factor = new PhabricatorSMSAuthFactor();
+ if ($sms_auth_factor->isSMSMailerConfigured()) {
+ $number = id(new PhabricatorAuthContactNumberQuery())
+ ->setViewer($viewer)
+ ->withIDs(array($id))
+ ->requireCapabilities(
+ array(
+ PhabricatorPolicyCapability::CAN_VIEW,
+ PhabricatorPolicyCapability::CAN_EDIT,
+ ))
+ ->executeOne();
+ }
+ if (!isset($number) || !$number) {
return new Aphront404Response();
}
diff --git a/src/applications/auth/controller/contact/PhabricatorAuthContactNumberViewController.php b/src/applications/auth/controller/contact/PhabricatorAuthContactNumberViewController.php
--- a/src/applications/auth/controller/contact/PhabricatorAuthContactNumberViewController.php
+++ b/src/applications/auth/controller/contact/PhabricatorAuthContactNumberViewController.php
@@ -6,11 +6,14 @@
public function handleRequest(AphrontRequest $request) {
$viewer = $this->getViewer();
- $number = id(new PhabricatorAuthContactNumberQuery())
- ->setViewer($viewer)
- ->withIDs(array($request->getURIData('id')))
- ->executeOne();
- if (!$number) {
+ $sms_auth_factor = new PhabricatorSMSAuthFactor();
+ if ($sms_auth_factor->isSMSMailerConfigured()) {
+ $number = id(new PhabricatorAuthContactNumberQuery())
+ ->setViewer($viewer)
+ ->withIDs(array($request->getURIData('id')))
+ ->executeOne();
+ }
+ if (!isset($number) || !$number) {
return new Aphront404Response();
}
diff --git a/src/applications/auth/factor/PhabricatorSMSAuthFactor.php b/src/applications/auth/factor/PhabricatorSMSAuthFactor.php
--- a/src/applications/auth/factor/PhabricatorSMSAuthFactor.php
+++ b/src/applications/auth/factor/PhabricatorSMSAuthFactor.php
@@ -334,7 +334,7 @@
return $value;
}
- private function isSMSMailerConfigured() {
+ public function isSMSMailerConfigured() {
$mailers = PhabricatorMetaMTAMail::newMailers(
array(
'outbound' => true,
diff --git a/src/applications/settings/panel/PhabricatorContactNumbersSettingsPanel.php b/src/applications/settings/panel/PhabricatorContactNumbersSettingsPanel.php
--- a/src/applications/settings/panel/PhabricatorContactNumbersSettingsPanel.php
+++ b/src/applications/settings/panel/PhabricatorContactNumbersSettingsPanel.php
@@ -19,6 +19,18 @@
return PhabricatorSettingsAuthenticationPanelGroup::PANELGROUPKEY;
}
+ /**
+ * Whether to display "Contact Numbers" panel in users' Personal
+ * Settings by checking if global SMS support is configured
+ */
+ public function isUserPanel() {
+ $sms_auth_factor = new PhabricatorSMSAuthFactor();
+ if ($sms_auth_factor->isSMSMailerConfigured()) {
+ return true;
+ }
+ return false;
+ }
+
public function isMultiFactorEnrollmentPanel() {
return true;
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Dec 20, 02:59 (21 h, 6 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1016424
Default Alt Text
D25452.1734663599.diff (7 KB)
Attached To
Mode
D25452: Do not expose Contact Numbers settings panel when no SMS support configured
Attached
Detach File
Event Timeline
Log In to Comment