diff options
author | Joas Schilling <coding@schilljs.com> | 2023-01-04 11:23:43 +0100 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2023-01-04 11:23:43 +0100 |
commit | b4a29644ccfc1acafcfbdb8b7b887df1fe520166 (patch) | |
tree | 4725bc96a608f2430c267145232c5b9a42ab835e /lib | |
parent | ce50acd9b2d7acb3f04fd7c7940e821cb3d76a71 (diff) | |
download | nextcloud-server-b4a29644ccfc1acafcfbdb8b7b887df1fe520166.tar.gz nextcloud-server-b4a29644ccfc1acafcfbdb8b7b887df1fe520166.zip |
Add a const for the max user password length
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/Authentication/Token/PublicKeyTokenProvider.php | 3 | ||||
-rw-r--r-- | lib/public/IUserManager.php | 6 |
2 files changed, 8 insertions, 1 deletions
diff --git a/lib/private/Authentication/Token/PublicKeyTokenProvider.php b/lib/private/Authentication/Token/PublicKeyTokenProvider.php index c7e29568383..d00d3e41539 100644 --- a/lib/private/Authentication/Token/PublicKeyTokenProvider.php +++ b/lib/private/Authentication/Token/PublicKeyTokenProvider.php @@ -40,6 +40,7 @@ use OCP\AppFramework\Db\DoesNotExistException; use OCP\AppFramework\Utility\ITimeFactory; use OCP\IConfig; use OCP\IDBConnection; +use OCP\IUserManager; use OCP\Security\ICrypto; use Psr\Log\LoggerInterface; @@ -397,7 +398,7 @@ class PublicKeyTokenProvider implements IProvider { $dbToken->setPrivateKey($this->encrypt($privateKey, $token)); if (!is_null($password) && $this->config->getSystemValueBool('auth.storeCryptedPassword', true)) { - if (strlen($password) > 469) { + if (strlen($password) > IUserManager::MAX_PASSWORD_LENGTH) { throw new \RuntimeException('Trying to save a password with more than 469 characters is not supported. If you want to use big passwords, disable the auth.storeCryptedPassword option in config.php'); } $dbToken->setPassword($this->encryptPassword($password, $publicKey)); diff --git a/lib/public/IUserManager.php b/lib/public/IUserManager.php index 8caa027468b..151c153917f 100644 --- a/lib/public/IUserManager.php +++ b/lib/public/IUserManager.php @@ -46,6 +46,12 @@ namespace OCP; * @since 8.0.0 */ interface IUserManager { + + /** + * @since 26.0.0 + */ + public const MAX_PASSWORD_LENGTH = 469; + /** * register a user backend * |