Commit 46f75133 authored by Eric Eastwood's avatar Eric Eastwood

Fix NPE when lowercasing emails

Fix gitlab-org/gitter/webapp!1316 (comment 144968364)
parent 01ab8586
......@@ -21,6 +21,7 @@ Developer facing:
- Thanks to [@gtsiolis](https://gitlab.com/gtsiolis) for the contribution, https://gitlab.com/gitlab-org/gitter/webapp/merge_requests/1349
- Fix `rename-room.js` util scripts so it can move room to a different group/community
- Thanks to [@vicek22](https://gitlab.com/vicek22) for the contribution, https://gitlab.com/gitlab-org/gitter/webapp/merge_requests/1344
- Fix NPE when lowercasing emails on login/new-user, https://gitlab.com/gitlab-org/gitter/webapp/merge_requests/1352
# 19.37.1 - 2019-2-26
......
......@@ -13,7 +13,9 @@ module.exports = function trackNewUser(req, user, provider) {
emailAddressService(user).then(function(email) {
const emailList = user.emails || [];
emailList.unshift(email);
const lowerCaseEmailList = emailList.map(email => email.toLowerCase());
// We are sanitizing the data a bit here so the database
// doesn't store `null` and duplicate case different emails
const lowerCaseEmailList = emailList.filter(email => !!email).map(email => email.toLowerCase());
user.emails = _.uniq(lowerCaseEmailList);
stats.userUpdate(
......
......@@ -14,7 +14,9 @@ module.exports = function trackUserLogin(req, user, provider) {
const emailList = user.emails || [];
emailList.unshift(email);
const lowerCaseEmailList = emailList.map(email => email.toLowerCase());
// We are sanitizing the data a bit here so the database
// doesn't store `null` and duplicate case different emails
const lowerCaseEmailList = emailList.filter(email => !!email).map(email => email.toLowerCase());
user.emails = _.uniq(lowerCaseEmailList);
stats.userUpdate(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment