diff --git a/app/App.php b/app/App.php
index 8f4dede..4f376b3 100644
--- a/app/App.php
+++ b/app/App.php
@@ -117,6 +117,7 @@ class App extends Application
public function registerExtenders()
{
if (!$this['debug']) {
+ $this->log('In Error handler.');
$this->error(function (\Exception $e, \Symfony\Component\HttpFoundation\Request $request, $code) {
switch ($code) {
case 405:
@@ -129,10 +130,13 @@ class App extends Application
$matches = 'Available methods are unknown.';
}
$message = json_encode(['status' => 'error', 'message' => 'Method not allowed', 'allowedMethods' => $matches, 'requestedMethod' => $request->getMethod(), 'code' => $code]);
- //$message = 'Sorry bout that.
' . $e->getMessage();
+ break;
+ case 500:
+ $message = json_encode(['status' => 'error', 'message' => $e->getMessage(), 'code' => $code]);
break;
default:
$message = json_encode(['status' => 'error', 'message' => $e->getMessage(), 'code' => $code]);
+ break;
}
return new \Symfony\Component\HttpFoundation\Response($message, $code);
});
diff --git a/app/config/config.yml b/app/config/config.yml
index fc41bc1..0b6d523 100644
--- a/app/config/config.yml
+++ b/app/config/config.yml
@@ -10,3 +10,7 @@ app:
captcha_sitekey: 6LcvmSQTAAAAAMmf9w6mhCbpdLvknuD9SGVHT0q-
captcha_secret: 6LcvmSQTAAAAAITkvYJjgLar1LqGGLz-ic0ZMiXo
theme: default
+ smtp_host: smtp.gmail.com
+ smtp_port: 465
+ smtp_user: eric@rewiv.com
+ smtp_password: 'P*8ic32!100023&p'
diff --git a/app/config/config.yml.dist b/app/config/config.yml.dist
index 648a3c3..25f75b5 100644
--- a/app/config/config.yml.dist
+++ b/app/config/config.yml.dist
@@ -9,7 +9,8 @@ app:
captcha_sitekey: 6LcvmSQTAAAAAMmf9w6mhCbpdLvknuD9SGVHT0q-
captcha_secret: 6LcvmSQTAAAAAITkvYJjgLar1LqGGLz-ic0ZMiXo
theme: default
- #twig_paths:
- # - views
- #twig_template: uikit.html.twig
+ smtp_host: localhost
+ smtp_port: 465
+ smtp_user: root
+ smtp_password: 123
diff --git a/app/providers.php b/app/providers.php
index 61314dc..c7c8a76 100644
--- a/app/providers.php
+++ b/app/providers.php
@@ -29,6 +29,8 @@ use Silex\Provider\{
VarDumperServiceProvider,
WebProfilerServiceProvider
};
+use Symfony\Component\Debug\ErrorHandler;
+use Symfony\Component\Debug\ExceptionHandler;
use Symfony\Bridge\Monolog\Logger;
use WhoopsPimple\WhoopsServiceProvider;
@@ -36,6 +38,9 @@ $app->register(new ConfigServiceProvider(), [
'config.path' => $app->getConfDirectory() . '/config.yml',
]);
+ErrorHandler::register();
+ExceptionHandler::register(false);
+
$app->setDebug();
@@ -60,21 +65,32 @@ $app
'monolog.level' => $app->getDebug() ? Logger::DEBUG : Logger::INFO,
'monolog.handler' => new \Monolog\Handler\StreamHandler('php://stderr'),
])
- ->register(new \Silex\Provider\SwiftmailerServiceProvider());
+ ->register(new \Silex\Provider\SwiftmailerServiceProvider())
+ ->register(new ConsoleServiceProvider(), [
+ 'console.name' => 'Resume.PHP',
+ 'console.version' => '0.0.1',
+ 'console.project_directory' => $app->getAppDirectory(),
+ ]);
- if(false === getenv('SPARKPOST_API_KEY')) {
- $app['swiftmailer.transport'] = new Swift_SendmailTransport();
- $app->log('We are local');
- } else {
+ if(false === getenv('SPARKPOST_API_KEY') && null !== $app->config('app.smtp_host')) {
+ $app['swiftmailer.options'] = [
+ 'host' => $app->config('app.smtp_host'),
+ 'port' => $app->config('app.smtp_post'),
+ 'username' => $app->config('app.smtp_user'),
+ 'password' => $app->config('app.smtp_password'),
+ ];
+ $app->log('Setting up local email.');
+ } elseif (false !== getenv('SPARKPOST_API_KEY')) {
$app['swiftmailer.options'] = [
'host' => getenv('SPARKPOST_SMTP_HOST'),
'port' => getenv('SPARKPOST_SMTP_PORT'),
'username' => getenv('SPARKPOST_SMTP_USERNAME'),
'password' => getenv('SPARKPOST_SMTP_PASSWORD'),
'encryption' => 'tls',
- 'auth_mode' => 'plain',
];
- $app->log('We are on heroku.');
+ $app->log('Setting up sparkpost email.');
+ } else {
+ $app['swiftmailer.transport'] = new Swift_SendmailTransport();
}
$app->register(new RoutingServiceProvider())
@@ -86,12 +102,7 @@ if ($app['debug'] || 0 === strcasecmp($app['env'], 'dev')) {
'profiler.cache_dir' => $app->getDataDirectory() . '/cache/profiler',
])
->register(new WhoopsServiceProvider())
- ->register(new VarDumperServiceProvider())
- ->register(new ConsoleServiceProvider(), [
- 'console.name' => 'Resume.PHP',
- 'console.version' => '0.0.1',
- 'console.project_directory' => $app->getAppDirectory(),
- ]);
+ ->register(new VarDumperServiceProvider());
}
if (null === $app->config('app.schema')) {
$app->config('app.schema', 'https://raw.githubusercontent.com/jsonresume/resume-schema/v1.0.0/schema.json');
diff --git a/app/themes/default/base.html.twig b/app/themes/default/base.html.twig
index 295ff0a..f5c3359 100644
--- a/app/themes/default/base.html.twig
+++ b/app/themes/default/base.html.twig
@@ -19,6 +19,7 @@
+
{% block javascripts_head %}{% endblock %}
{% block inline_js_head %}{% endblock %}
diff --git a/app/themes/default/index.html.twig b/app/themes/default/index.html.twig
index 84201f1..3ce5102 100644
--- a/app/themes/default/index.html.twig
+++ b/app/themes/default/index.html.twig
@@ -257,6 +257,13 @@
+
Sending message ... + +
+