Page MenuHomestyx hydra

No OneTemporary

diff --git a/src/applications/auth/action/PhabricatorAuthChangePasswordAction.php b/src/applications/auth/action/PhabricatorAuthChangePasswordAction.php
index 323c3e65b6..41aac1ec12 100644
--- a/src/applications/auth/action/PhabricatorAuthChangePasswordAction.php
+++ b/src/applications/auth/action/PhabricatorAuthChangePasswordAction.php
@@ -1,22 +1,18 @@
<?php
final class PhabricatorAuthChangePasswordAction
extends PhabricatorSystemAction {
const TYPECONST = 'auth.password';
- public function getActionConstant() {
- return self::TYPECONST;
- }
-
public function getScoreThreshold() {
return 20 / phutil_units('1 hour in seconds');
}
public function getLimitExplanation() {
return pht(
'You have failed to enter the correct account password too often in '.
'a short period of time.');
}
}
diff --git a/src/applications/auth/action/PhabricatorAuthEmailLoginAction.php b/src/applications/auth/action/PhabricatorAuthEmailLoginAction.php
index c7729047b4..97fe5b48e1 100644
--- a/src/applications/auth/action/PhabricatorAuthEmailLoginAction.php
+++ b/src/applications/auth/action/PhabricatorAuthEmailLoginAction.php
@@ -1,21 +1,17 @@
<?php
final class PhabricatorAuthEmailLoginAction extends PhabricatorSystemAction {
const TYPECONST = 'mail.login';
- public function getActionConstant() {
- return self::TYPECONST;
- }
-
public function getScoreThreshold() {
return 3 / phutil_units('1 hour in seconds');
}
public function getLimitExplanation() {
return pht(
'Too many account recovery email links have been sent to this account '.
'in a short period of time.');
}
}
diff --git a/src/applications/auth/action/PhabricatorAuthNewFactorAction.php b/src/applications/auth/action/PhabricatorAuthNewFactorAction.php
index c1244587f1..82b851d383 100644
--- a/src/applications/auth/action/PhabricatorAuthNewFactorAction.php
+++ b/src/applications/auth/action/PhabricatorAuthNewFactorAction.php
@@ -1,21 +1,17 @@
<?php
final class PhabricatorAuthNewFactorAction extends PhabricatorSystemAction {
const TYPECONST = 'auth.factor.new';
- public function getActionConstant() {
- return self::TYPECONST;
- }
-
public function getScoreThreshold() {
return 60 / phutil_units('1 hour in seconds');
}
public function getLimitExplanation() {
return pht(
'You have failed too many attempts to synchronize new multi-factor '.
'authentication methods in a short period of time.');
}
}
diff --git a/src/applications/auth/action/PhabricatorAuthTestSMSAction.php b/src/applications/auth/action/PhabricatorAuthTestSMSAction.php
index d0f4a6bb7e..a03f4d6877 100644
--- a/src/applications/auth/action/PhabricatorAuthTestSMSAction.php
+++ b/src/applications/auth/action/PhabricatorAuthTestSMSAction.php
@@ -1,22 +1,18 @@
<?php
final class PhabricatorAuthTestSMSAction extends PhabricatorSystemAction {
const TYPECONST = 'auth.sms.test';
- public function getActionConstant() {
- return self::TYPECONST;
- }
-
public function getScoreThreshold() {
return 60 / phutil_units('1 hour in seconds');
}
public function getLimitExplanation() {
return pht(
'You and other users on this install are collectively sending too '.
'many test text messages too quickly. Wait a few minutes to continue '.
'texting tests.');
}
}
diff --git a/src/applications/auth/action/PhabricatorAuthTryEmailLoginAction.php b/src/applications/auth/action/PhabricatorAuthTryEmailLoginAction.php
index 001358e3f6..abb1a6c099 100644
--- a/src/applications/auth/action/PhabricatorAuthTryEmailLoginAction.php
+++ b/src/applications/auth/action/PhabricatorAuthTryEmailLoginAction.php
@@ -1,22 +1,18 @@
<?php
final class PhabricatorAuthTryEmailLoginAction
extends PhabricatorSystemAction {
const TYPECONST = 'mail.try-login';
- public function getActionConstant() {
- return self::TYPECONST;
- }
-
public function getScoreThreshold() {
return 20 / phutil_units('1 hour in seconds');
}
public function getLimitExplanation() {
return pht(
'You have made too many account recovery requests in a short period '.
'of time.');
}
}
diff --git a/src/applications/auth/action/PhabricatorAuthTryFactorAction.php b/src/applications/auth/action/PhabricatorAuthTryFactorAction.php
index 246298567b..d57b481213 100644
--- a/src/applications/auth/action/PhabricatorAuthTryFactorAction.php
+++ b/src/applications/auth/action/PhabricatorAuthTryFactorAction.php
@@ -1,21 +1,17 @@
<?php
final class PhabricatorAuthTryFactorAction extends PhabricatorSystemAction {
const TYPECONST = 'auth.factor';
- public function getActionConstant() {
- return self::TYPECONST;
- }
-
public function getScoreThreshold() {
return 10 / phutil_units('1 hour in seconds');
}
public function getLimitExplanation() {
return pht(
'You have failed to verify multi-factor authentication too often in '.
'a short period of time.');
}
}
diff --git a/src/applications/auth/action/PhabricatorAuthTryPasswordAction.php b/src/applications/auth/action/PhabricatorAuthTryPasswordAction.php
index 440cbf301e..9ec6799c38 100644
--- a/src/applications/auth/action/PhabricatorAuthTryPasswordAction.php
+++ b/src/applications/auth/action/PhabricatorAuthTryPasswordAction.php
@@ -1,22 +1,18 @@
<?php
final class PhabricatorAuthTryPasswordAction
extends PhabricatorSystemAction {
const TYPECONST = 'auth.password';
- public function getActionConstant() {
- return self::TYPECONST;
- }
-
public function getScoreThreshold() {
return 100 / phutil_units('1 hour in seconds');
}
public function getLimitExplanation() {
return pht(
'Your remote address has made too many login attempts in a short '.
'period of time.');
}
}
diff --git a/src/applications/auth/action/PhabricatorAuthTryPasswordWithoutCAPTCHAAction.php b/src/applications/auth/action/PhabricatorAuthTryPasswordWithoutCAPTCHAAction.php
index ee6433a9ee..0e09820273 100644
--- a/src/applications/auth/action/PhabricatorAuthTryPasswordWithoutCAPTCHAAction.php
+++ b/src/applications/auth/action/PhabricatorAuthTryPasswordWithoutCAPTCHAAction.php
@@ -1,16 +1,12 @@
<?php
final class PhabricatorAuthTryPasswordWithoutCAPTCHAAction
extends PhabricatorSystemAction {
const TYPECONST = 'auth.password-without-captcha';
- public function getActionConstant() {
- return self::TYPECONST;
- }
-
public function getScoreThreshold() {
return 10 / phutil_units('1 hour in seconds');
}
}
diff --git a/src/applications/files/action/PhabricatorFilesOutboundRequestAction.php b/src/applications/files/action/PhabricatorFilesOutboundRequestAction.php
index acba2f8882..7a1d3d2d56 100644
--- a/src/applications/files/action/PhabricatorFilesOutboundRequestAction.php
+++ b/src/applications/files/action/PhabricatorFilesOutboundRequestAction.php
@@ -1,22 +1,18 @@
<?php
final class PhabricatorFilesOutboundRequestAction
extends PhabricatorSystemAction {
const TYPECONST = 'files.outbound';
- public function getActionConstant() {
- return self::TYPECONST;
- }
-
public function getScoreThreshold() {
return 60 / phutil_units('1 hour in seconds');
}
public function getLimitExplanation() {
return pht(
'You have initiated too many outbound requests to fetch remote URIs '.
'recently.');
}
}
diff --git a/src/applications/metamta/action/PhabricatorMetaMTAErrorMailAction.php b/src/applications/metamta/action/PhabricatorMetaMTAErrorMailAction.php
index 0bc8b29172..cabb8c82b0 100644
--- a/src/applications/metamta/action/PhabricatorMetaMTAErrorMailAction.php
+++ b/src/applications/metamta/action/PhabricatorMetaMTAErrorMailAction.php
@@ -1,13 +1,11 @@
<?php
final class PhabricatorMetaMTAErrorMailAction extends PhabricatorSystemAction {
- public function getActionConstant() {
- return 'email.error';
- }
+ const TYPECONST = 'email.error';
public function getScoreThreshold() {
return 6 / phutil_units('1 hour in seconds');
}
}
diff --git a/src/applications/phortune/action/PhortuneAddPaymentMethodAction.php b/src/applications/phortune/action/PhortuneAddPaymentMethodAction.php
index 09a8cd2f5d..5f32e67cee 100644
--- a/src/applications/phortune/action/PhortuneAddPaymentMethodAction.php
+++ b/src/applications/phortune/action/PhortuneAddPaymentMethodAction.php
@@ -1,22 +1,18 @@
<?php
final class PhortuneAddPaymentMethodAction
extends PhabricatorSystemAction {
const TYPECONST = 'phortune.payment-method.add';
- public function getActionConstant() {
- return self::TYPECONST;
- }
-
public function getScoreThreshold() {
return 60 / phutil_units('1 hour in seconds');
}
public function getLimitExplanation() {
return pht(
'You are making too many attempts to add payment methods in a short '.
'period of time.');
}
}
diff --git a/src/applications/settings/action/PhabricatorSettingsAddEmailAction.php b/src/applications/settings/action/PhabricatorSettingsAddEmailAction.php
index 764db7f543..4038e37c9f 100644
--- a/src/applications/settings/action/PhabricatorSettingsAddEmailAction.php
+++ b/src/applications/settings/action/PhabricatorSettingsAddEmailAction.php
@@ -1,20 +1,16 @@
<?php
final class PhabricatorSettingsAddEmailAction extends PhabricatorSystemAction {
const TYPECONST = 'email.add';
- public function getActionConstant() {
- return self::TYPECONST;
- }
-
public function getScoreThreshold() {
return 6 / phutil_units('1 hour in seconds');
}
public function getLimitExplanation() {
return pht(
'You are adding too many email addresses to your account too quickly.');
}
}
diff --git a/src/applications/system/action/PhabricatorSystemAction.php b/src/applications/system/action/PhabricatorSystemAction.php
index 329824bacc..b712dfca8c 100644
--- a/src/applications/system/action/PhabricatorSystemAction.php
+++ b/src/applications/system/action/PhabricatorSystemAction.php
@@ -1,40 +1,43 @@
<?php
abstract class PhabricatorSystemAction extends Phobject {
- abstract public function getActionConstant();
+ final public function getActionConstant() {
+ return $this->getPhobjectClassConstant('TYPECONST', 32);
+ }
+
abstract public function getScoreThreshold();
public function shouldBlockActor($actor, $score) {
return ($score > $this->getScoreThreshold());
}
public function getLimitExplanation() {
return pht('You are performing too many actions too quickly.');
}
public function getRateExplanation($score) {
return pht(
'The maximum allowed rate for this action is %s. You are taking '.
'actions at a rate of %s.',
$this->formatRate($this->getScoreThreshold()),
$this->formatRate($score));
}
protected function formatRate($rate) {
if ($rate > 10) {
$str = pht('%d / second', $rate);
} else {
$rate *= 60;
if ($rate > 10) {
$str = pht('%d / minute', $rate);
} else {
$rate *= 60;
$str = pht('%d / hour', $rate);
}
}
return phutil_tag('strong', array(), $str);
}
}

File Metadata

Mime Type
text/x-diff
Expires
Thu, Jul 3, 6:13 PM (1 d, 16 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
166156
Default Alt Text
(11 KB)

Event Timeline