Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2022-03-23 23:38:53 +0300
committerJoas Schilling <coding@schilljs.com>2022-03-23 23:38:53 +0300
commitd683e0d3d1448111d8de1ffaa480dcb203f61143 (patch)
tree74b29f9cefd1452aff85cec4483b65f4e50e7880 /lib
parentc1215f573ae98fb3cf66f9ff5dc408574a7df560 (diff)
Automatically cut the token name on the first level
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/private/Authentication/Token/IProvider.php2
-rw-r--r--lib/private/Authentication/Token/Manager.php4
2 files changed, 3 insertions, 3 deletions
diff --git a/lib/private/Authentication/Token/IProvider.php b/lib/private/Authentication/Token/IProvider.php
index e604ac715c2..0a145bfd7e6 100644
--- a/lib/private/Authentication/Token/IProvider.php
+++ b/lib/private/Authentication/Token/IProvider.php
@@ -44,7 +44,7 @@ interface IProvider {
* @param string $uid
* @param string $loginName
* @param string|null $password
- * @param string $name
+ * @param string $name Name will be trimmed to 120 chars when longer
* @param int $type token type
* @param int $remember whether the session token should be used for remember-me
* @return IToken
diff --git a/lib/private/Authentication/Token/Manager.php b/lib/private/Authentication/Token/Manager.php
index ae0874733f8..f8a0fb11c52 100644
--- a/lib/private/Authentication/Token/Manager.php
+++ b/lib/private/Authentication/Token/Manager.php
@@ -49,7 +49,7 @@ class Manager implements IProvider {
* @param string $uid
* @param string $loginName
* @param string|null $password
- * @param string $name
+ * @param string $name Name will be trimmed to 120 chars when longer
* @param int $type token type
* @param int $remember whether the session token should be used for remember-me
* @return IToken
@@ -62,7 +62,7 @@ class Manager implements IProvider {
int $type = IToken::TEMPORARY_TOKEN,
int $remember = IToken::DO_NOT_REMEMBER): IToken {
if (mb_strlen($name) > 128) {
- throw new InvalidTokenException('The given name is too long');
+ $name = mb_substr($name, 0, 120) . '…';
}
try {