diff --git a/app/Resources/views/form/contact.html.twig b/app/Resources/views/form/contact.html.twig
new file mode 100644
index 0000000..d9eb72c
--- /dev/null
+++ b/app/Resources/views/form/contact.html.twig
@@ -0,0 +1,59 @@
+{% extends 'base.html.twig' %}
+{% block title %}Get in touch{% endblock title %}
+{% block body %}
+
+ We'd LOVE to hear from you! Send us your wishes, thoughts, advice or questions.
+
+ {% if(form is defined) %}
+ {{ form_errors(form) }}
+ {{ form_start(form) }}
+ {{ form_label(form.name) }}
+
+ {{ form_errors(form.name) }}
+ {{ form_widget(form.name) }}
+
+ {{ form_errors(form.email) }}
+ {{ form_widget(form.email) }}
+
+ {{ form_errors(form.subject) }}
+ {{ form_widget(form.subject) }}
+
+ {{ form_errors(form.comment) }}
+ {{ form_widget(form.comment) }}
+
+ {{ form_rest(form) }}
+ {{ form_end(form) }}
+ {% else %}
+
+{% endblock %}
\ No newline at end of file
diff --git a/app/Resources/views/location.html.twig b/app/Resources/views/location.html.twig
new file mode 100644
index 0000000..ec5ddc7
--- /dev/null
+++ b/app/Resources/views/location.html.twig
@@ -0,0 +1,72 @@
+{% extends 'base.html.twig' %}
+
+{% block title %}Location{% endblock title %}
+{% block stylesheets %}
+
+
+
+
+
+{% endblock %}
+{% block javascripts %}
+
+
+{% include 'map.html.twig' %}
+{% endblock %}
+{% block body %}
+
+
+{% endblock %}
\ No newline at end of file
diff --git a/app/Resources/views/map.html.twig b/app/Resources/views/map.html.twig
new file mode 100644
index 0000000..eae63b0
--- /dev/null
+++ b/app/Resources/views/map.html.twig
@@ -0,0 +1,168 @@
+
\ No newline at end of file
diff --git a/app/Resources/views/off_canvas.html.twig b/app/Resources/views/off_canvas.html.twig
index e69de29..d490e44 100644
--- a/app/Resources/views/off_canvas.html.twig
+++ b/app/Resources/views/off_canvas.html.twig
@@ -0,0 +1,44 @@
+
\ No newline at end of file
diff --git a/app/Resources/views/our_story.html.twig b/app/Resources/views/our_story.html.twig
index 9d18901..803aa71 100644
--- a/app/Resources/views/our_story.html.twig
+++ b/app/Resources/views/our_story.html.twig
@@ -1,21 +1,25 @@
{% extends 'base.html.twig' %}
+{% block title %}Our Story{% endblock title %}
{% block body %}
-
-
Eric and Katrina first met online in 2014. After texting back and forth for a week they finally met in
+
Our Story
+
+
+
Eric and Katrina first met online in 2014. After texting back and forth for a week they finally met in
persion at a little coffee shop in Oakland on July 23, 2014. Eric was shy and Katrina was nervous, but somehow they found enough
to talk about to agree to a second date where they continued to bond over coffee, cigarettes, and zombie movies.
Ollie (Katrina's dog) loved Eric instantly, and Buddy and Mayu (Eric's cats) never murdered Katrina in her sleep, so they tolerated her.
-
This was a good sign.
+
This was a good sign.
+
In August 2016 they packed everything into a couple of crates and moved up north to Portland, Oregon. After six months of the both of them working from home,
they realized that they were still madly in love (despite seeing each other all day, every day.) So on February 6, 2017 Eric proposed to Katrina.
-
+
+
On May 12, 2017 they will both say "yes" and live happily ever after til death do they part.
{% endblock %}
\ No newline at end of file
diff --git a/app/Resources/views/user_registered.txt.twig.html.twig b/app/Resources/views/user_registered.txt.twig.html.twig
new file mode 100644
index 0000000..4f15832
--- /dev/null
+++ b/app/Resources/views/user_registered.txt.twig.html.twig
@@ -0,0 +1,22 @@
+
+{% block body_text %}
+{% autoescape false %}
+Heyo!,
+
+{{ user.name }} has registered a new account.
+
+Info,
+
+Email : {{ user.email }}
+Guests: {{ user.rsvp.guests }}
+{% if user.comment is not null %}
+Comment :
+ {{ user.comment }}
+{% endif %}
+
+Love,
+Your website ❤
+
+{% endautoescape %}
+{% endblock %}
+{% block body_html %}{% endblock %}
diff --git a/app/config/config.yml b/app/config/config.yml
index e671d27..5e2b5f7 100644
--- a/app/config/config.yml
+++ b/app/config/config.yml
@@ -11,6 +11,8 @@ parameters:
google.credentials_file: '%kernel.root_dir%/config/google-storage-key.json'
google.client_id: '100826355104373784827'
google.application_name: 'doughnut-wedding'
+ katrina.email: katrina.a.johnson@gmail.com
+ eric.email: sikofitt@gmail.com
framework:
cache:
app: cache.adapter.redis
@@ -119,6 +121,8 @@ swiftmailer:
transport: '%mailer_transport%'
host: '%mailer_host%'
port: '%mailer_port%'
+ encryption: ssl
+ auth_mode: login
username: '%mailer_user%'
password: '%mailer_password%'
spool: { type: memory }
@@ -146,7 +150,7 @@ hwi_oauth:
client_secret: '84d6f402c53386ae0f196062945f217dcc56e7b7122cffb76c95b6a5775d22e0'
instagram:
type: instagram
- client_id: ' 70e7edd280834c429d49f985ff308230'
+ client_id: '70e7edd280834c429d49f985ff308230'
client_secret: '9c405020a3ef412086032a4514909705'
twitter:
type: twitter
@@ -223,4 +227,4 @@ vich_uploader:
upload_destination: cloud
uri_prefix: /
sikofitt_doughnut_wedding:
- max_rsvps: ~
\ No newline at end of file
+ max_rsvps: ~
diff --git a/app/config/config_dev.yml b/app/config/config_dev.yml
index 7f0c1a2..c126e55 100644
--- a/app/config/config_dev.yml
+++ b/app/config/config_dev.yml
@@ -37,7 +37,8 @@ monolog:
# type: chromephp
# level: info
-#swiftmailer:
+swiftmailer:
+ transport: null
# disable_delivery: true
# transport: smtp
# delivery_addresses: ['info@doughnutwedding.com']
diff --git a/app/config/easy_admin.yml b/app/config/easy_admin.yml
index f2b5cd0..ef40bac 100644
--- a/app/config/easy_admin.yml
+++ b/app/config/easy_admin.yml
@@ -2,6 +2,11 @@ easy_admin:
design:
form_theme: 'vertical'
entities:
+ Contact:
+ class: Sikofitt\DoughnutWeddingBundle\Entity\Contact
+ list:
+ actions: ['show','edit','delete']
+ fields: ['userid','email','name','comment','createdAt']
User:
class: Sikofitt\DoughnutWeddingBundle\Entity\User
list:
diff --git a/app/config/security.yml b/app/config/security.yml
index 0feca8d..27aea2c 100644
--- a/app/config/security.yml
+++ b/app/config/security.yml
@@ -19,6 +19,8 @@ security:
pattern: ^/(_(profiler|wdt)|css|images|js)/
security: false
secured_area:
+ access_denied_handler: doughnutwedding.security.access_denied_handler
+
pattern: ^/
form_login:
provider: fos_userbundle
@@ -44,7 +46,7 @@ security:
access_control:
- { path: ^/login$, role: IS_AUTHENTICATED_ANONYMOUSLY }
- - { path: ^/login/callback$, role: IS_AUTHENTICATED_ANONYMOUSLY }
+ - { path: ^/login/callback, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/logout$, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/login_check$, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/register, role: IS_AUTHENTICATED_ANONYMOUSLY }
@@ -52,5 +54,5 @@ security:
- { path: ^/user, role: ROLE_USER }
- { path: ^/gallery/upload, role: ROLE_USER }
- { path: ^/gallery, role: IS_AUTHENTICATED_ANONYMOUSLY }
- - { path: ^/admin$, role: ROLE_ADMIN }
+ - { path: ^/admin, role: ROLE_ADMIN }
- { path: ^/.*, role: IS_AUTHENTICATED_ANONYMOUSLY }
diff --git a/app/config/services.yml b/app/config/services.yml
index 76719f5..674ff13 100644
--- a/app/config/services.yml
+++ b/app/config/services.yml
@@ -25,7 +25,7 @@ services:
- { name: kernel.event_listener, event: kernel.request }
doughnutwedding.event.redirect_user_after_register_event:
class: Sikofitt\DoughnutWeddingBundle\EventListener\RedirectOnUserRegisterListener
- arguments: ['@router']
+ arguments: ['@service_container']
tags:
- { name: kernel.event_listener, event: fos_user.registration.confirmed }
- { name: kernel.event_listener, event: fos_user.registration.completed }
@@ -34,3 +34,15 @@ services:
factory: ['Sikofitt\DoughnutWeddingBundle\Factory\GoogleCloudStorageServiceFactory', createGoogleCloudService]
arguments: ['%google.credentials_file%', '%google.client_id%', '%google.application_name%']
+ doughnutwedding.event.check_email_on_reset_event:
+ class: Sikofitt\DoughnutWeddingBundle\EventListener\CheckThatEmailAndUserNameExistOnResetRequest
+ arguments: ['@router', '@templating.engine.twig']
+ tags:
+ - { name: kernel.event_listener, event: fos_user.resetting.send_email.initialize }
+ doughnutwedding.event.need_to_authenticate_listener_event:
+ class: Sikofitt\DoughnutWeddingBundle\EventListener\NeedToAuthenticateListenerEvent
+ tags:
+ - { name: kernel.event_listener, event: kernel.response }
+ doughnutwedding.security.access_denied_handler:
+ class: Sikofitt\DoughnutWeddingBundle\Security\AccessDeniedHandler
+ arguments: ['@router', '@monolog.logger']
\ No newline at end of file
diff --git a/build/images/favicon.png b/build/images/favicon.png
new file mode 100644
index 0000000..6c3e637
--- /dev/null
+++ b/build/images/favicon.png
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:7226428a1b7a936b5bebfa5234fdeaf23cc6ba4c2c95c30bb882431d93c50b58
+size 19799
diff --git a/build/images/home_photo.jpg b/build/images/home_photo.jpg
deleted file mode 100644
index 7cf677a..0000000
--- a/build/images/home_photo.jpg
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:772a9388ccc9a749836cf6e15b4bf32f20cd008649f98e4f1961d6ab89f38805
-size 274984
diff --git a/build/images/home_photo_1.jpg b/build/images/home_photo_1.jpg
new file mode 100644
index 0000000..ef9556f
--- /dev/null
+++ b/build/images/home_photo_1.jpg
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:b439362aa5029f855ee1f72ff94552d8246ad46c303e04796465687656a7a86d
+size 139466
diff --git a/build/images/home_photo_2.jpg b/build/images/home_photo_2.jpg
new file mode 100644
index 0000000..989ec5b
--- /dev/null
+++ b/build/images/home_photo_2.jpg
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:482cb918c7bc3ea0998759a60abc237cd350651ddf5a09707fe52df2dae1afeb
+size 129353
diff --git a/build/images/location.jpg b/build/images/location.jpg
new file mode 100644
index 0000000..4148927
--- /dev/null
+++ b/build/images/location.jpg
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:e7ad0693c08599150ecae7ff1dabccb18792c1d10cc96a95129938b08a3cf4d6
+size 271299
diff --git a/build/less/doughnut.less b/build/less/doughnut.less
index 9a4b940..55bbbac 100644
--- a/build/less/doughnut.less
+++ b/build/less/doughnut.less
@@ -3,11 +3,42 @@
//@global-font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
//@global-font-size: 16px;
+@global-font-family: 'Raleway', sans-serif;
+
@base-body-font-family: 'Raleway', sans-serif;
@base-heading-font-family: 'Raleway', sans-serif;
+@base-heading-text-transform: uppercase;
@base-body-font-weight: 200;
@base-heading-font-weight: 300;
@form-background: #ffffff;
+@global-link-color: #90d5c1;
+@base-link-color: @global-link-color;
+@base-link-hover-color: darken(@base-link-color, 20%);
+@button-primary-background: #90d5c1;
+@button-primary-color: #333;
+@button-primary-hover-color: darken(@button-primary-color, 10%);
+@button-primary-hover-background: darken(@button-primary-background, 10%);
+.uk-login-container {
+
+ .uk-navbar {
+ .uk-navbar-nav {
+ li {
+ a {
+ font-weight:bold !important;
+ }
+ }
+ }
+ }
+}
+label.required:after {
+ content: "*";
+ text-align:right;
+ float:right;
+ color: @form-danger-color;
+ font-size: @global-large-font-size;
+ font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
+ font-weight: bol
+}
.uk-home {
@@ -26,8 +57,8 @@
}
.uk-background-fade {
transition-duration: .3s;
- transition-timing-function: ease-out;
- transition-property: background-image,transform,filter;
+ transition-timing-function: ease-in-out;
+ transition-property: background-image;
}
.uk-our-story-home {
@@ -40,15 +71,20 @@
// photo
// location
.uk-photo-home {
- background-image: url('/images/home_photo.jpg');
+ background-image: url('/images/home_photo_2.jpg');
&:hover {
-
+ background-image: url('/images/home_photo_1.jpg');
}
}
.uk-location-home {
margin-bottom:15px !important;
background-image: url('/images/home_location.jpg');
+ transition-duration: .3s;
+ transition-timing-function: ease-out;
+ transition-property: filter;
&:hover {
+ filter: hue-rotate(90deg);
+ background-blend-mode: darken;
}
}
diff --git a/composer.json b/composer.json
index c34aa4c..89a63d2 100644
--- a/composer.json
+++ b/composer.json
@@ -18,6 +18,7 @@
"doctrine/doctrine-cache-bundle": "^1.3",
"doctrine/orm": "^2.5",
"egulias/email-validator": "^2.1",
+ "excelwebzone/recaptcha-bundle": "^1.4",
"friendsofsymfony/user-bundle": "^2.0",
"google/apiclient": "^2.1",
"google/recaptcha": "^1.1",
diff --git a/src/Sikofitt/DoughnutWeddingBundle/Controller/DefaultController.php b/src/Sikofitt/DoughnutWeddingBundle/Controller/DefaultController.php
index d3a1cf5..8cd1934 100644
--- a/src/Sikofitt/DoughnutWeddingBundle/Controller/DefaultController.php
+++ b/src/Sikofitt/DoughnutWeddingBundle/Controller/DefaultController.php
@@ -21,6 +21,8 @@
namespace Sikofitt\DoughnutWeddingBundle\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
+use Sikofitt\DoughnutWeddingBundle\Entity\Contact;
+use Sikofitt\DoughnutWeddingBundle\Form\ContactFormType;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
@@ -56,4 +58,77 @@ class DefaultController extends Controller
public function ourStoryAction(Request $request) {
return $this->render('our_story.html.twig');
}
+
+ /**
+ * @Route("/location")
+ *
+ * @param Request $request
+ *
+ * @return Response
+ */
+ public function locationAction(Request $request) {
+ return $this->render('location.html.twig');
+ }
+
+ /**
+ * @Route("/get_in_touch")
+ * @param \Symfony\Component\HttpFoundation\Request $request
+ *
+ * @return \Symfony\Component\HttpFoundation\Response
+ */
+ public function contactAction(Request $request) : Response {
+ $contact = new Contact();
+ if(null !== $this->getUser()) {
+ $contact
+ ->setName($this->getUser()->getName())
+ ->setEmail($this->getUser()->getEmail())
+ ->setUserId($this->getUser()->getId())
+ ;
+ }
+
+ $form = $this->get('form.factory')->create(ContactFormType::class, $contact);
+
+
+ if($request->isMethod('POST')) {
+ $form->handleRequest($request);
+ if($form->isValid() && $form->isSubmitted()) {
+ $em = $this->get('doctrine.orm.entity_manager');
+ /** @var Contact $data */
+
+ $data = $form->getData();
+
+ $data->setCreatedAt(new \DateTime('now'));
+
+ $em->persist($data);
+ $em->flush();
+
+ $responseMessage[] = 'Thank you for your message ' . $data->getName() . '!';
+
+ $email = $data->getEmail();
+
+ if( null !== $email ) {
+ $responseMessage[] = sprintf('We will respond to you at %s as soon as possible.', $email);
+ } else {
+ $email = 'no-reply@doughnutwedding.com';
+ }
+
+ $message = new \Swift_Message();
+ $message->setSubject($data->getSubject());
+ $message->setFrom($email);
+ $message->setTo([
+ $this->getParameter('katrina.email') => 'Katrina Johnson',
+ $this->getParameter('eric.email') => 'R. Eric Wheeler',
+ ]);
+ $message->setBody($data->getComment());
+
+ $this->get('swiftmailer.mailer')->send($message);
+
+ return $this->render('form/contact.html.twig',
+ ['message' => $responseMessage]);
+ }
+ }
+
+ return $this->render('form/contact.html.twig', ['form' => $form->createView()]);
+
+ }
}
diff --git a/src/Sikofitt/DoughnutWeddingBundle/Controller/GalleryController.php b/src/Sikofitt/DoughnutWeddingBundle/Controller/GalleryController.php
index 7ca8216..1063df8 100644
--- a/src/Sikofitt/DoughnutWeddingBundle/Controller/GalleryController.php
+++ b/src/Sikofitt/DoughnutWeddingBundle/Controller/GalleryController.php
@@ -47,7 +47,9 @@ class GalleryController extends Controller
*/
public function uploadAction()
{
-
+ if(false === $this->isGranted('IS_AUTHENTICATED_FULLY')) {
+ $this->addFlash('error', 'You must be logged in to upload photos.');
+ }
$form = $this->get('form.factory')->create(GalleryUploadType::class, new Image());
return $this->render('SikofittDoughnutWeddingBundle:Image:upload.html.twig', [
'form' => $form->createView()
diff --git a/src/Sikofitt/DoughnutWeddingBundle/Entity/Contact.php b/src/Sikofitt/DoughnutWeddingBundle/Entity/Contact.php
new file mode 100644
index 0000000..c6dd288
--- /dev/null
+++ b/src/Sikofitt/DoughnutWeddingBundle/Entity/Contact.php
@@ -0,0 +1,220 @@
+id;
+ }
+
+ /**
+ * Set name
+ *
+ * @param int $userId
+ *
+ * @return Contact
+ */
+ public function setUserId($userId)
+ {
+ $this->userId = $userId;
+
+ return $this;
+ }
+
+ /**
+ * Get name
+ *
+ * @return string
+ */
+ public function getUserId()
+ {
+ return $this->userId;
+ }
+
+ /**
+ * Set name
+ *
+ * @param string $name
+ *
+ * @return Contact
+ */
+ public function setName($name)
+ {
+ $this->name = $name;
+
+ return $this;
+ }
+
+ /**
+ * Get name
+ *
+ * @return string
+ */
+ public function getName()
+ {
+ return $this->name;
+ }
+
+ /**
+ * Set Email
+ *
+ * @param null|string $email
+ *
+ * @return \Sikofitt\DoughnutWeddingBundle\Entity\Contact
+ */
+ public function setEmail(?string $email) : Contact {
+ $this->email = $email;
+
+ return $this;
+ }
+
+ /**
+ * Get Email
+ *
+ * @return null|string
+ */
+ public function getEmail() : ?string {
+ return $this->email;
+ }
+
+ /**
+ * Set subject
+ *
+ * @param string $subject
+ *
+ * @return Contact
+ */
+ public function setSubject($subject)
+ {
+ $this->subject = $subject;
+
+ return $this;
+ }
+
+ /**
+ * Get subject
+ *
+ * @return string
+ */
+ public function getSubject()
+ {
+ return $this->subject;
+ }
+
+ /**
+ * Set comment
+ *
+ * @param string $comment
+ *
+ * @return Contact
+ */
+ public function setComment($comment)
+ {
+ $this->comment = $comment;
+
+ return $this;
+ }
+
+ /**
+ * Get comment
+ *
+ * @return string
+ */
+ public function getComment()
+ {
+ return $this->comment;
+ }
+
+
+ /**
+ * Set createdAt
+ *
+ * @param \DateTime $createdAt
+ *
+ * @return Contact
+ */
+ public function setCreatedAt($createdAt)
+ {
+ $this->createdAt = $createdAt;
+
+ return $this;
+ }
+
+ /**
+ * Get createdAt
+ *
+ * @return \DateTime
+ */
+ public function getCreatedAt()
+ {
+ return $this->createdAt;
+ }
+}
diff --git a/src/Sikofitt/DoughnutWeddingBundle/EventListener/CheckThatEmailAndUserNameExistOnResetRequest.php b/src/Sikofitt/DoughnutWeddingBundle/EventListener/CheckThatEmailAndUserNameExistOnResetRequest.php
new file mode 100644
index 0000000..127d1fa
--- /dev/null
+++ b/src/Sikofitt/DoughnutWeddingBundle/EventListener/CheckThatEmailAndUserNameExistOnResetRequest.php
@@ -0,0 +1,43 @@
+router = $router;
+ $this->twig = $twig;
+ }
+
+ public function onFosuserResettingSendemailInitialize(GetResponseUserEvent $event) {
+
+ if(null === $event->getUser()) {
+ $email = $event->getRequest()->request->get('username');
+ $event->getRequest()->getSession()->getFlashBag()->add('error',sprintf('Invalid email %s.', $email));
+ $event->setResponse(new RedirectResponse($this->router->generate('fos_user_resetting_request')));
+ }
+ }
+
+
+}
\ No newline at end of file
diff --git a/src/Sikofitt/DoughnutWeddingBundle/EventListener/NeedToAuthenticateListenerEvent.php b/src/Sikofitt/DoughnutWeddingBundle/EventListener/NeedToAuthenticateListenerEvent.php
new file mode 100644
index 0000000..dc2f472
--- /dev/null
+++ b/src/Sikofitt/DoughnutWeddingBundle/EventListener/NeedToAuthenticateListenerEvent.php
@@ -0,0 +1,49 @@
+getResponse()
+ ->headers
+ ->has('location') &&
+ false !== strpos($event->getResponse()->headers->get('location'),
+ '/login') &&
+ true === $event
+ ->getRequest()
+ ->getSession()
+ ->has('_security.secured_area.target_path')
+ ) {
+ $targetPath = $event
+ ->getRequest()
+ ->getSession()
+ ->get('_security.secured_area.target_path');
+ $message = sprintf('You need to login to view %s', $targetPath);
+ $event
+ ->getRequest()
+ ->getSession()
+ ->getFlashBag()
+ ->add('warning', $message);
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/src/Sikofitt/DoughnutWeddingBundle/EventListener/RedirectOnUserRegisterListener.php b/src/Sikofitt/DoughnutWeddingBundle/EventListener/RedirectOnUserRegisterListener.php
index b15dd5c..0daeeae 100644
--- a/src/Sikofitt/DoughnutWeddingBundle/EventListener/RedirectOnUserRegisterListener.php
+++ b/src/Sikofitt/DoughnutWeddingBundle/EventListener/RedirectOnUserRegisterListener.php
@@ -9,18 +9,39 @@
namespace Sikofitt\DoughnutWeddingBundle\EventListener;
+use FOS\UserBundle\Event\FilterUserResponseEvent;
use FOS\UserBundle\Event\FormEvent;
use FOS\UserBundle\FOSUserEvents;
+use Symfony\Bridge\Twig\TwigEngine;
+use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
class RedirectOnUserRegisterListener
{
- private $router;
- public function __construct(UrlGeneratorInterface $router)
+ private $container;
+
+ public function __construct(ContainerInterface $container)
{
- $this->router = $router;
+ $this->container = $container;
+ }
+
+ public function onFosuserRegistrationCompleted(FilterUserResponseEvent $event) {
+
+ $user = $event->getUser();
+ $message = new \Swift_Message('[Doughnut Wedding] User registered');
+ $body = $this->container->get('twig')->render('user_registered.txt.twig.html.twig', ['user' => $user]);
+
+ $message
+ ->setFrom(['no-reply@doughnutwedding.com' => '[Doughnut Wedding]'])
+ ->setTo([
+ 'katrina.a.johnson@gmail.com' => 'Katrina Johnson',
+ 'sikofitt@gmail.com' => 'R. Eric Wheeler'
+ ])->setBody($body);
+ $this->container->get('swiftmailer.mailer')->send($message);
+ $url = $this->container->get('router')->generate('sikofitt_doughnutwedding_default_index');
+ return new RedirectResponse($url);
}
public function onKernelRequest(FormEvent $event)
diff --git a/src/Sikofitt/DoughnutWeddingBundle/EventListener/UserRedirectOnLoggedInListener.php b/src/Sikofitt/DoughnutWeddingBundle/EventListener/UserRedirectOnLoggedInListener.php
index 13b5588..896c859 100644
--- a/src/Sikofitt/DoughnutWeddingBundle/EventListener/UserRedirectOnLoggedInListener.php
+++ b/src/Sikofitt/DoughnutWeddingBundle/EventListener/UserRedirectOnLoggedInListener.php
@@ -108,7 +108,8 @@ class UserRedirectOnLoggedInListener
'fos_user_security_login',
'fos_user_registration_confirmed',
'hwi_oauth_connect',
- 'fos_user_resetting_request'
+ 'fos_user_resetting_request',
+ 'fos_user_registration_register'
];
}
}
diff --git a/src/Sikofitt/DoughnutWeddingBundle/Form/ContactFormType.php b/src/Sikofitt/DoughnutWeddingBundle/Form/ContactFormType.php
new file mode 100644
index 0000000..713f27d
--- /dev/null
+++ b/src/Sikofitt/DoughnutWeddingBundle/Form/ContactFormType.php
@@ -0,0 +1,128 @@
+add('name', TextType::class, [
+ 'label_attr' => [
+ 'class' => 'uk-form-label uk-visible@m',
+ ],
+ 'label' => 'Name',
+ 'attr' => [
+ 'class' => 'uk-input uk-form-large uk-margin-small-bottom',
+ 'placeholder' => 'Enter your name',
+ ],
+ 'required' => true,
+ 'trim' => true,
+ 'constraints' => [
+ new NotBlank(),
+ new NotNull(),
+ new Length(['max' => 255, 'min' => 5])
+ ]
+ ])
+ ->add('email', EmailType::class, [
+ 'label_attr' => [
+ 'class' => 'uk-form-label uk-visible@m',
+ ],
+ 'label' => 'Email (Not required)',
+ 'attr' => [
+ 'class' => 'uk-input uk-form-large uk-margin-small-bottom',
+ 'placeholder' => 'Email address (not required)',
+ 'autocomplete' => 'off',
+ 'autocorrect' => 'off',
+ 'autocapitalize' => 'off',
+ 'spellcheck' => 'false',
+ ],
+ 'required' => false,
+ 'trim' => true,
+ 'constraints' => [
+ new Email([
+ 'checkMX' => true,
+ 'checkHost' => true,
+ 'strict' => true,
+ ])
+ ]
+ ])
+ ->add('subject', TextType::class, [
+ 'label_attr' => [
+ 'class' => 'uk-form-label uk-visible@m',
+ ],
+ 'label' => 'Subject',
+ 'attr' => [
+ 'class' => 'uk-input uk-form-large uk-margin-small-bottom',
+ 'placeholder' => 'Enter a subject for our comment.',
+ ],
+ 'required' => true,
+ 'trim' => true,
+ 'constraints' => [
+ new NotBlank(),
+ new NotNull(),
+ new Length(['max' => 255, 'min' => 5])
+ ]
+ ])
+ ->add('comment', TextareaType::class, [
+ 'label_attr' => [
+ 'class' => 'uk-form-label uk-visible@m',
+ ],
+ 'label' => 'Comment',
+ 'attr' => [
+ 'rows' => 4,
+ 'class' => 'uk-padding-small uk-textarea uk-form-large uk-margin-medium-bottom',
+ 'placeholder' => 'Enter your Comment',
+ ],
+ 'required' => true,
+ 'constraints' => [
+ new NotBlank(),
+ new NotNull(),
+ ]
+ ])
+ ->add('submit', SubmitType::class, [
+ 'label' => 'Send',
+ 'attr' => [
+ 'class' => 'uk-button uk-button-primary uk-button-large uk-width-1-1@s uk-width-1-3@m'
+ ]
+ ]);
+ }
+
+ /**
+ * @inheritdoc
+ *
+ * @throws \Symfony\Component\OptionsResolver\Exception\AccessException
+ */
+ public function configureOptions(OptionsResolver $resolver) : void {
+ $resolver->setDefault('data_class', Contact::class);
+ $resolver->setDefault('attr', ['class' => 'uk-form uk-form-horizontal']);
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function getBlockPrefix() : ?string {
+ return 'sikofitt_doughnut_wedding_contact';
+ }
+}
\ No newline at end of file
diff --git a/src/Sikofitt/DoughnutWeddingBundle/Form/RegistrationType.php b/src/Sikofitt/DoughnutWeddingBundle/Form/RegistrationType.php
index 9bcafd0..4984906 100644
--- a/src/Sikofitt/DoughnutWeddingBundle/Form/RegistrationType.php
+++ b/src/Sikofitt/DoughnutWeddingBundle/Form/RegistrationType.php
@@ -21,6 +21,7 @@
namespace Sikofitt\DoughnutWeddingBundle\Form;
use HWI\Bundle\OAuthBundle\OAuth\Response\PathUserResponse;
+use Symfony\Component\Form\Extension\Core\Type\NumberType;
use Symfony\Component\Form\Extension\Core\Type\TextareaType;
use Symfony\Component\Form\FormEvent;
use FOS\UserBundle\Form\Type\RegistrationFormType;
@@ -51,7 +52,9 @@ class RegistrationType extends AbstractType
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder->add('name', TextType::class)
- ->add('rsvp', IntegerType::class, [
+ ->add('rsvp', NumberType::class, [
+ 'required' => false,
+ 'empty_data' => '0',
'attr' => [
'class' => 'uk-input uk-form-large uk-padding-small uk-box-shadow-hover-small',
'placeholder' => 'Number of Guests (including yourself)',
@@ -68,7 +71,8 @@ class RegistrationType extends AbstractType
'class' => 'uk-form-label uk-visible@m',
],
'attr' => [
- 'class' => 'uk-textarea uk-form-large',
+ 'rows' => 5,
+ 'class' => 'uk-textarea uk-form-large uk-padding-small',
'placeholder' => 'Anything you would like to share with the Bride and Groom?'
]
])
diff --git a/src/Sikofitt/DoughnutWeddingBundle/Repository/ContactRepository.php b/src/Sikofitt/DoughnutWeddingBundle/Repository/ContactRepository.php
new file mode 100644
index 0000000..f5cd007
--- /dev/null
+++ b/src/Sikofitt/DoughnutWeddingBundle/Repository/ContactRepository.php
@@ -0,0 +1,13 @@
+Welcome to the Image:category page
+
Photos categorized as '{{ categoryName|capitalize }}'
{% endblock %}
diff --git a/src/Sikofitt/DoughnutWeddingBundle/Resources/views/Image/index.html.twig b/src/Sikofitt/DoughnutWeddingBundle/Resources/views/Image/index.html.twig
index 0da86df..99478e6 100644
--- a/src/Sikofitt/DoughnutWeddingBundle/Resources/views/Image/index.html.twig
+++ b/src/Sikofitt/DoughnutWeddingBundle/Resources/views/Image/index.html.twig
@@ -1,7 +1,8 @@
{% extends "::base.html.twig" %}
-{% block title %}SikofittDoughnutWeddingBundle:Image:index{% endblock %}
+{% block title %}Gallery{% endblock %}
{% block body %}
-
Welcome to the Image:index page
+
Gallery
+
{% endblock %}
diff --git a/src/Sikofitt/DoughnutWeddingBundle/Resources/views/Image/tag.html.twig b/src/Sikofitt/DoughnutWeddingBundle/Resources/views/Image/tag.html.twig
index 5545a80..d28ad19 100644
--- a/src/Sikofitt/DoughnutWeddingBundle/Resources/views/Image/tag.html.twig
+++ b/src/Sikofitt/DoughnutWeddingBundle/Resources/views/Image/tag.html.twig
@@ -1,7 +1,7 @@
{% extends "::base.html.twig" %}
-{% block title %}SikofittDoughnutWeddingBundle:Image:tag{% endblock %}
+{% block title %}Gallery | {{ tagName|capitalize }}{% endblock %}
{% block body %}
-
Welcome to the Image:tag page
+
Photos tagged with '{{ tagName|capitalize }}'
{% endblock %}
diff --git a/src/Sikofitt/DoughnutWeddingBundle/Resources/views/Image/upload.html.twig b/src/Sikofitt/DoughnutWeddingBundle/Resources/views/Image/upload.html.twig
index cd85e16..58f2d30 100644
--- a/src/Sikofitt/DoughnutWeddingBundle/Resources/views/Image/upload.html.twig
+++ b/src/Sikofitt/DoughnutWeddingBundle/Resources/views/Image/upload.html.twig
@@ -1,6 +1,6 @@
{% extends "::base.html.twig" %}
-{% block title %}SikofittDoughnutWeddingBundle:Image:upload{% endblock %}
+{% block title %}Gallery Upload{% endblock %}
{% block body %}
{{ form_start(form, {'attr': { 'class': 'uk-form uk-form-horizontal'}}) }}
diff --git a/src/Sikofitt/DoughnutWeddingBundle/Security/AccessDeniedHandler.php b/src/Sikofitt/DoughnutWeddingBundle/Security/AccessDeniedHandler.php
new file mode 100644
index 0000000..a047403
--- /dev/null
+++ b/src/Sikofitt/DoughnutWeddingBundle/Security/AccessDeniedHandler.php
@@ -0,0 +1,67 @@
+router = $router;
+ $this->logger = $logger;
+ }
+
+ /**
+ * Redirects to the login page on access denied failure.
+ *
+ * @param Request $request
+ * @param AccessDeniedException $accessDeniedException
+ *
+ * @return RedirectResponse
+ */
+ public function handle(Request $request, AccessDeniedException $accessDeniedException) : RedirectResponse {
+ $request->getSession()->getFlashBag()->add('error', $accessDeniedException->getMessage());
+ $url = $this->router->generate('fos_user_security_login');
+ $this->logger->alert($accessDeniedException->getMessage(), [
+ 'code' => $accessDeniedException->getCode(),
+ 'attributes' => $accessDeniedException->getAttributes(),
+ 'subject' => $accessDeniedException->getSubject(),
+ ]);
+
+ return new RedirectResponse($url, 302, [
+ 'X-Denied-Message' => $accessDeniedException->getMessage(),
+ 'X-Denied-Status-Code' => $accessDeniedException->getCode(),
+ ]);
+
+ }
+}
\ No newline at end of file