summaryrefslogtreecommitdiffstats
path: root/Core/Encoder/BasePasswordEncoder.php
diff options
context:
space:
mode:
authorFabien Potencier <fabien.potencier@gmail.com>2013-10-10 15:12:30 +0200
committerFabien Potencier <fabien.potencier@gmail.com>2013-10-10 15:12:30 +0200
commitb6d302f1f0f1235aa376c180dcd289f38b3df70e (patch)
tree676aa0d8ce931531f31494da3f65a2d8f12bb967 /Core/Encoder/BasePasswordEncoder.php
parent5d889265454c4b094e894a14f0d9b4687fa644e1 (diff)
parent41cbe3694a5332d7e5bdb285c81bbfe23f31a220 (diff)
downloadsymfony-security-b6d302f1f0f1235aa376c180dcd289f38b3df70e.zip
symfony-security-b6d302f1f0f1235aa376c180dcd289f38b3df70e.tar.gz
symfony-security-b6d302f1f0f1235aa376c180dcd289f38b3df70e.tar.bz2
Merge branch '2.2' into 2.3v2.3.6
* 2.2: bumped Symfony version to 2.2.10 updated VERSION for 2.2.9 update CONTRIBUTORS for 2.2.9 updated CHANGELOG for 2.2.9 [Security] limited the password length passed to encoders assets:install command should mirror .dotfiles (.htaccess) PoFileDumper - PO headers removed whitespaces Conflicts: src/Symfony/Component/HttpKernel/Kernel.php src/Symfony/Component/Security/Core/Encoder/BCryptPasswordEncoder.php
Diffstat (limited to 'Core/Encoder/BasePasswordEncoder.php')
-rw-r--r--Core/Encoder/BasePasswordEncoder.php12
1 files changed, 12 insertions, 0 deletions
diff --git a/Core/Encoder/BasePasswordEncoder.php b/Core/Encoder/BasePasswordEncoder.php
index c26c9ce..b83eb30 100644
--- a/Core/Encoder/BasePasswordEncoder.php
+++ b/Core/Encoder/BasePasswordEncoder.php
@@ -20,6 +20,8 @@ use Symfony\Component\Security\Core\Util\StringUtils;
*/
abstract class BasePasswordEncoder implements PasswordEncoderInterface
{
+ const MAX_PASSWORD_LENGTH = 4096;
+
/**
* Demerges a merge password and salt string.
*
@@ -83,4 +85,14 @@ abstract class BasePasswordEncoder implements PasswordEncoderInterface
{
return StringUtils::equals($password1, $password2);
}
+
+ /**
+ * Checks if the password is too long.
+ *
+ * @return Boolean true if the password is too long, false otherwise
+ */
+ protected function isPasswordTooLong($password)
+ {
+ return strlen($password) > self::MAX_PASSWORD_LENGTH;
+ }
}