Fix password reset when querying for emails with upcase characters (fixes #9059) (#9707)

* downcase updating an email to be consistent with creating

* add tests to ensure downcase of email for create/update

* create migration to downcase existing User objects

* delete 'only'

* change gmail to example

* add trailing comma from lint error

* search for emails with at least one capital letter

* fix query in order to search for any email with at least one capital letter

* batch process effected users with at least one capital in email

* update script for batch process effected users
This commit is contained in:
Julius Jung
2018-03-17 17:13:54 -04:00
committed by Matteo Pagliazzi
parent b9a6d9ceec
commit 04b4912d59
4 changed files with 109 additions and 5 deletions

View File

@@ -357,6 +357,21 @@ describe('POST /user/auth/local/register', () => {
});
});
it('sanitizes email params to a lowercase string before creating the user', async () => {
let username = generateRandomUserName();
let email = 'ISANEmAiL@ExAmPle.coM';
let password = 'password';
let user = await api.post('/user/auth/local/register', {
username,
email,
password,
confirmPassword: password,
});
expect(user.auth.local.email).to.equal(email.toLowerCase());
});
it('fails on a habitica.com email', async () => {
let username = generateRandomUserName();
let email = `${username}@habitica.com`;