Convert emails to lowercase when storing

And db migration sql to convert existing addresses.
This commit is contained in:
David Baker 2016-10-19 11:13:55 +01:00
parent 29c5922021
commit df2a616c7b
2 changed files with 20 additions and 1 deletions

View file

@ -13,4 +13,11 @@
* limitations under the License.
*/
CREATE INDEX user_threepids_medium_address on user_threepids (medium, LOWER(address));
/*
* Update any email addresses that were stored with mixed case into all
* lowercase
*/
UPDATE user_threepids SET address = LOWER(address) where medium = 'email';
/* Add an index for the select we do on passwored reset */
CREATE INDEX user_threepids_medium_address on user_threepids (medium, address);