From 2a02e8a790409facd79973db12d94899ccb00c7f Mon Sep 17 00:00:00 2001 From: James Cole Date: Fri, 28 Aug 2020 22:03:27 +0200 Subject: [PATCH] Clarify + warning --- .env.example | 1 + app/Handlers/Events/UserEventHandler.php | 2 +- config/firefly.php | 17 ++++++++++------- resources/lang/en_US/email.php | 2 +- 4 files changed, 13 insertions(+), 9 deletions(-) diff --git a/.env.example b/.env.example index 2fc8fb386f..3b4f7c74c5 100644 --- a/.env.example +++ b/.env.example @@ -143,6 +143,7 @@ SPARKPOST_SECRET= # Firefly III can send you the following messages SEND_REGISTRATION_MAIL=true SEND_ERROR_MESSAGE=true +SEND_LOGIN_NEW_IP_WARNING=true # These messages contain (sensitive) transaction information: SEND_REPORT_JOURNALS=true diff --git a/app/Handlers/Events/UserEventHandler.php b/app/Handlers/Events/UserEventHandler.php index 1c0e1ea9bd..84106b85c3 100644 --- a/app/Handlers/Events/UserEventHandler.php +++ b/app/Handlers/Events/UserEventHandler.php @@ -168,7 +168,7 @@ class UserEventHandler $preference = array_values($preference); app('preferences')->setForUser($user, 'login_ip_history', $preference); - if (false === $inArray) { + if (false === $inArray && true === config('firefly.warn_new_ip')) { event(new DetectedNewIPAddress($user, $ip)); } diff --git a/config/firefly.php b/config/firefly.php index d1362741c8..7fd247cd60 100644 --- a/config/firefly.php +++ b/config/firefly.php @@ -101,7 +101,10 @@ return [ 'maxUploadSize' => 1073741824, // 1 GB 'send_error_message' => env('SEND_ERROR_MESSAGE', true), 'site_owner' => env('SITE_OWNER', ''), + + // send emails? 'send_registration_mail' => env('SEND_REGISTRATION_MAIL', true), + 'warn_new_ip' => env('SEND_LOGIN_NEW_IP_WARNING', true), 'demo_username' => env('DEMO_USERNAME', ''), 'demo_password' => env('DEMO_PASSWORD', ''), 'fixer_api_key' => env('FIXER_API_KEY', ''), @@ -450,14 +453,14 @@ return [ 'search' => [ 'operators' => [ - 'user_action' => ['alias' => false, 'needs_context' => true,], - 'description_starts' => ['alias' => false, 'needs_context' => true,], - 'description_ends' => ['alias' => false, 'needs_context' => true,], - 'description_contains' => ['alias' => false, 'needs_context' => true,], - 'description_is' => ['alias' => false, 'needs_context' => true,], + 'user_action' => ['alias' => false, 'needs_context' => true,], + 'description_starts' => ['alias' => false, 'needs_context' => true,], + 'description_ends' => ['alias' => false, 'needs_context' => true,], + 'description_contains' => ['alias' => false, 'needs_context' => true,], + 'description_is' => ['alias' => false, 'needs_context' => true,], - 'currency_is' => ['alias' => false, 'needs_context' => true,], - 'foreign_currency_is' => ['alias' => false, 'needs_context' => true,], + 'currency_is' => ['alias' => false, 'needs_context' => true,], + 'foreign_currency_is' => ['alias' => false, 'needs_context' => true,], 'has_attachments' => ['alias' => false, 'needs_context' => false,], 'has_no_category' => ['alias' => false, 'needs_context' => false,], diff --git a/resources/lang/en_US/email.php b/resources/lang/en_US/email.php index 3dddd0efcc..773dc1bc4f 100644 --- a/resources/lang/en_US/email.php +++ b/resources/lang/en_US/email.php @@ -35,7 +35,7 @@ return [ // new IP 'login_from_new_ip' => 'You logged in from an unknown IP address.', - 'new_ip_body' => 'You logged in from a new, unknown IP address:', + 'new_ip_body' => 'You logged in from a new, unknown IP address. If you never logged in from the IP address below, or it has been more than six months, Firefly III will warn you.', 'new_ip_warning' => 'If you didn\'t login, of if you have no idea what this is about, verify your password security, change it, and log out all other sessions. To do this, go to your profile page. Of course you have 2FA enabled already, right? Stay safe!', // access token created