diff --git a/Gruntfile.js b/Gruntfile.js index 757cab6..3950e24 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -52,7 +52,14 @@ module.exports = function (grunt) { src: ['*.css', '!*.min.css'], dest: 'build/dist/css', ext: '.min.css' - }] + }, + { + expand: true, + cwd: 'build/css', + src: ['*.css', '!*.min.css'], + dest: 'build/dist/css', + ext: '.min.css' + }] } }, jshint: { @@ -134,7 +141,7 @@ module.exports = function (grunt) { 'build/dist', 'web/js/*.js', 'web/css/*.css', - 'web/images/*.svg' + 'web/images/*' ] }); diff --git a/app/AppCache.php b/app/AppCache.php index 639ec2c..dd10cc5 100644 --- a/app/AppCache.php +++ b/app/AppCache.php @@ -1,5 +1,23 @@ . + */ + use Symfony\Bundle\FrameworkBundle\HttpCache\HttpCache; class AppCache extends HttpCache diff --git a/app/AppKernel.php b/app/AppKernel.php index 8b07f3e..b6eb9b6 100644 --- a/app/AppKernel.php +++ b/app/AppKernel.php @@ -1,13 +1,30 @@ . + */ + use Symfony\Component\Config\Loader\LoaderInterface; +use Symfony\Component\HttpKernel\Kernel; class AppKernel extends Kernel { public function registerBundles() { - $bundles = [ new Symfony\Bundle\FrameworkBundle\FrameworkBundle(), new Symfony\Bundle\SecurityBundle\SecurityBundle(), diff --git a/app/Resources/FOSUserBundle/views/Profile/edit.html.twig b/app/Resources/FOSUserBundle/views/Profile/edit.html.twig index bd7fbdc..5aa007b 100644 --- a/app/Resources/FOSUserBundle/views/Profile/edit.html.twig +++ b/app/Resources/FOSUserBundle/views/Profile/edit.html.twig @@ -1,5 +1,5 @@ -{% extends "@FOSUser/layout.html.twig" %} +{% extends "base.html.twig" %} -{% block fos_user_content %} +{% block body %} {% include "@FOSUser/Profile/edit_content.html.twig" %} -{% endblock fos_user_content %} +{% endblock body %} diff --git a/app/Resources/FOSUserBundle/views/Profile/edit_content.html.twig b/app/Resources/FOSUserBundle/views/Profile/edit_content.html.twig index c827436..106a91b 100644 --- a/app/Resources/FOSUserBundle/views/Profile/edit_content.html.twig +++ b/app/Resources/FOSUserBundle/views/Profile/edit_content.html.twig @@ -1,8 +1,29 @@ {% trans_default_domain 'FOSUserBundle' %} +{% if form.vars.errors is not empty %} +
+ {{ form_errors(form) }} -{{ form_start(form, { 'action': path('fos_user_profile_edit'), 'attr': { 'class': 'fos_user_profile_edit' } }) }} - {{ form_widget(form) }} -
-
+{% endif %} +{{ form_start(form, { 'action': path('fos_user_profile_edit'), 'attr': { 'class': 'uk-form-horizontal fos_user_profile_edit' } }) }} + {{ form_label(form.email) }} +
+ {{ form_widget(form.email) }} +
+ {{ form_label(form.name) }} +
+ {{ form_widget(form.name) }} +
+{{ form_label(form.rsvp) }} +
+ {{ form_widget(form.rsvp) }} +
+ +
+ +
+
+ Cancel +
+{{ form_rest(form) }} {{ form_end(form) }} diff --git a/app/Resources/FOSUserBundle/views/Profile/show.html.twig b/app/Resources/FOSUserBundle/views/Profile/show.html.twig index 1e4a259..3e1f355 100644 --- a/app/Resources/FOSUserBundle/views/Profile/show.html.twig +++ b/app/Resources/FOSUserBundle/views/Profile/show.html.twig @@ -1,5 +1,5 @@ -{% extends "@FOSUser/layout.html.twig" %} +{% extends "base.html.twig" %} -{% block fos_user_content %} +{% block body %} {% include "@FOSUser/Profile/show_content.html.twig" %} -{% endblock fos_user_content %} +{% endblock body %} diff --git a/app/Resources/FOSUserBundle/views/Profile/show_content.html.twig b/app/Resources/FOSUserBundle/views/Profile/show_content.html.twig index 3c819d2..6648fe1 100644 --- a/app/Resources/FOSUserBundle/views/Profile/show_content.html.twig +++ b/app/Resources/FOSUserBundle/views/Profile/show_content.html.twig @@ -1,6 +1,31 @@ -{% trans_default_domain 'FOSUserBundle' %} +{% trans_default_domain 'SikofittDoughnutweddingBundle' %} +

User Information

-
-

{{ 'profile.show.username'|trans }}: {{ user.username }}

-

{{ 'profile.show.email'|trans }}: {{ user.email }}

-
+
+ +

{{ 'profile.name'|trans }}

+

{{ user.name }}

+ +

{{ 'profile.email'|trans }}

+

{{ user.email }}

+ +

{{ 'profile.rsvp'|trans }}

+

{% if user.rsvp is not null %}{{ user.rsvp.guests }}{% else %}0{% endif %}

+ +
+
+ + +
+
{{ 'profile.member_since'|trans({'%date%':user.created|date('l F jS, Y (h:i a)')}) }}
diff --git a/app/Resources/FOSUserBundle/views/Registration/confirmed.html.twig b/app/Resources/FOSUserBundle/views/Registration/confirmed.html.twig index 4402b4f..73e9c3e 100644 --- a/app/Resources/FOSUserBundle/views/Registration/confirmed.html.twig +++ b/app/Resources/FOSUserBundle/views/Registration/confirmed.html.twig @@ -1,10 +1,11 @@ -{% extends "@FOSUser/layout.html.twig" %} +{% extends "base.html.twig" %} {% trans_default_domain 'FOSUserBundle' %} -{% block fos_user_content %} -

{{ 'registration.confirmed'|trans({'%username%': user.username}) }}

+{% block body %} +

{{ 'registration.confirmed'|trans({'%username%': user.firstname }) }}

+

Continue to the home page.

{% if targetUrl %} -

{{ 'registration.back'|trans }}

+

{{ 'registration.back'|trans }}

{% endif %} -{% endblock fos_user_content %} +{% endblock body %} diff --git a/app/Resources/FOSUserBundle/views/Registration/register_content.html.twig b/app/Resources/FOSUserBundle/views/Registration/register_content.html.twig index c28cb96..c92b982 100644 --- a/app/Resources/FOSUserBundle/views/Registration/register_content.html.twig +++ b/app/Resources/FOSUserBundle/views/Registration/register_content.html.twig @@ -2,6 +2,7 @@
{{ form_errors(form) }}
+{{ dump(app.session) }} {{ form_start(form, {'method': 'post', 'action': path('fos_user_registration_register'), 'attr': {'class': 'fos_user_registration_register uk-form'}}) }}
@@ -14,43 +15,12 @@
- +
- {{ form_widget(form.username, { 'attr': {'placeholder':'Username', 'class':'uk-input uk-form-large uk-padding-small'} }) }} + {{ form_widget(form.name, { 'attr': {'placeholder':'Name', 'class':'uk-input uk-form-large uk-padding-small'} }) }}
-
- -
- {{ form_widget(form.first_name, { 'attr': {'placeholder':'First name', 'class':'uk-input uk-form-large uk-padding-small'} }) }} -
-
-
- -
- {{ form_widget(form.last_name, { 'attr': {'placeholder':'Last name', 'class':'uk-input uk-input uk-form-large uk-padding-small'} }) }} -
-
-
-
- {{ form_label(form.familyside) }} -
-
-
- {{ form_widget(form.familyside) }} -
-
-
-
-
- {{ form_label(form.family) }} -
-
- {{ form_widget(form.family, { 'attr': {'class':'uk-checkbox'} }) }} - -
-
diff --git a/app/Resources/FOSUserBundle/views/Resetting/request.html.twig b/app/Resources/FOSUserBundle/views/Resetting/request.html.twig index 87e7b41..2da4765 100644 --- a/app/Resources/FOSUserBundle/views/Resetting/request.html.twig +++ b/app/Resources/FOSUserBundle/views/Resetting/request.html.twig @@ -1,5 +1,5 @@ -{% extends "@FOSUser/layout.html.twig" %} +{% extends "base.html.twig" %} -{% block fos_user_content %} +{% block body %} {% include "@FOSUser/Resetting/request_content.html.twig" %} -{% endblock fos_user_content %} +{% endblock body %} diff --git a/app/Resources/FOSUserBundle/views/Security/login.html.twig b/app/Resources/FOSUserBundle/views/Security/login.html.twig index e565119..004cfd5 100644 --- a/app/Resources/FOSUserBundle/views/Security/login.html.twig +++ b/app/Resources/FOSUserBundle/views/Security/login.html.twig @@ -1,5 +1,5 @@ -{% extends "@FOSUser/layout.html.twig" %} +{% extends "base.html.twig" %} -{% block fos_user_content %} +{% block body %} {{ include('@FOSUser/Security/login_content.html.twig') }} -{% endblock fos_user_content %} +{% endblock body %} diff --git a/app/Resources/FOSUserBundle/views/Security/login_content.html.twig b/app/Resources/FOSUserBundle/views/Security/login_content.html.twig index 863e796..50a3c9c 100644 --- a/app/Resources/FOSUserBundle/views/Security/login_content.html.twig +++ b/app/Resources/FOSUserBundle/views/Security/login_content.html.twig @@ -4,19 +4,32 @@
{{ error.messageKey|trans(error.messageData, 'security') }}
{% endif %} -
+ {% if csrf_token %} {% endif %} +
+
+ +
+ + +
+
+
+ +
+ - - + +
+
+
+
+
+ +
+
+
- - - - - - -
diff --git a/app/Resources/HWIOAuthBundle/views/Connect/connect_confirm.html.twig b/app/Resources/HWIOAuthBundle/views/Connect/connect_confirm.html.twig index ba5c229..b68c38c 100644 --- a/app/Resources/HWIOAuthBundle/views/Connect/connect_confirm.html.twig +++ b/app/Resources/HWIOAuthBundle/views/Connect/connect_confirm.html.twig @@ -1,24 +1,27 @@ -{% extends 'HWIOAuthBundle::layout.html.twig' %} +{% extends 'base.html.twig' %} -{% block hwi_oauth_content %} +{% block body %}

{{ 'header.connecting' | trans({}, 'HWIOAuthBundle')}}

-
-
-

{{ 'connect.confirm.text' | trans({'%service%': service | trans({}, 'HWIOAuthBundle'), '%name%': userInformation.realName}, 'HWIOAuthBundle') }}

+
+ +

{{ 'connect.confirm.text' | trans({'%service%': service | trans({}, 'HWIOAuthBundle'), '%name%': userInformation.email}, 'HWIOAuthBundle') }}

{{ form_start(form, {'action': path('hwi_oauth_connect_service', {'service': service, 'key': key}), 'attr': {'class': 'fos_user_registration_register'}}) }} {{ form_widget(form) }} -

- - {{ 'connect.confirm.cancel' | trans({}, 'HWIOAuthBundle') }} -
+
+
+ +
+ +
{{ form_end(form) }}

-
{% if userInformation.profilePicture is defined and userInformation.profilePicture is not empty %} {% endif %}
-{% endblock hwi_oauth_content %} +{% endblock body %} diff --git a/app/Resources/HWIOAuthBundle/views/Connect/registration.html.twig b/app/Resources/HWIOAuthBundle/views/Connect/registration.html.twig index fc904c3..dd0aef8 100644 --- a/app/Resources/HWIOAuthBundle/views/Connect/registration.html.twig +++ b/app/Resources/HWIOAuthBundle/views/Connect/registration.html.twig @@ -1,22 +1,30 @@ -{% extends 'HWIOAuthBundle::layout.html.twig' %} +{% extends 'base.html.twig' %} -{% block hwi_oauth_content %} -

{{ 'header.register' | trans({'%name%': userInformation.realName}, 'HWIOAuthBundle') }}

-
-
- {{ form_start(form, {'action': path('hwi_oauth_connect_registration', {'key': key}), 'attr': {'class': 'hwi_oauth_registration_register'}}) }} +{% block body %} +
+ {{ dump(userInformation) }} +
+ {% if userInformation.resourceOwner.name == 'yahoo' %} + {% set name = userInformation.nickname %} + {% else %} + {% set name = userInformation.email %} + {% endif %} +

{{ 'header.register' | trans({'%name%': name }, 'HWIOAuthBundle') }}

+ + + {{ form_start(form, {'action': path('hwi_oauth_connect_registration', {'key': key}), 'attr': {'class': 'hwi_oauth_registration_register uk-form uk-form-horizontal'}}) }} {{ form_widget(form) }}
{{ 'connect.registration.cancel' | trans({}, 'HWIOAuthBundle') }}
{{ form_end(form) }} -
-
+ + {% if userInformation.profilePicture is not empty %} {% endif %} -
+
-{% endblock hwi_oauth_content %} +{% endblock body %} diff --git a/app/Resources/translations/SikofittDoughnutweddingBundle.en.yml b/app/Resources/translations/SikofittDoughnutweddingBundle.en.yml new file mode 100644 index 0000000..45f3b14 --- /dev/null +++ b/app/Resources/translations/SikofittDoughnutweddingBundle.en.yml @@ -0,0 +1,9 @@ +profile.yes: Yep! +profile.no: Nope! +profile.name: Name +profile.email: Email address +profile.family: Immediate Family Member +profile.family_side: Family Side +profile.family_side_data: You're here for %family_side%! +profile.rsvp: Current guests including yourself. +profile.member_since: You've been a user since %date%! \ No newline at end of file diff --git a/app/Resources/translations/default.en.yml b/app/Resources/translations/default.en.yml new file mode 100644 index 0000000..9778413 --- /dev/null +++ b/app/Resources/translations/default.en.yml @@ -0,0 +1 @@ +profile.name: Name \ No newline at end of file diff --git a/app/Resources/translations/messages.en.yml b/app/Resources/translations/messages.en.yml new file mode 100644 index 0000000..9778413 --- /dev/null +++ b/app/Resources/translations/messages.en.yml @@ -0,0 +1 @@ +profile.name: Name \ No newline at end of file diff --git a/app/Resources/views/base.html.twig b/app/Resources/views/base.html.twig index dd283b9..c50d679 100644 --- a/app/Resources/views/base.html.twig +++ b/app/Resources/views/base.html.twig @@ -8,6 +8,7 @@ Title + @@ -16,8 +17,17 @@ {% block debug %}{% endblock %}
+
+ +
{% include 'flash_messages.html.twig' %} {% block body %}{% endblock %} + check + check + check + {% include "social_login.html.twig" %} {% block footer %}{% endblock %}
diff --git a/app/Resources/views/default/index.html.twig b/app/Resources/views/default/index.html.twig index 94cb36f..3677789 100644 --- a/app/Resources/views/default/index.html.twig +++ b/app/Resources/views/default/index.html.twig @@ -4,16 +4,26 @@ {% block body %}
-
+
+ + +
+

About Us

+
+ +
+ +
+
+
+
Small2
Medium
-
-
Large
-
+
{% endblock %} diff --git a/app/Resources/views/social_login.html.twig b/app/Resources/views/social_login.html.twig index 31ed025..27c98e0 100644 --- a/app/Resources/views/social_login.html.twig +++ b/app/Resources/views/social_login.html.twig @@ -1,7 +1,11 @@ -{% if(is_granted('IS_AUTHENTICATED_ANONYMOUSLY') and hide_social is not defined ) %} +{% if(not is_granted('IS_AUTHENTICATED_FULLY')) %}
-

Login

+

+ + Login Register + +

  • diff --git a/app/autoload.php b/app/autoload.php index 31321fa..09ce039 100644 --- a/app/autoload.php +++ b/app/autoload.php @@ -1,7 +1,25 @@ . + */ + use Composer\Autoload\ClassLoader; +use Doctrine\Common\Annotations\AnnotationRegistry; /** @var ClassLoader $loader */ $loader = require __DIR__.'/../vendor/autoload.php'; diff --git a/app/config/config.yml b/app/config/config.yml index 2764085..185d203 100644 --- a/app/config/config.yml +++ b/app/config/config.yml @@ -149,15 +149,11 @@ hwi_oauth: type: twitter client_id: 'YmXGQN2Az0eTlkwJrnaO2wR9r' client_secret: 'c73cBI7uj562BU4bBSHfNDcKHgM5aVo8sousjgUdDNBZFXxFHI' - windows: - type: windows_live - client_id: 'f9dc3dd7-1b1c-4b8c-acdf-f40611ab550d' - client_secret: 'fy5prOcKeLKNTB616WinrPt' - scope: wl.signin yahoo: type: yahoo client_id: 'dj0yJmk9SndXWm05Tk5yME9MJmQ9WVdrOVRYTkVUVWRHTjJjbWNHbzlNQS0tJnM9Y29uc3VtZXJzZWNyZXQmeD1lMw--' client_secret: '4f837f738d6c4df38eaedc7babe4d8f405f8cc0f' + scope: 'sdps-r' fosub: # try 30 times to check if a username is available (foo, foo1, foo2 etc) username_iterations: 30 @@ -169,21 +165,33 @@ hwi_oauth: amazon: amazonId instagram: instagramId twitter: twitterId - windows_live: windowsId yahoo: yahooId # if you want to use 'connect' and do not use the FOSUB integration, configure these separately - connect: ~ + connect: + confirmation: false fos_user: db_driver: orm # other valid values are 'mongodb' and 'couchdb' firewall_name: secured_area user_class: Sikofitt\DoughnutWeddingBundle\Entity\User from_email: - address: noreply@doughnutwedding.com - sender_name: "No Reply" + address: 'noreply@doughnutwedding.com' + sender_name: "[Doughnut Wedding] No Reply" + profile: + form: + type: Sikofitt\DoughnutWeddingBundle\Form\ProfileEditType registration: form: type: Sikofitt\DoughnutWeddingBundle\Form\RegistrationType +swiftmailer: + #disable_delivery: true + transport: null #'%mailer_transport%' + host: '%mailer_host%' + username: '%mailer_user%' + password: '%mailer_password%' + spool: { type: memory } + delivery_addresses: ['info@doughnutwedding.com'] + sender_address: 'noreply@doughnutwedding.com' sikofitt_doughnut_wedding: max_rsvps: ~ \ No newline at end of file diff --git a/app/config/config_dev.yml b/app/config/config_dev.yml index 9b3c82b..7f0c1a2 100644 --- a/app/config/config_dev.yml +++ b/app/config/config_dev.yml @@ -38,4 +38,7 @@ monolog: # level: info #swiftmailer: -# delivery_addresses: ['me@example.com'] +# disable_delivery: true +# transport: smtp +# delivery_addresses: ['info@doughnutwedding.com'] +# sender_address: 'noreply@doughnutwedding.com' diff --git a/app/config/google-storage-key.json b/app/config/google-storage-key.json new file mode 100644 index 0000000..ea13507 --- /dev/null +++ b/app/config/google-storage-key.json @@ -0,0 +1,12 @@ +{ + "type": "service_account", + "project_id": "doughnut-wedding", + "private_key_id": "097ae8333fdb2ba046efe522e25cffda1163547a", + "private_key": "-----BEGIN PRIVATE KEY-----\nMIIEvAIBADANBgkqhkiG9w0BAQEFAASCBKYwggSiAgEAAoIBAQCpiZ7fjrZIBxIJ\nprUQdKA7ODlF698aOkJNBPr2tgV2X1Xb2SYObs3p3/nhR+4SijXU4yrQSfOdUBPS\nlyM+vbT1uEniRMNUqQWcJyZN4sT0MmG85wGh3zCGa6FbakKGC6nhH1DuT6o7T1v7\nxqR/Byp7/6rAUxy0Yhm2CmlWmrt0Oe1wx42N4m1t9865SrNzUNloRp0a9jUQWpew\nssoG3pYlbzv+KHE4BSTGJEu2ErpA5kOp+loIOlmveyb8ac+tHUHqozkzMQ5+Esyf\nnNCpzurq6hL/9piVhkd1Hyr947Vb3kz6dpDoeBZqCzXK/1n3d/VJjYpBvCVqq5xr\n34U7Bfa9AgMBAAECggEAdIY2QAlil5bkeuWtxSWji5BVLQ21Rd2M/ErUAwWQM4/K\n/1P8qCbYOErNAF3j77I21Z9dKdPqMNF9Dlz6yICzA8AqZ+5DIskZJf5ygU2/eOe3\n7ZIIuS0huQH44U/jcSZLGIPhqCnxItqkqiQZo4VVWeybe5ykOgbDDS+SvweSl4qq\ngILLaMsEzDSJZhwLnmAeRnd1REq1afrQtIF/aNo5vZj0WvcLIEkwkAHqcZAUy/ox\n5huswc3SiUA4ruJkEKTtHwUDqlQhQVGGrHV0tuFHCYfxUMu1/Zp5G6e4jUeAq7t6\nKCx4tFi6U1ETiZ8w18mhO/uWkDAa0A9qquo7v+xagQKBgQDV/1Zrzv1P09XztFaV\nmhueNLJ570Fy2MNa/gHIjWJFjJlknpfCXn4q0jFBfiKs2iReRTEni33mPtzdcONF\njps/zeGch+6Exp7I+zTji2JMtXs8CiAJfR388QLzDETg6jwSL4hLWadizlJzsVA8\n4PliLv7P1kJMhMswKrUazaaetQKBgQDK0FLOVuYhLPWP2RHu0nr5MSLneXRG+dKx\nNc4Dk00ms1O6NPdhWwmHcDfocJMmi0usDvs9XjxwCQHB4KrITODRpSq3M9fI3I+W\n/QUNZfRqf0bQFzRuiKOh5BAZub3Zil3h7htkcqP4TuLvXqoHs5z2mS1wFUdcukLv\nAN7nOI/06QKBgGY9Ur25K98Kt0py23coJI/GX4rQGzXSiCsd9h4qJkxSKysediT/\n3kl5GN1QdSKeKgf8CMr64xCw8fa+K2cdBeFK7MJLU1KOTmh5VEBuZG1/uzvpHntK\nEpy5TQ5vyyyl3ENYAEb3s3gKWOw7R7l+Rsd46nbDx/Mk8qq1jMccf8GNAoGAXhe6\nYxpz1+5o2tzlcfxaqyO9wtBZPtiGhEqnEoeTYqIN9TS/lH5M9HX+qisYSeiUKfYl\nX3pJ5dx34T/fW+A26WyMXcSClyCkyXMHlgi4FXSJIN+zJpjj+aa6RYUj7DpChiAW\nu0pogjnvFQjBL6OH7exw5TAqFH4hsYqg33shZokCgYBvYMEUN+ZtNlVkgMd6lPoG\noVxq/JwJZ8d48yQ8XP3N/8qmPiuMtD9JJi6ZV4S/qvlMt63KkmtRAACQFQyJSfYj\n9U4H3sJ13vzW2tuZ87d58fACnzgElpwxifKz9X/h9+9rrD8UHvdmzSHISh2E3I3T\nsOO36Is9YoCwwjNsN9BacA==\n-----END PRIVATE KEY-----\n", + "client_email": "doughnut-wedding-images@doughnut-wedding.iam.gserviceaccount.com", + "client_id": "108682906131804711525", + "auth_uri": "https://accounts.google.com/o/oauth2/auth", + "token_uri": "https://accounts.google.com/o/oauth2/token", + "auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs", + "client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/doughnut-wedding-images%40doughnut-wedding.iam.gserviceaccount.com" +} diff --git a/app/config/routing.yml b/app/config/routing.yml index c3f82e5..2554e40 100644 --- a/app/config/routing.yml +++ b/app/config/routing.yml @@ -8,7 +8,7 @@ hwi_oauth_connect: hwi_oauth_login: resource: "@HWIOAuthBundle/Resources/config/routing/login.xml" - prefix: /login/oauth + prefix: /connect facebook_login: path: /login/callback/facebook @@ -16,8 +16,6 @@ google_login: path: /login/callback/google twitter_login: path: /login/callback/twitter -windows_login: - path: /login/callback/windows instagram_login: path: /login/callback/instagram amazon_login: @@ -25,7 +23,7 @@ amazon_login: yahoo_login: path: /login/callback/yahoo -os_user_security: +fos_user_security: resource: "@FOSUserBundle/Resources/config/routing/security.xml" #paths # /login diff --git a/app/config/security.yml b/app/config/security.yml index 01f13b8..7fdca2a 100644 --- a/app/config/security.yml +++ b/app/config/security.yml @@ -7,7 +7,7 @@ security: cost: 14 providers: fos_userbundle: - id: fos_user.user_provider.username_email + id: fos_user.user_provider.username firewalls: # disables authentication for assets and the profiler, adapt it according to your needs dev: @@ -28,20 +28,20 @@ security: facebook: /login/callback/facebook google: /login/callback/google twitter: /login/callback/twitter - windows: /login/callback/windows instagram: /login/callback/instagram amazon: /login/callback/amazon yahoo: /login/callback/yahoo - login_path: /login + login_path: /connect use_forward: false - failure_path: /login + failure_path: /connect oauth_user_provider: service: hwi_oauth.user.provider.fosub_bridge access_control: + - { path: ^/login$, role: IS_AUTHENTICATED_ANONYMOUSLY } - { path: ^/register, role: IS_AUTHENTICATED_ANONYMOUSLY } - { path: ^/resetting, role: IS_AUTHENTICATED_ANONYMOUSLY } - - { path: ^/user, role: ROLE_USER } + - { path: ^/user$, role: ROLE_USER } - { path: ^/gallery/upload, role: ROLE_USER } - { path: ^/gallery, role: IS_AUTHENTICATED_ANONYMOUSLY } - - { path: ^/admin/, role: ROLE_ADMIN } \ No newline at end of file + - { path: ^/admin$, role: ROLE_ADMIN } \ No newline at end of file diff --git a/app/config/services.yml b/app/config/services.yml index 47b5840..12ba0d1 100644 --- a/app/config/services.yml +++ b/app/config/services.yml @@ -10,5 +10,17 @@ services: doughnutwedding.form.registration: class: Sikofitt\DoughnutWeddingBundle\Form\RegistrationType + arguments: ['@fos_user.user_manager'] tags: - - { name: form.type, alias: app_user_registration } \ No newline at end of file + - { name: form.type, alias: app_user_registration } + doughnutwedding.event.redirect_user_logged_in_event: + class: Sikofitt\DoughnutWeddingBundle\EventListener\UserRedirectOnLoggedInListener + arguments: ['@security.token_storage', '@router'] + tags: + - { name: kernel.event_listener, event: kernel.request } + doughnutwedding.event.redirect_user_after_register_event: + class: Sikofitt\DoughnutWeddingBundle\EventListener\RedirectOnUserRegisterListener + arguments: ['@router'] + tags: + - { name: kernel.event_listener, event: fos_user.registration.confirmed } + - { name: kernel.event_listener, event: fos_user.registration.completed } \ No newline at end of file diff --git a/build/images/logo.png b/build/images/logo.png new file mode 100644 index 0000000..6160a3a Binary files /dev/null and b/build/images/logo.png differ diff --git a/build/js/doughnut.js b/build/js/doughnut.js index 94f9c89..974e1c2 100644 --- a/build/js/doughnut.js +++ b/build/js/doughnut.js @@ -1,5 +1,5 @@ jQuery(document).ready(function($) { - if(null !== document.querySelector('select') && document.querySelector('select').length > 0) { + if(null === document.querySelector('select') && document.querySelector('select').length > 0) { var selectPlaceholder = 'Choose an option.'; if(document.querySelector('select').hasAttribute('placeholder')) { selectPlaceholder = document.querySelector('select').getAttribute('placeholder'); @@ -9,5 +9,6 @@ jQuery(document).ready(function($) { minimumResultsForSearch: Infinity, theme: 'default' }); + } }); \ No newline at end of file diff --git a/build/less/doughnut.less b/build/less/doughnut.less index 8d5c02f..3b2f7fb 100644 --- a/build/less/doughnut.less +++ b/build/less/doughnut.less @@ -3,7 +3,10 @@ //@global-font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; //@global-font-size: 16px; - +@base-body-font-family: 'Raleway', sans-serif; +@base-heading-font-family: 'Raleway', sans-serif; +@base-body-font-weight: 200; +@base-heading-font-weight: 300; @form-background: #ffffff; .uk-input, @@ -18,4 +21,10 @@ background: #f5fbfe; border:1px solid #99baca; color: #666; -} \ No newline at end of file +} +.uk-login-form #password { + border-top:0 !important; +} +.uk-login-form #password:focus { + border-top: 1px solid #99baca !important; +} diff --git a/composer.json b/composer.json index 20c30d3..8584295 100644 --- a/composer.json +++ b/composer.json @@ -19,6 +19,7 @@ "doctrine/orm": "^2.5", "egulias/email-validator": "^2.1", "friendsofsymfony/user-bundle": "^2.0", + "google/apiclient": "^2.1", "google/recaptcha": "^1.1", "hwi/oauth-bundle": "^0.5.3", "incenteev/composer-parameter-handler": "^2.0", @@ -26,6 +27,7 @@ "ircmaxell/security-lib": "^1.1", "j-ben87/parsley-bundle": "^1.4", "javiereguiluz/easyadmin-bundle": "^1.16", + "knplabs/knp-gaufrette-bundle": "^0.4.0", "lexik/translation-bundle": "^4.0", "lightsaml/sp-bundle": "^1.1", "moontoast/math": "^1.1", @@ -34,7 +36,7 @@ "paragonie/sodium_compat": "^0.6.0", "predis/predis": "^1.1", "psr/http-message": "^1.0", - "ramsey/uuid": "^3.5", + "ramsey/uuid": "^3.6", "ramsey/uuid-doctrine": "^1.2", "ravenberg/uikit-bundle": "^1.0", "sensio/distribution-bundle": "^5.0", diff --git a/docker/php/Dockerfile b/docker/php/Dockerfile index 0d8ee03..7fac4f8 100644 --- a/docker/php/Dockerfile +++ b/docker/php/Dockerfile @@ -1,5 +1,5 @@ -#FROM php:7.1-fpm-alpine -FROM php-7.1.4-fpm-alpine +FROM php:7.1-fpm-alpine +#FROM php-7.1.4-fpm-alpine ENV PHPIZE_DEPS \ autoconf \ diff --git a/src/Sikofitt/DoughnutWeddingBundle/Controller/DefaultController.php b/src/Sikofitt/DoughnutWeddingBundle/Controller/DefaultController.php index 8196be2..13c84be 100644 --- a/src/Sikofitt/DoughnutWeddingBundle/Controller/DefaultController.php +++ b/src/Sikofitt/DoughnutWeddingBundle/Controller/DefaultController.php @@ -1,33 +1,49 @@ . + */ + namespace Sikofitt\DoughnutWeddingBundle\Controller; -use Symfony\Bundle\FrameworkBundle\Controller\Controller; use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; -use Symfony\Component\DependencyInjection\ContainerAwareInterface; -use Symfony\Component\DependencyInjection\ContainerInterface; -use Symfony\Component\HttpFoundation\Response; +use Symfony\Bundle\FrameworkBundle\Controller\Controller; use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpFoundation\Response; /** - * Class DefaultController + * Class DefaultController. */ class DefaultController extends Controller { - - /** + /** * @Route("/") * * @param Request $request + * * @return Response */ public function indexAction(Request $request) { - $parameters = []; - if(null !== $this->getUser()) { - $parameters['hide_social'] = true; - } - return $this->render('default/index.html.twig', $parameters); - } + $parameters = []; + if (null !== $this->getUser()) { + $parameters['hide_social'] = true; + } + return $this->render('default/index.html.twig', $parameters); + } } diff --git a/src/Sikofitt/DoughnutWeddingBundle/Controller/ImageController.php b/src/Sikofitt/DoughnutWeddingBundle/Controller/ImageController.php index 8b0e012..fdca419 100644 --- a/src/Sikofitt/DoughnutWeddingBundle/Controller/ImageController.php +++ b/src/Sikofitt/DoughnutWeddingBundle/Controller/ImageController.php @@ -1,14 +1,31 @@ . + */ + namespace Sikofitt\DoughnutWeddingBundle\Controller; -use Symfony\Bundle\FrameworkBundle\Controller\Controller; use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; +use Symfony\Bundle\FrameworkBundle\Controller\Controller; /** - * Class ImageController + * Class ImageController. * - * @package Sikofitt\DoughnutWeddingBundle\Controller * @Route("/gallery") */ class ImageController extends Controller @@ -18,9 +35,9 @@ class ImageController extends Controller */ public function indexAction() { - return $this->render('SikofittDoughnutWeddingBundle:Image:index.html.twig', array( + return $this->render('SikofittDoughnutWeddingBundle:Image:index.html.twig', [ // ... - )); + ]); } /** @@ -28,9 +45,9 @@ class ImageController extends Controller */ public function uploadAction() { - return $this->render('SikofittDoughnutWeddingBundle:Image:upload.html.twig', array( + return $this->render('SikofittDoughnutWeddingBundle:Image:upload.html.twig', [ // ... - )); + ]); } /** @@ -38,9 +55,9 @@ class ImageController extends Controller */ public function tagAction() { - return $this->render('SikofittDoughnutWeddingBundle:Image:tag.html.twig', array( + return $this->render('SikofittDoughnutWeddingBundle:Image:tag.html.twig', [ // ... - )); + ]); } /** @@ -48,9 +65,8 @@ class ImageController extends Controller */ public function categoryAction() { - return $this->render('SikofittDoughnutWeddingBundle:Image:category.html.twig', array( + return $this->render('SikofittDoughnutWeddingBundle:Image:category.html.twig', [ // ... - )); + ]); } - } diff --git a/src/Sikofitt/DoughnutWeddingBundle/Controller/RsvpController.php b/src/Sikofitt/DoughnutWeddingBundle/Controller/RsvpController.php index 85d4fff..e805961 100644 --- a/src/Sikofitt/DoughnutWeddingBundle/Controller/RsvpController.php +++ b/src/Sikofitt/DoughnutWeddingBundle/Controller/RsvpController.php @@ -25,7 +25,6 @@ use Doctrine\ORM\EntityManager; use Symfony\Bundle\FrameworkBundle\Controller\Controller; use Symfony\Component\Form\FormFactory; use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Routing\Annotation\Route; use Symfony\Component\Validator\ConstraintViolationList; @@ -33,6 +32,7 @@ class RsvpController extends Controller { /** * @Route("/rsvp") + * * @param \Symfony\Component\HttpFoundation\Request $request * * @return \Symfony\Component\HttpFoundation\RedirectResponse|\Symfony\Component\HttpFoundation\Response diff --git a/src/Sikofitt/DoughnutWeddingBundle/Controller/UserController.php b/src/Sikofitt/DoughnutWeddingBundle/Controller/UserController.php deleted file mode 100644 index 30b4221..0000000 --- a/src/Sikofitt/DoughnutWeddingBundle/Controller/UserController.php +++ /dev/null @@ -1,215 +0,0 @@ -. - */ - -namespace Sikofitt\DoughnutWeddingBundle\Controller; - -use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; -use Sikofitt\App\Form\UserLoginType; -use Sikofitt\App\Form\UserTokenType; -use Sikofitt\DoughnutWeddingBundle\Security\TokenGenerator; -use Symfony\Bundle\FrameworkBundle\Controller\Controller; -use Symfony\Component\Form\FormError; -use Symfony\Component\HttpFoundation\JsonResponse; -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpFoundation\StreamedResponse; - -/** - * Class UserController. - - */ -class UserController extends Controller -{ - - /** - * @Route("/logout", name="logout") - * @param \Symfony\Component\HttpFoundation\Request $request - * @return \Symfony\Component\HttpFoundation\Response - */ - public function logoutAction(Request $request) - { - if(null !== $request->getUser()) { - $request->getSession()->remove('user'); - } - return $this->render('user/logout.html.twig'); - } - - public function tokenLoginAction(Request $request, string $token = null) - { - if (null === $token) { - $tokenForm = $this->get('form.factory')->create(UserTokenType::class); - if ($request->isMethod('POST')) { - $tokenForm->handleRequest($request); - if ($tokenForm->isValid() && $tokenForm->isSubmitted()) { - if ($tokenForm->get('update_token')->isClicked()) { - if (null !== $tokenForm->get('email')->getData()) { - return $this->updateAndSendTokenLoginLink($this, - $tokenForm); - } else { - $tokenForm->get('email') - ->addError(new FormError('Email address is a required field to send a new login link.')); - - return $this->render('form/token.html.twig', - ['form' => $tokenForm->createView()]); - } - } else { - $userToken = $tokenForm->get('user_token')->getData(); - - $user = $this->getDoctrine() - ->getRepository('SikofittDoughnutWeddingBundle:User') - ->getUserByUserToken($userToken); - - if (null === $user) { - $tokenForm->get('user_token') - ->addError(new FormError('Token is invalid.')); - } else { - $request->getSession()->set('user', $user); - } - - return $this->render('form/token.html.twig', - ['form' => $tokenForm->createView()]); - } - } else { - return $this->render('form/token.html.twig', - ['form' => $tokenForm->createView()]); - } - } - - return $this->render('form/token.html.twig', ['form' => $tokenForm->createView()]); - } else { - // Token has been included. - $request->getSession()->remove('user'); - $tokenForm = $this->get('form.factory')->create(UserTokenType::class); - //$user = $app->getEntityManager()->getRepository('Sikofitt:User')->getUserByUserToken($token); - $user = $this->getDoctrine()->getRepository('SikofittDoughnutWeddingBundle:User')->findOneBy(['userToken' => $token]); - if (null !== $user) { - $request->getSession()->set('user', $user); - - return $this->render('user/index.html.twig'); - } else { - return new StreamedResponse(function () use ($tokenForm, $token) { - $tokenForm->get('user_token')->setData($token); - $tokenForm->get('user_token')->addError(new FormError('Invalid token.')); - print $this->renderView('form/token.html.twig', ['form' => $tokenForm->createView()]); - }); - } - } - } - - /** - * @Route("/user", name="user_index") - * @param \Symfony\Component\HttpFoundation\Request $request - * - * @return \Symfony\Component\HttpFoundation\JsonResponse - */ - public function indexAction(Request $request) - { - - //if ($request->getSession()->has('user')) { - return new JsonResponse( - [ - 'request' => $request->request->all(), - 'server' => $request->server->all(), - 'headers' => $request->headers->all(), - 'session' => $request->getSession()->all(), - 'token' => (string) new TokenGenerator(), - ] - ); - // } - } - - public function loginAction(Request $request) - { - if ($app->session()->has('user')) { - //return $app->redirect($app->url('rsvp_edit')); - } - $loginForm = $app->getFormFactory()->create(UserLoginType::class); - if ($request->isMethod('POST')) { - $loginForm->handleRequest($request); - if ($loginForm->isValid() && $loginForm->isSubmitted()) { - $user = $app->getEntityManager()->getRepository(User::class)->findByEmail($loginForm->get('email_username')->getData()); - if (null !== $user && true === password_verify($loginForm->get('password')->getData(), $user[0]->getPassword())) { - $userSession = [ - 'firstName' => $user[0]->getFirstName(), - 'lastName' => $user[0]->getLastName(), - 'fullName' => sprintf('%s %s', $user[0]->getFirstName(), $user[0]->getLastName()), - 'familySide' => $user[0]->getFamilySide(), - 'email' => $user[0]->getEmail(), - 'family' => $user[0]->getFamily(), - 'created' => $user[0]->getCreated()->format('U'), - 'updated' => $user[0]->getUpdated()->format('U'), - 'guests' => $user[0]->getRsvp()->getGuests(), - ]; - $app->getSession()->set('user', $userSession); - $app->redirect($app->url('rsvp')); - } else { - $error = new FormError('Your password or email is incorrect.'); - $error->setOrigin($loginForm); - $loginForm->get('password')->addError($error); - - return $app->render('login.html.twig', ['form' => $loginForm->createView()]); - } - } - } - - return $app->render('login.html.twig', ['form' => $loginForm->createView()]); - } - - public function resetAction(Request $request, \Kernel $app) - { - } - - public function tokenAction(Request $request, \Kernel $app) - { - } - - public function editAction(Request $request, \Kernel $app) - { - } - - private function tokenFormGenerator(\Kernel $app) - { - return; - } - - private function updateAndSendTokenLoginLink(\Kernel $app, \Symfony\Component\Form\FormInterface $tokenForm) - { - $email = $tokenForm->get('email')->getData(); - $user = $app->getEntityManager() - ->getRepository('Sikofitt:User') - ->findByEmail($email); - if (null === $user) { - $tokenForm->get('email')->addError(new FormError('Sorry we couldn\'t find your email address.')); - - return $app->render('form/token.html.twig', ['form' => $tokenForm->createView()]); - } - $newToken = $app->getEntityManager() - ->getRepository('Sikofitt:User') - ->setUserToken($email); - if (false !== $newToken) { - $user->setUserToken($newToken); - $app->session()->set('user', $user); - - return $app->render('form/token.html.twig', ['form' => $tokenForm->createView()]); - } - $tokenForm->get('email')->addError(new FormError('An Unknown error occured. Please try again.')); - - return $app->render('form/token.html.twig', ['form' => $tokenForm->createView()]); - } -} diff --git a/src/Sikofitt/DoughnutWeddingBundle/DependencyInjection/Configuration.php b/src/Sikofitt/DoughnutWeddingBundle/DependencyInjection/Configuration.php index 5efbb0c..d00a44b 100644 --- a/src/Sikofitt/DoughnutWeddingBundle/DependencyInjection/Configuration.php +++ b/src/Sikofitt/DoughnutWeddingBundle/DependencyInjection/Configuration.php @@ -1,5 +1,23 @@ . + */ + namespace Sikofitt\DoughnutWeddingBundle\DependencyInjection; use Symfony\Component\Config\Definition\Builder\TreeBuilder; @@ -14,6 +32,7 @@ class Configuration implements ConfigurationInterface { /** * {@inheritdoc} + * * @throws \RuntimeException */ public function getConfigTreeBuilder() @@ -25,8 +44,8 @@ class Configuration implements ConfigurationInterface ->scalarNode('max_rsvps') ->isRequired() ->validate() - ->ifEmpty()->then(function() {return 40;}) - ->ifNull()->then(function() { return 40;}) + ->ifEmpty()->then(function () {return 40; }) + ->ifNull()->then(function () { return 40; }) ->end() ->end(); // Here you should define the parameters that are allowed to diff --git a/src/Sikofitt/DoughnutWeddingBundle/DependencyInjection/SikofittDoughnutWeddingExtension.php b/src/Sikofitt/DoughnutWeddingBundle/DependencyInjection/SikofittDoughnutWeddingExtension.php index 69637e1..d58aef9 100644 --- a/src/Sikofitt/DoughnutWeddingBundle/DependencyInjection/SikofittDoughnutWeddingExtension.php +++ b/src/Sikofitt/DoughnutWeddingBundle/DependencyInjection/SikofittDoughnutWeddingExtension.php @@ -1,16 +1,34 @@ . + */ + namespace Sikofitt\DoughnutWeddingBundle\DependencyInjection; -use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\Config\FileLocator; -use Symfony\Component\HttpKernel\DependencyInjection\Extension; +use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Loader; +use Symfony\Component\HttpKernel\DependencyInjection\Extension; /** * This is the class that loads and manages your bundle configuration. * - * @link http://symfony.com/doc/current/cookbook/bundles/extension.html + * @see http://symfony.com/doc/current/cookbook/bundles/extension.html */ class SikofittDoughnutWeddingExtension extends Extension { diff --git a/src/Sikofitt/DoughnutWeddingBundle/Entity/User.php b/src/Sikofitt/DoughnutWeddingBundle/Entity/User.php index 9e44699..ccbb9c6 100644 --- a/src/Sikofitt/DoughnutWeddingBundle/Entity/User.php +++ b/src/Sikofitt/DoughnutWeddingBundle/Entity/User.php @@ -21,7 +21,6 @@ namespace Sikofitt\DoughnutWeddingBundle\Entity; use Doctrine\ORM\Mapping as ORM; -use FOS\UserBundle\Model\UserInterface; use Symfony\Component\Validator\Constraints as Assert; /** @@ -46,50 +45,12 @@ class User extends \FOS\UserBundle\Model\User protected $id; /** - * @ORM\Column(name="first_name", type="string", length=255, nullable=false) + * @ORM\Column(name="fullname", type="string", length=255, nullable=false) * @Assert\NotBlank() * @Assert\Regex(pattern="/\w+/") */ - private $firstName; + private $name; - /** - * @ORM\Column(name="last_name", type="string", length=255, nullable=false) - * @Assert\NotBlank() - * @Assert\Regex(pattern="/\w+/") - */ - private $lastName; - - /** - * @ORM\Column(type="boolean", name="is_family", nullable=false) - * @Assert\Type(type="bool") - */ - private $family = false; - - //* @Assert\Choice(choices="{self::KATRINA_SIDE, self::ERIC_SIDE}", multiple=false) - /** - * @ORM\Column(type="string", name="family_side", nullable=true) - * - * @var null|string - */ - private $familySide = null; - - /* - * @ORM\Column(name="email", type="string", length=255) - * @Assert\Email(strict=true, checkHost=true, checkMX=true) - - protected $email; - */ - /* - * @var string - * @ORM\Column(name="password", type="string", length=255)) - * - protected $password; - */ - /* - * @var string - * - protected $plainPassword; - */ /** * @var string * @ORM\Column(name="reset_token", type="string", length=255, nullable=true) @@ -123,269 +84,38 @@ class User extends \FOS\UserBundle\Model\User */ private $facebookId; - private $facebookAccessToken; + private $facebookAccessToken; /** * @ORM\Column(name="google_id", type="string", length=255, nullable=true) */ private $googleId; - private $googleAccessToken; + private $googleAccessToken; /** * @ORM\Column(name="amazon_id", type="string", length=255, nullable=true) */ private $amazonId; - private $amazonAccessToken; + private $amazonAccessToken; /** * @ORM\Column(name="instagram_id", type="string", length=255, nullable=true) */ private $instagramId; - private $instagramAccessToken; + private $instagramAccessToken; /** * @ORM\Column(name="twitter_id", type="string", length=255, nullable=true) */ private $twitterId; - private $twitterAccessToken; - - /** - * @ORM\Column(name="windows_id", type="string", length=255, nullable=true) - */ - private $windowsId; - private $windowsAccessToken; + private $twitterAccessToken; /** * @ORM\Column(name="yahoo_id", type="string", length=255, nullable=true) */ private $yahooId; - private $yahooAccessToken; - - /** - * @return mixed - */ - public function getAmazonId() { - return $this->amazonId; - } - - /** - * @param mixed $amazonId - * @return User - */ - public function setAmazonId($amazonId) { - $this->amazonId = $amazonId; - return $this; - } - - /** - * @return mixed - */ - public function getAmazonAccessToken() { - return $this->amazonAccessToken; - } - - /** - * @param mixed $amazonAccessToken - * @return User - */ - public function setAmazonAccessToken($amazonAccessToken) { - $this->amazonAccessToken = $amazonAccessToken; - return $this; - } - - /** - * @return mixed - */ - public function getFacebookId() { - return $this->facebookId; - } - - /** - * @param mixed $facebookId - * @return User - */ - public function setFacebookId($facebookId) { - $this->facebookId = $facebookId; - return $this; - } - - /** - * @return mixed - */ - public function getFacebookAccessToken() { - return $this->facebookAccessToken; - } - - /** - * @param mixed $facebookAccessToken - * @return User - */ - public function setFacebookAccessToken($facebookAccessToken) { - $this->facebookAccessToken = $facebookAccessToken; - return $this; - } - - /** - * @return mixed - */ - public function getGoogleId() { - return $this->googleId; - } - - /** - * @param mixed $googleId - * @return User - */ - public function setGoogleId($googleId) { - $this->googleId = $googleId; - return $this; - } - - /** - * @return mixed - */ - public function getGoogleAccessToken() { - return $this->googleAccessToken; - } - - /** - * @param mixed $googleAccessToken - * @return User - */ - public function setGoogleAccessToken($googleAccessToken) { - $this->googleAccessToken = $googleAccessToken; - return $this; - } - - /** - * @return mixed - */ - public function getInstagramId() { - return $this->instagramId; - } - - /** - * @param mixed $instagramId - * @return User - */ - public function setInstagramId($instagramId) { - $this->instagramId = $instagramId; - return $this; - } - - /** - * @return mixed - */ - public function getInstagramAccessToken() { - return $this->instagramAccessToken; - } - - /** - * @param mixed $instagramAccessToken - * @return User - */ - public function setInstagramAccessToken($instagramAccessToken) { - $this->instagramAccessToken = $instagramAccessToken; - return $this; - } - - /** - * @return mixed - */ - public function getTwitterId() { - return $this->twitterId; - } - - /** - * @param mixed $twitterId - * @return User - */ - public function setTwitterId($twitterId) { - $this->twitterId = $twitterId; - return $this; - } - - /** - * @return mixed - */ - public function getTwitterAccessToken() { - return $this->twitterAccessToken; - } - - /** - * @param mixed $twitterAccessToken - * @return User - */ - public function setTwitterAccessToken($twitterAccessToken) { - $this->twitterAccessToken = $twitterAccessToken; - return $this; - } - - /** - * @return mixed - */ - public function getWindowsId() { - return $this->windowsId; - } - - /** - * @param mixed $windowsId - * @return User - */ - public function setWindowsId($windowsId) { - $this->windowsId = $windowsId; - return $this; - } - - /** - * @return mixed - */ - public function getWindowsAccessToken() { - return $this->windowsAccessToken; - } - - /** - * @param mixed $windowsAccessToken - * @return User - */ - public function setWindowsAccessToken($windowsAccessToken) { - $this->windowsAccessToken = $windowsAccessToken; - return $this; - } - - /** - * @return mixed - */ - public function getYahooId() { - return $this->yahooId; - } - - /** - * @param mixed $yahooId - * @return User - */ - public function setYahooId($yahooId) { - $this->yahooId = $yahooId; - return $this; - } - - /** - * @return mixed - */ - public function getYahooAccessToken() { - return $this->yahooAccessToken; - } - - /** - * @param mixed $yahooAccessToken - * @return User - */ - public function setYahooAccessToken($yahooAccessToken) { - $this->yahooAccessToken = $yahooAccessToken; - return $this; - } - + private $yahooAccessToken; public function __construct() { @@ -396,6 +126,247 @@ class User extends \FOS\UserBundle\Model\User parent::__construct(); } + /** + * @return mixed + */ + public function getAmazonId() + { + return $this->amazonId; + } + + /** + * @param mixed $amazonId + * + * @return User + */ + public function setAmazonId($amazonId) + { + $this->amazonId = $amazonId; + + return $this; + } + + /** + * @return mixed + */ + public function getAmazonAccessToken() + { + return $this->amazonAccessToken; + } + + /** + * @param mixed $amazonAccessToken + * + * @return User + */ + public function setAmazonAccessToken($amazonAccessToken) + { + $this->amazonAccessToken = $amazonAccessToken; + + return $this; + } + + /** + * @return mixed + */ + public function getFacebookId() + { + return $this->facebookId; + } + + /** + * @param mixed $facebookId + * + * @return User + */ + public function setFacebookId($facebookId) + { + $this->facebookId = $facebookId; + + return $this; + } + + /** + * @return mixed + */ + public function getFacebookAccessToken() + { + return $this->facebookAccessToken; + } + + /** + * @param mixed $facebookAccessToken + * + * @return User + */ + public function setFacebookAccessToken($facebookAccessToken) + { + $this->facebookAccessToken = $facebookAccessToken; + + return $this; + } + + /** + * @return mixed + */ + public function getGoogleId() + { + return $this->googleId; + } + + /** + * @param mixed $googleId + * + * @return User + */ + public function setGoogleId($googleId) + { + $this->googleId = $googleId; + + return $this; + } + + /** + * @return mixed + */ + public function getGoogleAccessToken() + { + return $this->googleAccessToken; + } + + /** + * @param mixed $googleAccessToken + * + * @return User + */ + public function setGoogleAccessToken($googleAccessToken) + { + $this->googleAccessToken = $googleAccessToken; + + return $this; + } + + /** + * @return mixed + */ + public function getInstagramId() + { + return $this->instagramId; + } + + /** + * @param mixed $instagramId + * + * @return User + */ + public function setInstagramId($instagramId) + { + $this->instagramId = $instagramId; + + return $this; + } + + /** + * @return mixed + */ + public function getInstagramAccessToken() + { + return $this->instagramAccessToken; + } + + /** + * @param mixed $instagramAccessToken + * + * @return User + */ + public function setInstagramAccessToken($instagramAccessToken) + { + $this->instagramAccessToken = $instagramAccessToken; + + return $this; + } + + /** + * @return mixed + */ + public function getTwitterId() + { + return $this->twitterId; + } + + /** + * @param mixed $twitterId + * + * @return User + */ + public function setTwitterId($twitterId) + { + $this->twitterId = $twitterId; + + return $this; + } + + /** + * @return mixed + */ + public function getTwitterAccessToken() + { + return $this->twitterAccessToken; + } + + /** + * @param mixed $twitterAccessToken + * + * @return User + */ + public function setTwitterAccessToken($twitterAccessToken) + { + $this->twitterAccessToken = $twitterAccessToken; + + return $this; + } + + + /** + * @return mixed + */ + public function getYahooId() + { + return $this->yahooId; + } + + /** + * @param mixed $yahooId + * + * @return User + */ + public function setYahooId($yahooId) + { + $this->yahooId = $yahooId; + + return $this; + } + + /** + * @return mixed + */ + public function getYahooAccessToken() + { + return $this->yahooAccessToken; + } + + /** + * @param mixed $yahooAccessToken + * + * @return User + */ + public function setYahooAccessToken($yahooAccessToken) + { + $this->yahooAccessToken = $yahooAccessToken; + + return $this; + } + /** * Get id. * @@ -407,51 +378,27 @@ class User extends \FOS\UserBundle\Model\User } /** - * Set firstName. + * Set Name. * - * @param string $firstName + * @param string $name * * @return User */ - public function setFirstName($firstName) + public function setName($name) { - $this->firstName = $firstName; + $this->name = $name; return $this; } /** - * Get firstName. + * Get Name. * * @return string */ - public function getFirstName() + public function getName() { - return $this->firstName; - } - - /** - * Set lastName. - * - * @param string $lastName - * - * @return User - */ - public function setLastName($lastName) - { - $this->lastName = $lastName; - - return $this; - } - - /** - * Get lastName. - * - * @return string - */ - public function getLastName() - { - return $this->lastName; + return $this->name; } /** @@ -462,53 +409,6 @@ class User extends \FOS\UserBundle\Model\User return $this->username; } - /** - * Set family. - * - * @param bool $family - * - * @return User - */ - public function setFamily($family) - { - $this->family = $family; - - return $this; - } - - /** - * Get family. - * - * @return bool - */ - public function getFamily() - { - return $this->family; - } - - /** - * Set familySide. - * - * @param string $familySide - * - * @return User - */ - public function setFamilySide($familySide) - { - $this->familySide = $familySide; - - return $this; - } - - /** - * Get familySide. - * - * @return string - */ - public function getFamilySide() - { - return $this->familySide; - } /** * Set email. @@ -582,7 +482,7 @@ class User extends \FOS\UserBundle\Model\User public function setUserToken($userToken) { $this->userToken = $userToken; - + return $this; } @@ -686,17 +586,4 @@ class User extends \FOS\UserBundle\Model\User return $this->rsvp; } - public function getRoles() - { - return ['ROLE_USER']; - } - - public function eraseCredentials() - { - } - - public function getSalt() - { - return null; - } } diff --git a/src/Sikofitt/DoughnutWeddingBundle/EventListener/RedirectOnUserRegisterListener.php b/src/Sikofitt/DoughnutWeddingBundle/EventListener/RedirectOnUserRegisterListener.php new file mode 100644 index 0000000..b15dd5c --- /dev/null +++ b/src/Sikofitt/DoughnutWeddingBundle/EventListener/RedirectOnUserRegisterListener.php @@ -0,0 +1,31 @@ +router = $router; + } + + public function onKernelRequest(FormEvent $event) + { + $url = $this->router->generate('sikofitt_doughnutwedding_default_index'); + $event->setResponse(new RedirectResponse($url)); + } +} \ No newline at end of file diff --git a/src/Sikofitt/DoughnutWeddingBundle/EventListener/UserRedirectOnLoggedInListener.php b/src/Sikofitt/DoughnutWeddingBundle/EventListener/UserRedirectOnLoggedInListener.php new file mode 100644 index 0000000..0797acb --- /dev/null +++ b/src/Sikofitt/DoughnutWeddingBundle/EventListener/UserRedirectOnLoggedInListener.php @@ -0,0 +1,113 @@ +. + */ + +namespace Sikofitt\DoughnutWeddingBundle\EventListener; + +use Symfony\Bundle\FrameworkBundle\Routing\Router; +use Symfony\Component\{ + EventDispatcher\EventDispatcherInterface, HttpFoundation\RedirectResponse, HttpKernel\Event\GetResponseEvent, Security\Core\Authentication\Token\Storage\TokenStorageInterface +}; + +class UserRedirectOnLoggedInListener +{ + /** + * @var TokenStorageInterface + */ + private $tokenStorage; + + /** + * @var Router + */ + private $router; + + /** + * UserRedirectOnLoggedInListener constructor. + * + * @param TokenStorageInterface $tokenStorage + * @param Router $router + */ + public function __construct( + TokenStorageInterface $tokenStorage, + Router $router + ) { + $this->tokenStorage = $tokenStorage; + $this->router = $router; + } + + /** + * Redirects logged in users to the profile page, from the login page. + * + * @param \Symfony\Component\HttpKernel\Event\GetResponseEvent $event + * + * @throws \InvalidArgumentException + */ + public function onKernelRequest(GetResponseEvent $event): void + { + + $token = $this->tokenStorage->getToken(); + + if (null !== $token) { + $pathInfo = $event->getRequest()->getPathInfo(); + $routeInformation = $this->router->match($pathInfo); + $profile = $this->router->generate('fos_user_profile_show'); + + if ( + true === $this->shouldRedirectRoute($routeInformation) && + null !== $token->getUser() && + false === strpos($token->getUsername(), 'anon') + ) { + $event->setResponse(new RedirectResponse($profile)); + } + } + } + + /** + * Decides if we should redirect the current route + * depending on whether or not we are logged in. + * + * @param array $routeInformation + * + * @return bool + */ + private function shouldRedirectRoute(array $routeInformation): bool + { + + return true === in_array( + $routeInformation['_route'], + $this->getRedirectRoutes(), + true + ); + } + + /** + * @return array + * Routes that we should redirect + */ + private function getRedirectRoutes(): array + { + return [ + //'fos_user_security_login', + // 'fos_user_registration_confirmed', + //'hwi_oauth_connect' + ]; + } +} diff --git a/src/Sikofitt/DoughnutWeddingBundle/Form/ProfileEditType.php b/src/Sikofitt/DoughnutWeddingBundle/Form/ProfileEditType.php new file mode 100644 index 0000000..a7ef043 --- /dev/null +++ b/src/Sikofitt/DoughnutWeddingBundle/Form/ProfileEditType.php @@ -0,0 +1,84 @@ +get('email')->getOptions(); + + $builder->remove('current_password'); + //$builder->remove('username'); + $builder->remove('email'); + $emailOptions['attr'] = [ + 'class' => 'uk-input uk-form-large uk-padding-small uk-box-shadow-hover-small', + 'placeholder' => 'Email Address', + ]; + $emailOptions['label_attr'] = [ + 'class' => 'uk-form-label uk-text-primary', + ]; + $builder->add('email', EmailType::class, $emailOptions); + $builder->add('name', TextType::class, [ + 'attr' => [ + 'class' => 'uk-input uk-form-large uk-padding-small uk-box-shadow-hover-small', + 'placeholder' => 'Name', + ], + 'label' => 'Name', + 'label_attr' => [ + 'class' => 'uk-form-label uk-text-primary', + ], + ]); + $builder->add('rsvp', IntegerType::class, [ + 'attr' => [ + 'class' => 'uk-input uk-form-large uk-padding-small uk-box-shadow-hover-small', + 'placeholder' => 'Number of Guests (including yourself)', + ], + 'label' => 'Number of guests? (including yourself)', + 'label_attr' => [ + 'class' => 'uk-form-label uk-text-primary', + ], + ]); + + $builder->get('rsvp') + ->addModelTransformer(new CallbackTransformer( + function (?Rsvp $rsvp) { + if (null === $rsvp) { + return $rsvp; + } + + return $rsvp->getGuests(); + }, + function (Int $rsvpInt) { + $rsvp = new Rsvp(); + $rsvp->setGuests($rsvpInt); + + return $rsvp; + } + )); + } + + public function getParent() + { + return ProfileFormType::class; + } +} \ No newline at end of file diff --git a/src/Sikofitt/DoughnutWeddingBundle/Form/RegistrationType.php b/src/Sikofitt/DoughnutWeddingBundle/Form/RegistrationType.php index bfbda75..9f717a0 100644 --- a/src/Sikofitt/DoughnutWeddingBundle/Form/RegistrationType.php +++ b/src/Sikofitt/DoughnutWeddingBundle/Form/RegistrationType.php @@ -1,60 +1,57 @@ . + */ + namespace Sikofitt\DoughnutWeddingBundle\Form; +use HWI\Bundle\OAuthBundle\OAuth\Response\PathUserResponse; +use Symfony\Component\Form\FormEvent; use FOS\UserBundle\Form\Type\RegistrationFormType; +use FOS\UserBundle\Model\UserManager; use Sikofitt\DoughnutWeddingBundle\Entity\Rsvp; use Sikofitt\DoughnutWeddingBundle\Entity\User; use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\CallbackTransformer; use Symfony\Component\Form\Extension\Core\Type\CheckboxType; use Symfony\Component\Form\Extension\Core\Type\ChoiceType; -use Symfony\Component\Form\Extension\Core\Type\EmailType; use Symfony\Component\Form\Extension\Core\Type\IntegerType; use Symfony\Component\Form\Extension\Core\Type\TextType; use Symfony\Component\Form\FormBuilderInterface; +use Symfony\Component\Form\FormEvents; use Symfony\Component\Form\FormInterface; use Symfony\Component\Form\FormView; use Symfony\Component\OptionsResolver\OptionsResolver; class RegistrationType extends AbstractType { + private $userManger; + + public function __construct(UserManager $userManager) + { + $this->userManger = $userManager; + } + public function buildForm(FormBuilderInterface $builder, array $options) { - - - $builder->add('first_name', TextType::class) - ->add('last_name', TextType::class) - ->add('familyside', ChoiceType::class, [ - 'choices' => [ - User::ERIC_SIDE => User::ERIC_SIDE, - User::KATRINA_SIDE => User::KATRINA_SIDE, - ], - 'attr' => [ - 'class' => 'uk-select uk-form-large uk-box-shadow-hover-small', - 'style' => 'padding-left:16px;', - ], - 'label' => 'Who are you coming for?', - 'label_attr' => [ - 'class' => 'uk-form-label uk-text-primary', - 'style' => 'font-size:1.25rem; margin-left:15px;' - ], - ]) - ->add('family', CheckboxType::class, [ - 'label' => 'Are you an immediate family member?', - 'required' => false, - 'attr' => [ - 'class' => 'uk-checkbox uk-box-shadow-hover-small', - ], - 'label_attr' => [ - 'class' => 'uk-form-label uk-text-primary', - 'style' => 'font-size:1.25rem; margin-left:15px;' - ], - ]) - + $builder->add('name', TextType::class) ->add('rsvp', IntegerType::class, [ 'attr' => [ - 'class' => 'uk-input uk-form-large uk-padding-small uk-box-shadow-hover-small', 'placeholder' => 'Number of Guests (including yourself)', ], @@ -62,31 +59,41 @@ class RegistrationType extends AbstractType 'label_attr' => [ 'class' => 'uk-form-label uk-text-primary', ], - ]); + ])->remove('username'); - $builder->get('rsvp') + $builder->addEventListener(FormEvents::SUBMIT, function(FormEvent $event) { + + $user = $event->getData(); + $user->setUsername($user->getEmail()); + $this->userManger->updateCanonicalFields($user); + }); + + $builder->get('rsvp') ->addModelTransformer(new CallbackTransformer( function (?Rsvp $rsvp) { - if (null === $rsvp) { - return $rsvp; - } - return $rsvp->getGuests(); + if (null === $rsvp) { + return $rsvp; + } + + return $rsvp->getGuests(); }, function (Int $rsvpInt) { - $rsvp = new Rsvp(); - $rsvp->setGuests($rsvpInt); - return $rsvp; + $rsvp = new Rsvp(); + $rsvp->setGuests($rsvpInt); + + return $rsvp; } )); } public function configureOptions(OptionsResolver $resolver) { - $resolver->setDefault('attr', ['class' => 'uk-form uk-form-horizontal']); - + $resolver->setDefault('attr', ['class' => 'uk-form uk-form-horizontal']); } - public function getParent() { - return RegistrationFormType::class; + + public function getParent() + { + return RegistrationFormType::class; } public function finishView( @@ -94,11 +101,13 @@ class RegistrationType extends AbstractType FormInterface $form, array $options ) { - $view->children['email']->vars['attr']['class'] = 'uk-input'; - $view->children['email']->vars['label_attr']['class'] = 'uk-form-label'; + $view->children['email']->vars['attr']['class'] = 'uk-input'; + $view->children['email']->vars['label_attr']['class'] = 'uk-form-label'; + $p = new PathUserResponse(); + //$p->getResourceOwner()->getName(); } - public function getBlockPrefix() + public function getBlockPrefix() { return 'sikofitt_doughnut_wedding_bundle_registration_type'; } diff --git a/src/Sikofitt/DoughnutWeddingBundle/Form/RsvpType.php b/src/Sikofitt/DoughnutWeddingBundle/Form/RsvpType.php index 8e60d3b..c79f323 100644 --- a/src/Sikofitt/DoughnutWeddingBundle/Form/RsvpType.php +++ b/src/Sikofitt/DoughnutWeddingBundle/Form/RsvpType.php @@ -93,7 +93,6 @@ class RsvpType extends AbstractType ]) ->add('familyside', ChoiceType::class, [ 'choices' => [ - User::ERIC_SIDE => User::ERIC_SIDE, User::KATRINA_SIDE => User::KATRINA_SIDE, ], @@ -111,11 +110,10 @@ class RsvpType extends AbstractType 'required' => false, 'attr' => [ 'class' => 'uk-checkbox uk-box-shadow-hover-small', - 'style' => 'padding-left:16px;' + 'style' => 'padding-left:16px;', ], 'label_attr' => [ 'class' => 'uk-form-label uk-text-primary', - ], ]); $builder->get('rsvp') diff --git a/src/Sikofitt/DoughnutWeddingBundle/Resources/translations/SikofittDoughnutweddingBundle.en.yml b/src/Sikofitt/DoughnutWeddingBundle/Resources/translations/SikofittDoughnutweddingBundle.en.yml new file mode 100644 index 0000000..9778413 --- /dev/null +++ b/src/Sikofitt/DoughnutWeddingBundle/Resources/translations/SikofittDoughnutweddingBundle.en.yml @@ -0,0 +1 @@ +profile.name: Name \ No newline at end of file diff --git a/src/Sikofitt/DoughnutWeddingBundle/SikofittDoughnutWeddingBundle.php b/src/Sikofitt/DoughnutWeddingBundle/SikofittDoughnutWeddingBundle.php index 522a2e9..4e343f1 100644 --- a/src/Sikofitt/DoughnutWeddingBundle/SikofittDoughnutWeddingBundle.php +++ b/src/Sikofitt/DoughnutWeddingBundle/SikofittDoughnutWeddingBundle.php @@ -1,5 +1,23 @@ . + */ + namespace Sikofitt\DoughnutWeddingBundle; use Symfony\Component\HttpKernel\Bundle\Bundle; diff --git a/src/Sikofitt/DoughnutWeddingBundle/Tests/Controller/DefaultControllerTest.php b/src/Sikofitt/DoughnutWeddingBundle/Tests/Controller/DefaultControllerTest.php index c33ee11..fcbfd4b 100644 --- a/src/Sikofitt/DoughnutWeddingBundle/Tests/Controller/DefaultControllerTest.php +++ b/src/Sikofitt/DoughnutWeddingBundle/Tests/Controller/DefaultControllerTest.php @@ -1,5 +1,23 @@ . + */ + namespace Sikofitt\DoughnutWeddingBundle\Tests\Controller; use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; @@ -12,5 +30,4 @@ class DefaultControllerTest extends WebTestCase $crawler = $client->request('GET', '/'); } - } diff --git a/src/Sikofitt/DoughnutWeddingBundle/Tests/Controller/ImageControllerTest.php b/src/Sikofitt/DoughnutWeddingBundle/Tests/Controller/ImageControllerTest.php index 72e45dd..f2aaf69 100644 --- a/src/Sikofitt/DoughnutWeddingBundle/Tests/Controller/ImageControllerTest.php +++ b/src/Sikofitt/DoughnutWeddingBundle/Tests/Controller/ImageControllerTest.php @@ -1,5 +1,23 @@ . + */ + namespace Sikofitt\DoughnutWeddingBundle\Tests\Controller; use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; @@ -33,5 +51,4 @@ class ImageControllerTest extends WebTestCase $crawler = $client->request('GET', '/category'); } - } diff --git a/var/SymfonyRequirements.php b/var/SymfonyRequirements.php old mode 100644 new mode 100755 diff --git a/web/app_dev.php b/web/app_dev.php index e76fcac..10e556e 100644 --- a/web/app_dev.php +++ b/web/app_dev.php @@ -10,13 +10,13 @@ use Symfony\Component\Debug\Debug; // This check prevents access to debug front controllers that are deployed by accident to production servers. // Feel free to remove this, extend it, or make something more sophisticated. -if (isset($_SERVER['HTTP_CLIENT_IP']) +/*if (isset($_SERVER['HTTP_CLIENT_IP']) || isset($_SERVER['HTTP_X_FORWARDED_FOR']) || !(in_array(@$_SERVER['REMOTE_ADDR'], ['172.19.0.1','127.0.0.1', '::1']) || php_sapi_name() === 'cli-server') ) { header('HTTP/1.0 403 Forbidden'); exit('You are not allowed to access this file. Check '.basename(__FILE__).' for more information.'); -} +}*/ /** @var \Composer\Autoload\ClassLoader $loader */ $loader = require __DIR__.'/../app/autoload.php'; diff --git a/web/config.php b/web/config.php index 69df43c..b96786b 100644 --- a/web/config.php +++ b/web/config.php @@ -14,13 +14,13 @@ if (!isset($_SERVER['HTTP_HOST'])) { exit('This script cannot be run from the CLI. Run it from a browser.'); } -if (!in_array(@$_SERVER['REMOTE_ADDR'], array( - '127.0.0.1', - '::1', -))) { - header('HTTP/1.0 403 Forbidden'); - exit('This script is only accessible from localhost.'); -} +//if (!in_array(@$_SERVER['REMOTE_ADDR'], array( +// '127.0.0.1', +// '::1', +//))) { +// header('HTTP/1.0 403 Forbidden'); +// exit('This script is only accessible from localhost.'); +//} require_once dirname(__FILE__).'/../var/SymfonyRequirements.php';