Always trim the username before saving changes in the database

Fixes #4742
This commit is contained in:
Frédéric Guillot
2023-02-12 18:17:23 -08:00
committed by Frédéric Guillot
parent 5f3225bddc
commit bd8bcfbc37
2 changed files with 13 additions and 0 deletions

View File

@@ -394,4 +394,13 @@ class UserModelTest extends Base
$project = $projectModel->getById(1);
$this->assertEquals(0, $project['is_active']);
}
public function testTrimUsername()
{
$userModel = new UserModel($this->container);
$this->assertNotFalse($userModel->create(array('username' => 'test ')));
$this->assertNotEmpty($userModel->getByUsername('test'));
$this->assertEmpty($userModel->getByUsername('test '));
}
}