@@ -60,6 +60,7 @@ public function login(ServerRequestInterface $request): ?ResponseInterface
60
60
$ account ->setId ($ login ['id ' ]);
61
61
$ account ->setActive ((int )$ login ['active ' ] === 1 );
62
62
$ account ->setSetupComplete ((int )$ login ['setupComplete ' ] === 1 );
63
+ $ account ->setSendMailUnknownLogin ((int )$ login ['sendMailUnknownLogin ' ] === 1 );
63
64
64
65
if ($ account ->isActive () === false ) {
65
66
MESSAGES ->add ('danger ' , 'login-account-disabled ' );
@@ -72,18 +73,21 @@ public function login(ServerRequestInterface $request): ?ResponseInterface
72
73
MESSAGES ->add ('success ' , 'login-account-successful ' );
73
74
$ this ->accountService ->updateLastUserLogin ($ account );
74
75
75
- $ this ->mailerService ->configureMail (
76
- $ account ->getEmail (),
77
- 'Neue Anmeldung erkannt ' ,
78
- MailType::NEW_LOGIN_DETECTED_MAIL_ID ,
79
- [
80
- 'accountName ' => $ account ->getName (),
81
- 'browser ' => $ userInformation ->configure ($ _SERVER ['REMOTE_ADDR ' ], $ _SERVER ['HTTP_USER_AGENT ' ])->getBrowser (),
82
- 'country ' => $ userInformation ->getCountry (),
83
- 'ip ' => $ userInformation ->getIP ()
84
- ],
85
- $ account ->getId ()
86
- )->send ();
76
+ if ($ account ->isSendMailUnknownLogin ())
77
+ {
78
+ $ this ->mailerService ->configureMail (
79
+ $ account ->getEmail (),
80
+ 'Neue Anmeldung erkannt ' ,
81
+ MailType::NEW_LOGIN_DETECTED_MAIL_ID ,
82
+ [
83
+ 'accountName ' => $ account ->getName (),
84
+ 'browser ' => $ userInformation ->configure ($ _SERVER ['REMOTE_ADDR ' ], $ _SERVER ['HTTP_USER_AGENT ' ])->getBrowser (),
85
+ 'country ' => $ userInformation ->getCountry (),
86
+ 'ip ' => $ userInformation ->getIP ()
87
+ ],
88
+ $ account ->getId ()
89
+ )->send ();
90
+ }
87
91
88
92
89
93
$ _SESSION [Software::SESSION_USERID_NAME ] = $ account ->getId ();
0 commit comments