mirror of
https://github.com/sudoxnym/habitica.git
synced 2026-05-19 20:28:53 +00:00
Trimmed username spaces (#9793)
This commit is contained in:
parent
286566fc0c
commit
0ea91016f8
2 changed files with 17 additions and 0 deletions
|
|
@ -37,6 +37,22 @@ describe('POST /user/auth/local/register', () => {
|
|||
expect(user.newUser).to.eql(true);
|
||||
});
|
||||
|
||||
it('remove spaces from username', async () => {
|
||||
let username = ' usernamewithspaces ';
|
||||
let email = 'test@example.com';
|
||||
let password = 'password';
|
||||
|
||||
let user = await api.post('/user/auth/local/register', {
|
||||
username,
|
||||
email,
|
||||
password,
|
||||
confirmPassword: password,
|
||||
});
|
||||
|
||||
expect(user.auth.local.username).to.eql(username.trim());
|
||||
expect(user.profile.name).to.eql(username.trim());
|
||||
});
|
||||
|
||||
context('provides default tags and tasks', async () => {
|
||||
it('for a generic API consumer', async () => {
|
||||
let username = generateRandomUserName();
|
||||
|
|
|
|||
|
|
@ -115,6 +115,7 @@ api.registerLocal = {
|
|||
// Get the lowercase version of username to check that we do not have duplicates
|
||||
// So we can search for it in the database and then reject the choosen username if 1 or more results are found
|
||||
email = email.toLowerCase();
|
||||
username = username.trim();
|
||||
let lowerCaseUsername = username.toLowerCase();
|
||||
|
||||
// Search for duplicates using lowercase version of username
|
||||
|
|
|
|||
Loading…
Reference in a new issue