- Added a new Email defintion (which will soon see it's components changed)

- Added a new post-install script for composer which adds a project skeleton "ready to use".
- Error 500 are now handled properly in production; waiting to see if adjustements will be required before adding other code pages.
This commit is contained in:
mcndave committed 2021-03-01 16:01:27 +00:00
1 parent 09b3e47c19
commit 01bb926ca7
30 files changed
+887 -2

No files matched your search

+52
View File
@@ -0,0 +1,52 @@
<?php
use function DI\autowire, DI\create, DI\get;
use %NAMESPACE%\Entity;
use Ulmus\Entity\Field\Datetime,
Ulmus\User\Lib\Authenticate;
use Storage\{ Session, Cookie };
use Laminas\Diactoros\Response\{ RedirectResponse, HtmlResponse };
use Notes\Security\SecurityHandler;
use Picea\Picea;
use TheBugs\Email\{ EmailConfiguration, MailerInterface, SwiftMailer };
return [
Entity\User::class => autowire(Entity\User::class),
Authenticate::class => create(Authenticate::class)->constructor(get(Session::class), get(Cookie::class), get('authentication.method')),
SecurityHandler::class => create(SecurityHandler::class)->constructor(function() {
return new RedirectResponse(getenv("URL_BASE")."/connexion");
}),
'authentication.error' => function($c, Picea $picea) {
return function($message) use ($picea) {
return new HtmlResponse($picea->renderHtml('lean/error/500', [
'title' => "",
'subtitle' => "",
'message' => $message,
]));
};
},
EmailConfiguration::class => function($c) {
$email = new EmailConfiguration( EmailConfiguration::AUTH_TYPE_SMTP );
$email->smtpHost = getenv('SMTP_HOST');
$email->smtpPort = getenv('SMTP_PORT');
$email->smtpUsername = getenv('SMTP_USERNAME');
$email->smtpPassword = getenv('SMTP_PASSWORD');
$email->smtpUseTLS = getenv('SMTP_TLS');
$email->toAddress = getenv("TO_EMAIL");
$email->fromAddress = getenv("FROM_EMAIL");
$email->fromName = getenv("FROM_NAME");
return $email;
},
];