notification: do not send login notification for external users

This commit is contained in:
Girish Ramakrishnan
2024-06-13 16:47:08 +02:00
parent 6b4df0bd65
commit 649c06b641
4 changed files with 5 additions and 3 deletions

View File

@@ -743,6 +743,7 @@ async function notifyLoginLocation(user, ip, userAgent, auditSource) {
if (constants.DEMO) return;
if (constants.TEST && ip === '127.0.0.1') return;
if (user.ghost || user.source) return; // for external users, rely on the external source to send login notification to avoid dup login emails
const response = await superagent.get('https://geolocation.cloudron.io/json').query({ ip }).ok(() => true);
if (response.statusCode !== 200) return debug(`Failed to get geoip info. statusCode: ${response.statusCode}`);