mirror of
https://github.com/nextcloud/server.git
synced 2026-05-28 04:32:30 -04:00
Merge pull request #32305 from nextcloud/bugfix/32302/fix-browser-agent-trimming
Fix user agent trimming on installation
This commit is contained in:
commit
fd576b568c
2 changed files with 8 additions and 3 deletions
|
|
@ -85,7 +85,7 @@ class PublicKeyTokenProvider 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) . '…';
|
||||
}
|
||||
|
||||
$dbToken = $this->newToken($token, $uid, $loginName, $password, $name, $type, $remember);
|
||||
|
|
|
|||
|
|
@ -94,8 +94,6 @@ class PublicKeyTokenProviderTest extends TestCase {
|
|||
}
|
||||
|
||||
public function testGenerateTokenInvalidName() {
|
||||
$this->expectException(\OC\Authentication\Exceptions\InvalidTokenException::class);
|
||||
|
||||
$token = 'token';
|
||||
$uid = 'user';
|
||||
$user = 'User';
|
||||
|
|
@ -107,6 +105,13 @@ class PublicKeyTokenProviderTest extends TestCase {
|
|||
$type = IToken::PERMANENT_TOKEN;
|
||||
|
||||
$actual = $this->tokenProvider->generateToken($token, $uid, $user, $password, $name, $type, IToken::DO_NOT_REMEMBER);
|
||||
|
||||
$this->assertInstanceOf(PublicKeyToken::class, $actual);
|
||||
$this->assertSame($uid, $actual->getUID());
|
||||
$this->assertSame($user, $actual->getLoginName());
|
||||
$this->assertSame('User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.12) Gecko/20101026 Firefox/3.6.12User-Agent: Mozill…', $actual->getName());
|
||||
$this->assertSame(IToken::DO_NOT_REMEMBER, $actual->getRemember());
|
||||
$this->assertSame($password, $this->tokenProvider->getPassword($actual, $token));
|
||||
}
|
||||
|
||||
public function testUpdateToken() {
|
||||
|
|
|
|||
Loading…
Reference in a new issue