From e7f311558f215f6025164a58fc6935a43dfb8c92 Mon Sep 17 00:00:00 2001 From: trendschau Date: Mon, 15 Jan 2024 17:15:20 +0100 Subject: [PATCH] V2.1.0 Fixed simplemail and empty line in template --- data/security/securitylog.txt | 1 + .../Controllers/ControllerWebAuth.php | 42 +++++++++++++++---- system/typemill/Middleware/FlashMessages.php | 2 +- system/typemill/Models/SimpleMail.php | 2 +- system/typemill/Static/License.php | 4 +- system/typemill/system.php | 6 +-- 6 files changed, 39 insertions(+), 18 deletions(-) diff --git a/data/security/securitylog.txt b/data/security/securitylog.txt index 2eee11f..b123e63 100644 --- a/data/security/securitylog.txt +++ b/data/security/securitylog.txt @@ -16,3 +16,4 @@ 127.0.0.1;2023-12-27 11:31:36;login: authcode wrong or outdated. 127.0.0.1;2023-12-27 11:31:52;login: authcode wrong or outdated. 127.0.0.1;2023-12-27 11:32:10;login: authcode wrong or outdated. +127.0.0.1;2024-01-15 13:11:20;login: invalid data diff --git a/system/typemill/Controllers/ControllerWebAuth.php b/system/typemill/Controllers/ControllerWebAuth.php index 6359fa8..2815b46 100644 --- a/system/typemill/Controllers/ControllerWebAuth.php +++ b/system/typemill/Controllers/ControllerWebAuth.php @@ -36,7 +36,10 @@ class ControllerWebAuth extends Controller \Typemill\Static\Helpers::addLogEntry('login: invalid data'); } - $this->c->get('flash')->addMessage('error', Translations::translate('Wrong password or username, please try again.')); + if($this->c->get('flash')) + { + $this->c->get('flash')->addMessage('error', Translations::translate('Wrong password or username, please try again.')); + } return $response->withHeader('Location', $this->routeParser->urlFor('auth.show'))->withStatus(302); } @@ -50,7 +53,10 @@ class ControllerWebAuth extends Controller \Typemill\Static\Helpers::addLogEntry('login: user not found'); } - $this->c->get('flash')->addMessage('error', Translations::translate('Wrong password or username, please try again.')); + if($this->c->get('flash')) + { + $this->c->get('flash')->addMessage('error', Translations::translate('Wrong password or username, please try again.')); + } return $response->withHeader('Location', $this->routeParser->urlFor('auth.show'))->withStatus(302); } @@ -79,7 +85,10 @@ class ControllerWebAuth extends Controller ]); } - $this->c->get('flash')->addMessage('error', Translations::translate('Wrong password or username, please try again.')); + if($this->c->get('flash')) + { + $this->c->get('flash')->addMessage('error', Translations::translate('Wrong password or username, please try again.')); + } return $response->withHeader('Location', $this->routeParser->urlFor('auth.show'))->withStatus(302); } @@ -103,8 +112,11 @@ class ControllerWebAuth extends Controller $mail = new SimpleMail($this->settings); - $subject = Translations::translate('Your verification code for Typemill'); - $message = Translations::translate('Use the following verification code to login into Typemill') . ': ' . $authcodevalue; + $subject = Translations::translate('Your Typemill verification code'); + $message = Translations::translate('Dear user') . ',

'; + $message .= Translations::translate('Someone tried to log in to your Typemill website and we want to make sure it is you. Enter the following verification code to finish your login. The code will be valid for 5 minutes.'); + $message .= '

' . $authcodevalue . '

'; + $message .= Translations::translate('If you did not make this login attempt, please reset your password immediately.'); $send = $mail->send($userdata['email'], $subject, $message); @@ -136,7 +148,10 @@ class ControllerWebAuth extends Controller \Typemill\Static\Helpers::addLogEntry('login: user not confirmed yet.'); } - $this->c->get('flash')->addMessage('error', Translations::translate('Your registration is not confirmed yet. Please check your e-mails and use the confirmation link.')); + if($this->c->get('flash')) + { + $this->c->get('flash')->addMessage('error', Translations::translate('Your registration is not confirmed yet. Please check your e-mails and use the confirmation link.')); + } return $response->withHeader('Location', $this->routeParser->urlFor('auth.show'))->withStatus(302); } @@ -185,7 +200,10 @@ class ControllerWebAuth extends Controller \Typemill\Static\Helpers::addLogEntry('login: invalid verification code format'); } - $this->c->get('flash')->addMessage('error', Translations::translate('Invalid verification code format, please try again.')); + if($this->c->get('flash')) + { + $this->c->get('flash')->addMessage('error', Translations::translate('Invalid verification code format, please try again.')); + } return $response->withHeader('Location', $this->routeParser->urlFor('auth.show'))->withStatus(302); } @@ -199,7 +217,10 @@ class ControllerWebAuth extends Controller \Typemill\Static\Helpers::addLogEntry('login: user not found'); } - $this->c->get('flash')->addMessage('error', Translations::translate('Wrong password or username, please try again.')); + if($this->c->get('flash')) + { + $this->c->get('flash')->addMessage('error', Translations::translate('Wrong password or username, please try again.')); + } return $response->withHeader('Location', $this->routeParser->urlFor('auth.show'))->withStatus(302); } @@ -215,7 +236,10 @@ class ControllerWebAuth extends Controller \Typemill\Static\Helpers::addLogEntry('login: verification code wrong or outdated.'); } - $this->c->get('flash')->addMessage('error', Translations::translate('The verification was wrong or outdated, please start again.')); + if($this->c->get('flash')) + { + $this->c->get('flash')->addMessage('error', Translations::translate('The verification was wrong or outdated, please start again.')); + } return $response->withHeader('Location', $this->routeParser->urlFor('auth.show'))->withStatus(302); } diff --git a/system/typemill/Middleware/FlashMessages.php b/system/typemill/Middleware/FlashMessages.php index 9bcb7bc..65eb88e 100644 --- a/system/typemill/Middleware/FlashMessages.php +++ b/system/typemill/Middleware/FlashMessages.php @@ -8,7 +8,7 @@ use Slim\Flash\Messages; class FlashMessages { - private $container; + public $container; public function __construct($container) { diff --git a/system/typemill/Models/SimpleMail.php b/system/typemill/Models/SimpleMail.php index ed2b092..ae96a58 100644 --- a/system/typemill/Models/SimpleMail.php +++ b/system/typemill/Models/SimpleMail.php @@ -44,7 +44,7 @@ class SimpleMail $headers = 'Content-Type: text/html; charset=utf-8' . "\r\n"; $headers .= 'Content-Transfer-Encoding: base64' . "\r\n"; $headers .= 'From: ' . $this->from . "\r\n"; - if($this->$reply) + if($this->reply) { $headers .= 'Reply-To: base64' . $this->reply . "\r\n"; } diff --git a/system/typemill/Static/License.php b/system/typemill/Static/License.php index 7676ce6..0a9f050 100644 --- a/system/typemill/Static/License.php +++ b/system/typemill/Static/License.php @@ -43,9 +43,7 @@ class License } elseif($licenseStatus === true) { - echo '
';
-			print_r($licensedata);
-			die();
+			die('Static License licenceStatus is true');
 		}
 		else
 		{
diff --git a/system/typemill/system.php b/system/typemill/system.php
index 8b07114..aa06a0c 100644
--- a/system/typemill/system.php
+++ b/system/typemill/system.php
@@ -1,4 +1,3 @@
-
 add(new SecurityMiddleware($routeParser, $container->get('settings')));
 
 $app->add(new OldInputMiddleware($container->get('view')));
 
-$app->add(new FlashMessages($container));
-
 # Add Twig-View Middleware
 $app->add(TwigMiddleware::createFromContainer($app));
 
+$app->add(new FlashMessages($container));
+
 # add JsonBodyParser Middleware
 $app->add(new JsonBodyParser());