new login mail: minor adjustments to text

This commit is contained in:
Girish Ramakrishnan
2021-04-30 11:32:15 -07:00
parent 698ab93cc9
commit 64414eb932
4 changed files with 25 additions and 16 deletions
+3 -2
View File
@@ -553,13 +553,14 @@ function checkLoginLocation(user, ip, userAgent) {
// purge potentially old locations where ts > now() - 6 months
const sixMonthsBack = Date.now() - 6 * 30 * 24 * 60 * 60 * 1000;
const newLoginLocation = { ts: Date.now(), ip, userAgent, country, city };
let loginLocations = user.loginLocations.filter(function (l) { return l.ts > sixMonthsBack; });
loginLocations.push({ ts: Date.now(), ip, userAgent, country, city });
loginLocations.push(newLoginLocation);
userdb.update(user.id, { loginLocations }, function (error) {
if (error) console.error('checkLoginLocation: Failed to update user location.', error);
mailer.sendNewLoginLocation(user, ip, userAgent, country, city);
mailer.sendNewLoginLocation(user, newLoginLocation);
});
});
}