-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Give users a username property that is unique and can be used publicly
- Loading branch information
Showing
3 changed files
with
81 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Reporting a security vulnerability | ||
|
||
If you believe that you have found a security vulnerability in the project, please let us know immediately, via a private and secure channel. Please do not create a public issue. | ||
|
||
To establish a mutual secure channel, please send an initial email to [[email protected]](mailto:[email protected]). We will get back to you as soon as possible. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,7 @@ public function testSetPassword(): void | |
{ | ||
$user = new User([ | ||
"display_name" => "John Doe", | ||
"username" => "john_doe", | ||
"email" => "[email protected]", | ||
"password_hash" => "", | ||
"status" => 0 | ||
|
@@ -32,18 +33,43 @@ public function testSetEmail(): void | |
{ | ||
$user = new User([ | ||
"display_name" => "John Doe", | ||
"username" => "john_doe", | ||
"email" => "[email protected]", | ||
"password_hash" => "", | ||
"status" => 0 | ||
]); | ||
|
||
// Test setting a valid email | ||
$this->assertTrue($user->setEmail('[email protected]')); | ||
$this->assertEquals('[email protected]', $user->getEmail()); | ||
|
||
// Test setting an invalid email | ||
$this->assertFalse($user->setEmail('invalid-email')); | ||
$this->assertNotEquals('invalid-email', $user->getEmail()); | ||
$this->assertEquals('[email protected]', $user->getEmail()); | ||
|
||
// TODO test whether duplicate checking works | ||
} | ||
|
||
public function testSetUsername(): void | ||
{ | ||
$user = new User([ | ||
"display_name" => "John Doe", | ||
"username" => "john_doe", | ||
"email" => "[email protected]", | ||
"password_hash" => "", | ||
"status" => 0 | ||
]); | ||
|
||
// Test setting a valid username | ||
$this->assertTrue($user->setUsername('john_doe2')); | ||
$this->assertEquals('john_doe2', $user->getUsername()); | ||
|
||
// Test setting an invalid username | ||
$this->assertFalse($user->setUsername('invalid-username')); | ||
$this->assertNotEquals('invalid-username', $user->getUsername()); | ||
$this->assertEquals('john_doe2', $user->getUsername()); | ||
|
||
// TODO test whether duplicate checking works | ||
} | ||
} |