OAuth integration

This commit is contained in:
R. Eric Wheeler 2017-04-22 12:43:30 -07:00
parent 7a98daf886
commit 10bf90bd93
51 changed files with 1017 additions and 807 deletions

View File

@ -52,6 +52,13 @@ module.exports = function (grunt) {
src: ['*.css', '!*.min.css'], src: ['*.css', '!*.min.css'],
dest: 'build/dist/css', dest: 'build/dist/css',
ext: '.min.css' ext: '.min.css'
},
{
expand: true,
cwd: 'build/css',
src: ['*.css', '!*.min.css'],
dest: 'build/dist/css',
ext: '.min.css'
}] }]
} }
}, },
@ -134,7 +141,7 @@ module.exports = function (grunt) {
'build/dist', 'build/dist',
'web/js/*.js', 'web/js/*.js',
'web/css/*.css', 'web/css/*.css',
'web/images/*.svg' 'web/images/*'
] ]
}); });

View File

@ -1,5 +1,23 @@
<?php <?php
/*
* doughnutwedding.com
* Copyright (C) 2017 http://doughnutwedding.com eric@doughnutwedding.com
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
use Symfony\Bundle\FrameworkBundle\HttpCache\HttpCache; use Symfony\Bundle\FrameworkBundle\HttpCache\HttpCache;
class AppCache extends HttpCache class AppCache extends HttpCache

View File

@ -1,13 +1,30 @@
<?php <?php
use Symfony\Component\HttpKernel\Kernel; /*
* doughnutwedding.com
* Copyright (C) 2017 http://doughnutwedding.com eric@doughnutwedding.com
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
use Symfony\Component\Config\Loader\LoaderInterface; use Symfony\Component\Config\Loader\LoaderInterface;
use Symfony\Component\HttpKernel\Kernel;
class AppKernel extends Kernel class AppKernel extends Kernel
{ {
public function registerBundles() public function registerBundles()
{ {
$bundles = [ $bundles = [
new Symfony\Bundle\FrameworkBundle\FrameworkBundle(), new Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
new Symfony\Bundle\SecurityBundle\SecurityBundle(), new Symfony\Bundle\SecurityBundle\SecurityBundle(),

View File

@ -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" %} {% include "@FOSUser/Profile/edit_content.html.twig" %}
{% endblock fos_user_content %} {% endblock body %}

View File

@ -1,8 +1,29 @@
{% trans_default_domain 'FOSUserBundle' %} {% trans_default_domain 'FOSUserBundle' %}
{% if form.vars.errors is not empty %}
<div class="uk-alert uk-alert-danger">
{{ form_errors(form) }}
{{ form_start(form, { 'action': path('fos_user_profile_edit'), 'attr': { 'class': 'fos_user_profile_edit' } }) }}
{{ form_widget(form) }}
<div>
<input type="submit" value="{{ 'profile.edit.submit'|trans }}" />
</div> </div>
{% endif %}
{{ form_start(form, { 'action': path('fos_user_profile_edit'), 'attr': { 'class': 'uk-form-horizontal fos_user_profile_edit' } }) }}
{{ form_label(form.email) }}
<div class="uk-form-controls uk-form-controls-text">
{{ form_widget(form.email) }}
</div>
{{ form_label(form.name) }}
<div class="uk-form-controls uk-form-controls-text">
{{ form_widget(form.name) }}
</div>
{{ form_label(form.rsvp) }}
<div class="uk-form-controls uk-form-controls-text">
{{ form_widget(form.rsvp) }}
</div>
<div class="uk-form-controls uk-margin-medium-top">
<input type="submit" class="uk-button uk-button-large uk-width-1-1@s uk-width-1-3@m uk-align-right uk-button-primary" value="{{ 'profile.edit.submit'|trans }}" />
</div>
<div class="uk-form-controls">
<a href="{{ url('fos_user_profile_show') }}" title="Cancel" class="uk-width-1-1@s uk-width-1-3@m uk-button uk-button-large uk-button-danger uk-align-right">Cancel</a>
</div>
{{ form_rest(form) }}
{{ form_end(form) }} {{ form_end(form) }}

View File

@ -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" %} {% include "@FOSUser/Profile/show_content.html.twig" %}
{% endblock fos_user_content %} {% endblock body %}

View File

@ -1,6 +1,31 @@
{% trans_default_domain 'FOSUserBundle' %} {% trans_default_domain 'SikofittDoughnutweddingBundle' %}
<h2 class="uk-width-1-1 uk-margin-medium-bottom uk-text-center">User Information</h2>
<div class="fos_user_user_show"> <div class="uk-width-1-1 uk-text-center uk-grid-divider uk-child-width-1-2" uk-grid>
<p>{{ 'profile.show.username'|trans }}: {{ user.username }}</p>
<p>{{ 'profile.show.email'|trans }}: {{ user.email }}</p> <div><p class="uk-padding-small uk-text-right">{{ 'profile.name'|trans }}</p></div>
<div><p class="uk-padding-small uk-text-left">{{ user.name }}</p></div>
<div><p class="uk-padding-small uk-text-right">{{ 'profile.email'|trans }}</p></div>
<div><p class="uk-padding-small uk-text-left">{{ user.email }}</p></div>
<div><p class="uk-padding-small uk-text-right">{{ 'profile.rsvp'|trans }}</p></div>
<div><p class="uk-padding-small uk-text-left">{% if user.rsvp is not null %}{{ user.rsvp.guests }}{% else %}0{% endif %}</p></div>
<div class="uk-width-1-2@m uk-width-1-1@s uk-align-center uk-margin-small uk-grid-margin uk-first-column">
<a href="{{ url('fos_user_profile_edit') }}" title="Edit profile" class="uk-button-large uk-button uk-button-primary uk-width-1-1">Edit Information</a></div>
</div> </div>
<div class="uk-width-1-6@m uk-visible@m uk-margin-large-top uk-position-center-right">
<ul class="uk-iconnav uk-iconnav-vertical">
<li>
<a {% if user.facebookid is not null %} style="color:#0b97c4;" {% endif %}class="uk-align-left uk-text-center uk-login uk-login-facebook" href="{{ url("hwi_oauth_service_redirect", {service: "facebook"}) }}" uk-icon="icon: facebook; ratio:1.5"></a>
</li>
<li><a class="uk-align-left uk-text-center uk-login uk-login-google" href="{{ url("hwi_oauth_service_redirect", {service: "google"}) }}" uk-icon="icon: google; ratio:1.5"></a></li>
<li><a class="uk-align-left uk-text-center uk-login uk-login-twitter" href="{{ url("hwi_oauth_service_redirect", {service: "twitter"}) }}" uk-icon="icon: twitter; ratio:1.5"></a></li>
<li><a href="{{ url("hwi_oauth_service_redirect", {service: "yahoo"}) }}" class="uk-align-left uk-icon-image uk-align-center uk-login uk-login-yahoo"><img height="30" width="30" src="{{ asset('images/yahoo.svg') }}" uk-svg></a></li>
<li><a href="{{ url("hwi_oauth_service_redirect", {service: "amazon"}) }}" class="uk-align-left uk-icon-image uk-align-center uk-login uk-login-amazon"><img height="30" width="30" src="{{ asset('images/amazon.svg') }}" uk-svg></a></li>
<li><a class="uk-align-left uk-text-center uk-login uk-login-instagram" href="{{ url("hwi_oauth_service_redirect", {service: "instagram"}) }}" uk-icon="icon: instagram; ratio:1.5"></a></li>
</ul>
</div>
<div class="uk-margin-medium uk-width-1-1 uk-text-center">{{ 'profile.member_since'|trans({'%date%':user.created|date('l F jS, Y (h:i a)')}) }}</div>

View File

@ -1,10 +1,11 @@
{% extends "@FOSUser/layout.html.twig" %} {% extends "base.html.twig" %}
{% trans_default_domain 'FOSUserBundle' %} {% trans_default_domain 'FOSUserBundle' %}
{% block fos_user_content %} {% block body %}
<p>{{ 'registration.confirmed'|trans({'%username%': user.username}) }}</p> <p class="uk-text-lead uk-text-center">{{ 'registration.confirmed'|trans({'%username%': user.firstname }) }}</p>
<p class="uk-text-large uk-text-center"><a href="{{ url('sikofitt_doughnutwedding_default_index') }}" title="Home page">Continue to the home page.</a></p>
{% if targetUrl %} {% if targetUrl %}
<p><a href="{{ targetUrl }}">{{ 'registration.back'|trans }}</a></p> <p class="uk-text-center"><a href="{{ targetUrl }}">{{ 'registration.back'|trans }}</a></p>
{% endif %} {% endif %}
{% endblock fos_user_content %} {% endblock body %}

View File

@ -2,6 +2,7 @@
<div class="uk-width-1-1"> <div class="uk-width-1-1">
{{ form_errors(form) }} {{ form_errors(form) }}
</div> </div>
{{ dump(app.session) }}
{{ form_start(form, {'method': 'post', 'action': path('fos_user_registration_register'), 'attr': {'class': 'fos_user_registration_register uk-form'}}) }} {{ form_start(form, {'method': 'post', 'action': path('fos_user_registration_register'), 'attr': {'class': 'fos_user_registration_register uk-form'}}) }}
<fieldset class="uk-fieldset"> <fieldset class="uk-fieldset">
<legend class="uk-legend"> <legend class="uk-legend">
@ -14,43 +15,12 @@
</div> </div>
</div> </div>
<div class="uk-margin"> <div class="uk-margin">
<div hidden>{{ form_label(form.username, 'Username', { 'label_attr':{'class':'uk-form-label'}}) }}</div> <div hidden>{{ form_label(form.name, 'Name', { 'label_attr':{'class':'uk-form-label'}}) }}</div>
<div class="uk-form-controls uk-form-controls-text"> <div class="uk-form-controls uk-form-controls-text">
{{ 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'} }) }}
</div> </div>
</div> </div>
<div class="uk-margin">
<div hidden>{{ form_label(form.first_name, 'First name', { 'label_attr':{'class':'uk-form-label'}}) }}</div>
<div class="uk-form-controls uk-form-controls-text">
{{ form_widget(form.first_name, { 'attr': {'placeholder':'First name', 'class':'uk-input uk-form-large uk-padding-small'} }) }}
</div>
</div>
<div class="uk-margin">
<div hidden>{{ form_label(form.last_name, 'Last name', { 'label_attr':{'class':'uk-form-label'}}) }}</div>
<div class="uk-form-controls uk-form-controls-text">
{{ form_widget(form.last_name, { 'attr': {'placeholder':'Last name', 'class':'uk-input uk-input uk-form-large uk-padding-small'} }) }}
</div>
</div>
<div class="uk-margin uk-grid" uk-grid>
<div class="uk-width-2-3">
{{ form_label(form.familyside) }}
</div>
<div class="uk-width-1-3">
<div class="uk-form-controls uk-form-controls-text">
{{ form_widget(form.familyside) }}
</div>
</div>
</div>
<div class="uk-margin uk-grid" uk-grid>
<div class="uk-width-3-4 uk-width-2-3@m">
{{ form_label(form.family) }}
</div>
<div class="uk-width-1-4@s uk-width-1-4 uk-width-1-3@m uk-form-controls">
{{ form_widget(form.family, { 'attr': {'class':'uk-checkbox'} }) }}
</div>
</div>
<div class="uk-margin"> <div class="uk-margin">
<div hidden>{{ form_label(form.rsvp) }}</div> <div hidden>{{ form_label(form.rsvp) }}</div>
<div class="uk-form-controls uk-form-controls-text"> <div class="uk-form-controls uk-form-controls-text">

View File

@ -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" %} {% include "@FOSUser/Resetting/request_content.html.twig" %}
{% endblock fos_user_content %} {% endblock body %}

View File

@ -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') }} {{ include('@FOSUser/Security/login_content.html.twig') }}
{% endblock fos_user_content %} {% endblock body %}

View File

@ -4,19 +4,32 @@
<div>{{ error.messageKey|trans(error.messageData, 'security') }}</div> <div>{{ error.messageKey|trans(error.messageData, 'security') }}</div>
{% endif %} {% endif %}
<form action="{{ path("fos_user_security_check") }}" method="post"> <form action="{{ path("fos_user_security_check") }}" method="post" class="uk-login-form uk-form uk-form-stacked">
{% if csrf_token %} {% if csrf_token %}
<input type="hidden" name="_csrf_token" value="{{ csrf_token }}" /> <input type="hidden" name="_csrf_token" value="{{ csrf_token }}" />
{% endif %} {% endif %}
<div class="uk-child-width-1-1@s uk-width-1-2@m uk-align-center uk-grid-collapse uk-grid uk-grid-stack" uk-grid>
<div>
<label class="uk-form-label uk-hidden" for="username">{{ 'security.login.username'|trans }}</label>
<div class="uk-inline uk-width-1-1 uk-form-controls uk-form-controls-text">
<span class="uk-form-icon" uk-icon="icon: user"></span>
<input type="text" placeholder="Username or Email" class="uk-input uk-form-large" id="username" name="_username" value="{{ last_username }}" required="required" />
</div>
</div>
<div>
<label class="uk-form-label uk-hidden" for="password">{{ 'security.login.password'|trans }}</label>
<div class="uk-inline uk-width-1-1 uk-form-controls uk-form-controls-text">
<span class="uk-form-icon" uk-icon="icon: lock"></span>
<label for="username">{{ 'security.login.username'|trans }}</label> <input class="uk-input uk-form-large" placeholder="Password" type="password" id="password" name="_password" required="required" />
<input type="text" id="username" name="_username" value="{{ last_username }}" required="required" /> </div>
</div>
<label for="password">{{ 'security.login.password'|trans }}</label> <div class="uk-form-controls uk-child-width-1-2@m uk-child-width-1-1@s uk-padding-remove-horizontal uk-padding-small uk-grid-collapse" uk-grid>
<input type="password" id="password" name="_password" required="required" /> <div><input type="submit" class="uk-button uk-button-large uk-button-primary uk-width-1-1@s uk-align-left@m" id="_submit" name="_submit" value="{{ 'security.login.submit'|trans }}" /></div>
<div class="uk-text-right uk-margin-small-top uk-form-controls">
<input type="checkbox" id="remember_me" name="_remember_me" value="on" />
<label for="remember_me">{{ 'security.login.remember_me'|trans }}</label> <label for="remember_me">{{ 'security.login.remember_me'|trans }}</label>
<input type="checkbox" class="uk-checkbox uk-margin-medium-left" id="remember_me" name="_remember_me" value="on" /></div>
</div>
</div>
<input type="submit" id="_submit" name="_submit" value="{{ 'security.login.submit'|trans }}" />
</form> </form>

View File

@ -1,24 +1,27 @@
{% extends 'HWIOAuthBundle::layout.html.twig' %} {% extends 'base.html.twig' %}
{% block hwi_oauth_content %} {% block body %}
<h3>{{ 'header.connecting' | trans({}, 'HWIOAuthBundle')}}</h3> <h3>{{ 'header.connecting' | trans({}, 'HWIOAuthBundle')}}</h3>
<div class="row"> <div class="uk-width-1-1">
<div class="span6">
<p>{{ 'connect.confirm.text' | trans({'%service%': service | trans({}, 'HWIOAuthBundle'), '%name%': userInformation.realName}, 'HWIOAuthBundle') }}</p> <p>{{ 'connect.confirm.text' | trans({'%service%': service | trans({}, 'HWIOAuthBundle'), '%name%': userInformation.email}, 'HWIOAuthBundle') }}</p>
<p> <p>
{{ form_start(form, {'action': path('hwi_oauth_connect_service', {'service': service, 'key': key}), 'attr': {'class': 'fos_user_registration_register'}}) }} {{ form_start(form, {'action': path('hwi_oauth_connect_service', {'service': service, 'key': key}), 'attr': {'class': 'fos_user_registration_register'}}) }}
{{ form_widget(form) }} {{ form_widget(form) }}
<div class="uk-grid uk-child-width-1-2@m uk-child-width-1-1@s uk-grid-margin-medium" uk-grid>
<div> <div>
<button type="submit" class="btn btn-primary">{{ 'connect.confirm.submit' | trans({}, 'HWIOAuthBundle') }}</button> <button type="submit" class="uk-width-1-1 uk-button uk-button-large uk-button-primary">{{ 'connect.confirm.submit' | trans({}, 'HWIOAuthBundle') }}</button>
<a href="{{ path('hwi_oauth_connect') }}" class="btn">{{ 'connect.confirm.cancel' | trans({}, 'HWIOAuthBundle') }}</a> </div>
<div>
<a href="{{ path('fos_user_profile_show') }}" class="uk-width-1-1 uk-button uk-button-large uk-button-danger">{{ 'connect.confirm.cancel' | trans({}, 'HWIOAuthBundle') }}</a>
</div>
</div> </div>
{{ form_end(form) }} {{ form_end(form) }}
</p> </p>
</div>
<div class="span6"> <div class="span6">
{% if userInformation.profilePicture is defined and userInformation.profilePicture is not empty %} {% if userInformation.profilePicture is defined and userInformation.profilePicture is not empty %}
<img src="{{ userInformation.profilePicture }}" /> <img src="{{ userInformation.profilePicture }}" />
{% endif %} {% endif %}
</div> </div>
</div> </div>
{% endblock hwi_oauth_content %} {% endblock body %}

View File

@ -1,22 +1,30 @@
{% extends 'HWIOAuthBundle::layout.html.twig' %} {% extends 'base.html.twig' %}
{% block hwi_oauth_content %} {% block body %}
<h3>{{ 'header.register' | trans({'%name%': userInformation.realName}, 'HWIOAuthBundle') }}</h3> <div class="uk-width-1-1">
<div class="row"> {{ dump(userInformation) }}
<div class="span6"> </div>
{{ form_start(form, {'action': path('hwi_oauth_connect_registration', {'key': key}), 'attr': {'class': 'hwi_oauth_registration_register'}}) }} {% if userInformation.resourceOwner.name == 'yahoo' %}
{% set name = userInformation.nickname %}
{% else %}
{% set name = userInformation.email %}
{% endif %}
<h3>{{ 'header.register' | trans({'%name%': name }, 'HWIOAuthBundle') }}</h3>
{{ 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) }} {{ form_widget(form) }}
<div> <div>
<button type="submit" class="btn btn-primary">{{ 'connect.registration.submit'|trans({}, 'HWIOAuthBundle') }}</button> <button type="submit" class="btn btn-primary">{{ 'connect.registration.submit'|trans({}, 'HWIOAuthBundle') }}</button>
<a href="{{ path('hwi_oauth_connect') }}" class="btn">{{ 'connect.registration.cancel' | trans({}, 'HWIOAuthBundle') }}</a> <a href="{{ path('hwi_oauth_connect') }}" class="btn">{{ 'connect.registration.cancel' | trans({}, 'HWIOAuthBundle') }}</a>
</div> </div>
{{ form_end(form) }} {{ form_end(form) }}
</div>
<div class="span6">
{% if userInformation.profilePicture is not empty %} {% if userInformation.profilePicture is not empty %}
<img src="{{ userInformation.profilePicture }}" /> <img src="{{ userInformation.profilePicture }}" />
{% endif %} {% endif %}
</div>
</div> </div>
{% endblock hwi_oauth_content %} {% endblock body %}

View File

@ -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%!

View File

@ -0,0 +1 @@
profile.name: Name

View File

@ -0,0 +1 @@
profile.name: Name

View File

@ -8,6 +8,7 @@
<title>Title</title> <title>Title</title>
<meta name="viewport" id="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=10.0,initial-scale=1.0"> <meta name="viewport" id="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=10.0,initial-scale=1.0">
<link rel="stylesheet" type="text/css" href="{{ asset('css/doughnutwedding.min.css') }}" /> <link rel="stylesheet" type="text/css" href="{{ asset('css/doughnutwedding.min.css') }}" />
<link href="https://fonts.googleapis.com/css?family=Raleway:200,300" rel="stylesheet">
<link rel="stylesheet" type="text/css" href="{{ asset('css/select2.min.css') }}" /> <link rel="stylesheet" type="text/css" href="{{ asset('css/select2.min.css') }}" />
<script src="{{ asset('js/vendor.min.js') }}" type="text/javascript"></script> <script src="{{ asset('js/vendor.min.js') }}" type="text/javascript"></script>
<script src="{{ asset('js/doughnutwedding.min.js') }}" type="text/javascript"></script> <script src="{{ asset('js/doughnutwedding.min.js') }}" type="text/javascript"></script>
@ -16,8 +17,17 @@
{% block debug %}{% endblock %} {% block debug %}{% endblock %}
<div class="uk-container-small uk-container uk-margin-large-top uk-margin-large-bottom"> <div class="uk-container-small uk-container uk-margin-large-top uk-margin-large-bottom">
<div class="uk-responsive-width uk-width-3-4 uk-align-center">
<div class="uk-logo uk-animation-scale-up uk-transform-origin-top-center">
<a href="{{ path('sikofitt_doughnutwedding_default_index') }}"><img src="{{ asset('images/logo.png') }}" /></a>
</div>
</div>
{% include 'flash_messages.html.twig' %} {% include 'flash_messages.html.twig' %}
{% block body %}{% endblock %} {% block body %}{% endblock %}
<a href="{{ path('fos_user_registration_check_email') }}">check</a>
<a href="{{ path('fos_user_change_password') }}">check</a>
<a href="{{ path('fos_user_resetting_check_email') }}">check</a>
{% include "social_login.html.twig" %} {% include "social_login.html.twig" %}
{% block footer %}{% endblock %} {% block footer %}{% endblock %}
</div> </div>

View File

@ -4,16 +4,26 @@
{% block body %} {% block body %}
<div class="uk-child-width-1-3@s uk-grid-small" uk-grid> <div class="uk-child-width-1-3@s uk-grid-small" uk-grid>
<div> <div>
<div class="uk-background-cover uk-margin-small-bottom uk-height-small uk-card uk-card-default uk-card-body uk-flex uk-flex-center uk-flex-middle" style="background-image:url(http://placekitten.com/g/500/500);"> <div class="uk-inline uk-transition-toggle uk-cover-container uk-height-large uk-card uk-card-default uk-card-body uk-flex uk-flex-center uk-flex-middle">
<img src="http://placekitten.com/g/305/450" class="uk-position-cover uk-width-1-1 uk-height-large" />
<div class="uk-dark uk-overlay uk-overlay-primary uk-width-responsive uk-margin-large-top uk-position-center">
<h2>About Us</h2>
</div> </div>
<div class="uk-transition-fade uk-background-cover uk-position-cover" style="background-image:url(http://placekitten.com/g/305/451)">
<a href="#" class="uk-display-inline-block uk-position-cover"></a>
</div>
</div>
</div>
<div>
<div class="uk-background-cover uk-margin-small-bottom uk-height-small uk-card uk-card-default uk-card-body uk-flex uk-flex-center uk-flex-middle" style="background-image:url(http://placekitten.com/g/500/500);"></div>
<div class="uk-height-small uk-card uk-card-default uk-card-body uk-flex uk-flex-center uk-flex-middle">Small2</div> <div class="uk-height-small uk-card uk-card-default uk-card-body uk-flex uk-flex-center uk-flex-middle">Small2</div>
</div> </div>
<div> <div>
<div class="uk-height-medium uk-card uk-card-default uk-card-body uk-flex uk-flex-center uk-flex-middle">Medium</div> <div class="uk-height-medium uk-card uk-card-default uk-card-body uk-flex uk-flex-center uk-flex-middle">Medium</div>
</div> </div>
<div>
<div class="uk-height-large uk-card uk-card-default uk-card-body uk-flex uk-flex-center uk-flex-middle">Large</div>
</div>
</div> </div>
{% endblock %} {% endblock %}

View File

@ -1,7 +1,11 @@
{% if(is_granted('IS_AUTHENTICATED_ANONYMOUSLY') and hide_social is not defined ) %} {% if(not is_granted('IS_AUTHENTICATED_FULLY')) %}
<div class="uk-width-1-1 uk-padding-small uk-align-center"> <div class="uk-width-1-1 uk-padding-small uk-align-center">
<h4 class="uk-heading-line uk-text-center"><span><a href="{{ url('fos_user_security_login') }}" title="Login">Login</a></span></h4> <h4 class="uk-heading-line uk-text-center">
<span>
<a href="{{ url('fos_user_security_login') }}" title="Login">Login</a> <span class="uk-margin-small-left uk-margin-small-right" uk-icon="icon: social"></span> <a href="{{ url('fos_user_registration_register') }}" title="Register">Register</a>
</span>
</h4>
<ul class="uk-iconnav uk-grid uk-child-width-1-6" uk-grid> <ul class="uk-iconnav uk-grid uk-child-width-1-6" uk-grid>
<li> <li>
<a class="uk-text-center uk-login uk-login-facebook" href="{{ url("hwi_oauth_service_redirect", {service: "facebook"}) }}" uk-icon="icon: facebook; ratio:1.5"></a> <a class="uk-text-center uk-login uk-login-facebook" href="{{ url("hwi_oauth_service_redirect", {service: "facebook"}) }}" uk-icon="icon: facebook; ratio:1.5"></a>

View File

@ -1,7 +1,25 @@
<?php <?php
use Doctrine\Common\Annotations\AnnotationRegistry; /*
* doughnutwedding.com
* Copyright (C) 2017 http://doughnutwedding.com eric@doughnutwedding.com
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
use Composer\Autoload\ClassLoader; use Composer\Autoload\ClassLoader;
use Doctrine\Common\Annotations\AnnotationRegistry;
/** @var ClassLoader $loader */ /** @var ClassLoader $loader */
$loader = require __DIR__.'/../vendor/autoload.php'; $loader = require __DIR__.'/../vendor/autoload.php';

View File

@ -149,15 +149,11 @@ hwi_oauth:
type: twitter type: twitter
client_id: 'YmXGQN2Az0eTlkwJrnaO2wR9r' client_id: 'YmXGQN2Az0eTlkwJrnaO2wR9r'
client_secret: 'c73cBI7uj562BU4bBSHfNDcKHgM5aVo8sousjgUdDNBZFXxFHI' client_secret: 'c73cBI7uj562BU4bBSHfNDcKHgM5aVo8sousjgUdDNBZFXxFHI'
windows:
type: windows_live
client_id: 'f9dc3dd7-1b1c-4b8c-acdf-f40611ab550d'
client_secret: 'fy5prOcKeLKNTB616WinrPt'
scope: wl.signin
yahoo: yahoo:
type: yahoo type: yahoo
client_id: 'dj0yJmk9SndXWm05Tk5yME9MJmQ9WVdrOVRYTkVUVWRHTjJjbWNHbzlNQS0tJnM9Y29uc3VtZXJzZWNyZXQmeD1lMw--' client_id: 'dj0yJmk9SndXWm05Tk5yME9MJmQ9WVdrOVRYTkVUVWRHTjJjbWNHbzlNQS0tJnM9Y29uc3VtZXJzZWNyZXQmeD1lMw--'
client_secret: '4f837f738d6c4df38eaedc7babe4d8f405f8cc0f' client_secret: '4f837f738d6c4df38eaedc7babe4d8f405f8cc0f'
scope: 'sdps-r'
fosub: fosub:
# try 30 times to check if a username is available (foo, foo1, foo2 etc) # try 30 times to check if a username is available (foo, foo1, foo2 etc)
username_iterations: 30 username_iterations: 30
@ -169,21 +165,33 @@ hwi_oauth:
amazon: amazonId amazon: amazonId
instagram: instagramId instagram: instagramId
twitter: twitterId twitter: twitterId
windows_live: windowsId
yahoo: yahooId yahoo: yahooId
# if you want to use 'connect' and do not use the FOSUB integration, configure these separately # if you want to use 'connect' and do not use the FOSUB integration, configure these separately
connect: ~ connect:
confirmation: false
fos_user: fos_user:
db_driver: orm # other valid values are 'mongodb' and 'couchdb' db_driver: orm # other valid values are 'mongodb' and 'couchdb'
firewall_name: secured_area firewall_name: secured_area
user_class: Sikofitt\DoughnutWeddingBundle\Entity\User user_class: Sikofitt\DoughnutWeddingBundle\Entity\User
from_email: from_email:
address: noreply@doughnutwedding.com address: 'noreply@doughnutwedding.com'
sender_name: "No Reply" sender_name: "[Doughnut Wedding] No Reply"
profile:
form:
type: Sikofitt\DoughnutWeddingBundle\Form\ProfileEditType
registration: registration:
form: form:
type: Sikofitt\DoughnutWeddingBundle\Form\RegistrationType 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: sikofitt_doughnut_wedding:
max_rsvps: ~ max_rsvps: ~

View File

@ -38,4 +38,7 @@ monolog:
# level: info # level: info
#swiftmailer: #swiftmailer:
# delivery_addresses: ['me@example.com'] # disable_delivery: true
# transport: smtp
# delivery_addresses: ['info@doughnutwedding.com']
# sender_address: 'noreply@doughnutwedding.com'

View File

@ -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"
}

View File

@ -8,7 +8,7 @@ hwi_oauth_connect:
hwi_oauth_login: hwi_oauth_login:
resource: "@HWIOAuthBundle/Resources/config/routing/login.xml" resource: "@HWIOAuthBundle/Resources/config/routing/login.xml"
prefix: /login/oauth prefix: /connect
facebook_login: facebook_login:
path: /login/callback/facebook path: /login/callback/facebook
@ -16,8 +16,6 @@ google_login:
path: /login/callback/google path: /login/callback/google
twitter_login: twitter_login:
path: /login/callback/twitter path: /login/callback/twitter
windows_login:
path: /login/callback/windows
instagram_login: instagram_login:
path: /login/callback/instagram path: /login/callback/instagram
amazon_login: amazon_login:
@ -25,7 +23,7 @@ amazon_login:
yahoo_login: yahoo_login:
path: /login/callback/yahoo path: /login/callback/yahoo
os_user_security: fos_user_security:
resource: "@FOSUserBundle/Resources/config/routing/security.xml" resource: "@FOSUserBundle/Resources/config/routing/security.xml"
#paths #paths
# /login # /login

View File

@ -7,7 +7,7 @@ security:
cost: 14 cost: 14
providers: providers:
fos_userbundle: fos_userbundle:
id: fos_user.user_provider.username_email id: fos_user.user_provider.username
firewalls: firewalls:
# disables authentication for assets and the profiler, adapt it according to your needs # disables authentication for assets and the profiler, adapt it according to your needs
dev: dev:
@ -28,20 +28,20 @@ security:
facebook: /login/callback/facebook facebook: /login/callback/facebook
google: /login/callback/google google: /login/callback/google
twitter: /login/callback/twitter twitter: /login/callback/twitter
windows: /login/callback/windows
instagram: /login/callback/instagram instagram: /login/callback/instagram
amazon: /login/callback/amazon amazon: /login/callback/amazon
yahoo: /login/callback/yahoo yahoo: /login/callback/yahoo
login_path: /login login_path: /connect
use_forward: false use_forward: false
failure_path: /login failure_path: /connect
oauth_user_provider: oauth_user_provider:
service: hwi_oauth.user.provider.fosub_bridge service: hwi_oauth.user.provider.fosub_bridge
access_control: access_control:
- { path: ^/login$, role: IS_AUTHENTICATED_ANONYMOUSLY } - { path: ^/login$, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/register, role: IS_AUTHENTICATED_ANONYMOUSLY } - { path: ^/register, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/resetting, 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/upload, role: ROLE_USER }
- { path: ^/gallery, role: IS_AUTHENTICATED_ANONYMOUSLY } - { path: ^/gallery, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/admin/, role: ROLE_ADMIN } - { path: ^/admin$, role: ROLE_ADMIN }

View File

@ -10,5 +10,17 @@ services:
doughnutwedding.form.registration: doughnutwedding.form.registration:
class: Sikofitt\DoughnutWeddingBundle\Form\RegistrationType class: Sikofitt\DoughnutWeddingBundle\Form\RegistrationType
arguments: ['@fos_user.user_manager']
tags: tags:
- { name: form.type, alias: app_user_registration } - { 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 }

BIN
build/images/logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 81 KiB

View File

@ -1,5 +1,5 @@
jQuery(document).ready(function($) { 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.'; var selectPlaceholder = 'Choose an option.';
if(document.querySelector('select').hasAttribute('placeholder')) { if(document.querySelector('select').hasAttribute('placeholder')) {
selectPlaceholder = document.querySelector('select').getAttribute('placeholder'); selectPlaceholder = document.querySelector('select').getAttribute('placeholder');
@ -9,5 +9,6 @@ jQuery(document).ready(function($) {
minimumResultsForSearch: Infinity, minimumResultsForSearch: Infinity,
theme: 'default' theme: 'default'
}); });
} }
}); });

View File

@ -3,7 +3,10 @@
//@global-font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; //@global-font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
//@global-font-size: 16px; //@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; @form-background: #ffffff;
.uk-input, .uk-input,
@ -19,3 +22,9 @@
border:1px solid #99baca; border:1px solid #99baca;
color: #666; color: #666;
} }
.uk-login-form #password {
border-top:0 !important;
}
.uk-login-form #password:focus {
border-top: 1px solid #99baca !important;
}

View File

@ -19,6 +19,7 @@
"doctrine/orm": "^2.5", "doctrine/orm": "^2.5",
"egulias/email-validator": "^2.1", "egulias/email-validator": "^2.1",
"friendsofsymfony/user-bundle": "^2.0", "friendsofsymfony/user-bundle": "^2.0",
"google/apiclient": "^2.1",
"google/recaptcha": "^1.1", "google/recaptcha": "^1.1",
"hwi/oauth-bundle": "^0.5.3", "hwi/oauth-bundle": "^0.5.3",
"incenteev/composer-parameter-handler": "^2.0", "incenteev/composer-parameter-handler": "^2.0",
@ -26,6 +27,7 @@
"ircmaxell/security-lib": "^1.1", "ircmaxell/security-lib": "^1.1",
"j-ben87/parsley-bundle": "^1.4", "j-ben87/parsley-bundle": "^1.4",
"javiereguiluz/easyadmin-bundle": "^1.16", "javiereguiluz/easyadmin-bundle": "^1.16",
"knplabs/knp-gaufrette-bundle": "^0.4.0",
"lexik/translation-bundle": "^4.0", "lexik/translation-bundle": "^4.0",
"lightsaml/sp-bundle": "^1.1", "lightsaml/sp-bundle": "^1.1",
"moontoast/math": "^1.1", "moontoast/math": "^1.1",
@ -34,7 +36,7 @@
"paragonie/sodium_compat": "^0.6.0", "paragonie/sodium_compat": "^0.6.0",
"predis/predis": "^1.1", "predis/predis": "^1.1",
"psr/http-message": "^1.0", "psr/http-message": "^1.0",
"ramsey/uuid": "^3.5", "ramsey/uuid": "^3.6",
"ramsey/uuid-doctrine": "^1.2", "ramsey/uuid-doctrine": "^1.2",
"ravenberg/uikit-bundle": "^1.0", "ravenberg/uikit-bundle": "^1.0",
"sensio/distribution-bundle": "^5.0", "sensio/distribution-bundle": "^5.0",

View File

@ -1,5 +1,5 @@
#FROM php:7.1-fpm-alpine FROM php:7.1-fpm-alpine
FROM php-7.1.4-fpm-alpine #FROM php-7.1.4-fpm-alpine
ENV PHPIZE_DEPS \ ENV PHPIZE_DEPS \
autoconf \ autoconf \

View File

@ -1,24 +1,40 @@
<?php <?php
/*
* doughnutwedding.com
* Copyright (C) 2017 http://doughnutwedding.com eric@doughnutwedding.com
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
namespace Sikofitt\DoughnutWeddingBundle\Controller; namespace Sikofitt\DoughnutWeddingBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Component\DependencyInjection\ContainerAwareInterface; use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
/** /**
* Class DefaultController * Class DefaultController.
*/ */
class DefaultController extends Controller class DefaultController extends Controller
{ {
/** /**
* @Route("/") * @Route("/")
* *
* @param Request $request * @param Request $request
*
* @return Response * @return Response
*/ */
public function indexAction(Request $request) public function indexAction(Request $request)
@ -27,7 +43,7 @@ class DefaultController extends Controller
if (null !== $this->getUser()) { if (null !== $this->getUser()) {
$parameters['hide_social'] = true; $parameters['hide_social'] = true;
} }
return $this->render('default/index.html.twig', $parameters); return $this->render('default/index.html.twig', $parameters);
} }
} }

View File

@ -1,14 +1,31 @@
<?php <?php
/*
* doughnutwedding.com
* Copyright (C) 2017 http://doughnutwedding.com eric@doughnutwedding.com
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
namespace Sikofitt\DoughnutWeddingBundle\Controller; namespace Sikofitt\DoughnutWeddingBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
/** /**
* Class ImageController * Class ImageController.
* *
* @package Sikofitt\DoughnutWeddingBundle\Controller
* @Route("/gallery") * @Route("/gallery")
*/ */
class ImageController extends Controller class ImageController extends Controller
@ -18,9 +35,9 @@ class ImageController extends Controller
*/ */
public function indexAction() 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() 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() 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() public function categoryAction()
{ {
return $this->render('SikofittDoughnutWeddingBundle:Image:category.html.twig', array( return $this->render('SikofittDoughnutWeddingBundle:Image:category.html.twig', [
// ... // ...
)); ]);
} }
} }

View File

@ -25,7 +25,6 @@ use Doctrine\ORM\EntityManager;
use Symfony\Bundle\FrameworkBundle\Controller\Controller; use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\Form\FormFactory; use Symfony\Component\Form\FormFactory;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route; use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\Validator\ConstraintViolationList; use Symfony\Component\Validator\ConstraintViolationList;
@ -33,6 +32,7 @@ class RsvpController extends Controller
{ {
/** /**
* @Route("/rsvp") * @Route("/rsvp")
*
* @param \Symfony\Component\HttpFoundation\Request $request * @param \Symfony\Component\HttpFoundation\Request $request
* *
* @return \Symfony\Component\HttpFoundation\RedirectResponse|\Symfony\Component\HttpFoundation\Response * @return \Symfony\Component\HttpFoundation\RedirectResponse|\Symfony\Component\HttpFoundation\Response

View File

@ -1,215 +0,0 @@
<?php
/*
* doughnutwedding.com
* Copyright (C) 2017 http://doughnutwedding.com eric@doughnutwedding.com
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
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()]);
}
}

View File

@ -1,5 +1,23 @@
<?php <?php
/*
* doughnutwedding.com
* Copyright (C) 2017 http://doughnutwedding.com eric@doughnutwedding.com
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
namespace Sikofitt\DoughnutWeddingBundle\DependencyInjection; namespace Sikofitt\DoughnutWeddingBundle\DependencyInjection;
use Symfony\Component\Config\Definition\Builder\TreeBuilder; use Symfony\Component\Config\Definition\Builder\TreeBuilder;
@ -14,6 +32,7 @@ class Configuration implements ConfigurationInterface
{ {
/** /**
* {@inheritdoc} * {@inheritdoc}
*
* @throws \RuntimeException * @throws \RuntimeException
*/ */
public function getConfigTreeBuilder() public function getConfigTreeBuilder()

View File

@ -1,16 +1,34 @@
<?php <?php
/*
* doughnutwedding.com
* Copyright (C) 2017 http://doughnutwedding.com eric@doughnutwedding.com
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
namespace Sikofitt\DoughnutWeddingBundle\DependencyInjection; namespace Sikofitt\DoughnutWeddingBundle\DependencyInjection;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\Config\FileLocator; use Symfony\Component\Config\FileLocator;
use Symfony\Component\HttpKernel\DependencyInjection\Extension; use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Loader; use Symfony\Component\DependencyInjection\Loader;
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
/** /**
* This is the class that loads and manages your bundle configuration. * 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 class SikofittDoughnutWeddingExtension extends Extension
{ {

View File

@ -21,7 +21,6 @@
namespace Sikofitt\DoughnutWeddingBundle\Entity; namespace Sikofitt\DoughnutWeddingBundle\Entity;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
use FOS\UserBundle\Model\UserInterface;
use Symfony\Component\Validator\Constraints as Assert; use Symfony\Component\Validator\Constraints as Assert;
/** /**
@ -46,50 +45,12 @@ class User extends \FOS\UserBundle\Model\User
protected $id; 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\NotBlank()
* @Assert\Regex(pattern="/\w+/") * @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 * @var string
* @ORM\Column(name="reset_token", type="string", length=255, nullable=true) * @ORM\Column(name="reset_token", type="string", length=255, nullable=true)
@ -150,243 +111,12 @@ class User extends \FOS\UserBundle\Model\User
private $twitterId; private $twitterId;
private $twitterAccessToken; private $twitterAccessToken;
/**
* @ORM\Column(name="windows_id", type="string", length=255, nullable=true)
*/
private $windowsId;
private $windowsAccessToken;
/** /**
* @ORM\Column(name="yahoo_id", type="string", length=255, nullable=true) * @ORM\Column(name="yahoo_id", type="string", length=255, nullable=true)
*/ */
private $yahooId; private $yahooId;
private $yahooAccessToken; 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;
}
public function __construct() public function __construct()
{ {
if (null === $this->created) { if (null === $this->created) {
@ -396,6 +126,247 @@ class User extends \FOS\UserBundle\Model\User
parent::__construct(); 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. * 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 * @return User
*/ */
public function setFirstName($firstName) public function setName($name)
{ {
$this->firstName = $firstName; $this->name = $name;
return $this; return $this;
} }
/** /**
* Get firstName. * Get Name.
* *
* @return string * @return string
*/ */
public function getFirstName() public function getName()
{ {
return $this->firstName; return $this->name;
}
/**
* 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;
} }
/** /**
@ -462,53 +409,6 @@ class User extends \FOS\UserBundle\Model\User
return $this->username; 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. * Set email.
@ -686,17 +586,4 @@ class User extends \FOS\UserBundle\Model\User
return $this->rsvp; return $this->rsvp;
} }
public function getRoles()
{
return ['ROLE_USER'];
}
public function eraseCredentials()
{
}
public function getSalt()
{
return null;
}
} }

View File

@ -0,0 +1,31 @@
<?php
/**
* Created by PhpStorm.
* User: eric
* Date: 4/21/17
* Time: 7:37 PM
*/
namespace Sikofitt\DoughnutWeddingBundle\EventListener;
use FOS\UserBundle\Event\FormEvent;
use FOS\UserBundle\FOSUserEvents;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
class RedirectOnUserRegisterListener
{
private $router;
public function __construct(UrlGeneratorInterface $router)
{
$this->router = $router;
}
public function onKernelRequest(FormEvent $event)
{
$url = $this->router->generate('sikofitt_doughnutwedding_default_index');
$event->setResponse(new RedirectResponse($url));
}
}

View File

@ -0,0 +1,113 @@
<?php
declare(strict_types=1);
/*
* doughnutwedding.com
* Copyright (C) 2017 http://doughnutwedding.com eric@doughnutwedding.com
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
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'
];
}
}

View File

@ -0,0 +1,84 @@
<?php
/**
* Created by PhpStorm.
* User: eric
* Date: 4/21/17
* Time: 9:11 PM
*/
namespace Sikofitt\DoughnutWeddingBundle\Form;
use FOS\UserBundle\Form\Type\ProfileFormType;
use HWI\Bundle\OAuthBundle\OAuth\Response\PathUserResponse;
use Sikofitt\DoughnutWeddingBundle\Entity\Rsvp;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\CallbackTransformer;
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\OptionsResolver\OptionsResolver;
class ProfileEditType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options)
{
$emailOptions = $builder->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;
}
}

View File

@ -1,60 +1,57 @@
<?php <?php
/*
* doughnutwedding.com
* Copyright (C) 2017 http://doughnutwedding.com eric@doughnutwedding.com
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
namespace Sikofitt\DoughnutWeddingBundle\Form; 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\Form\Type\RegistrationFormType;
use FOS\UserBundle\Model\UserManager;
use Sikofitt\DoughnutWeddingBundle\Entity\Rsvp; use Sikofitt\DoughnutWeddingBundle\Entity\Rsvp;
use Sikofitt\DoughnutWeddingBundle\Entity\User; use Sikofitt\DoughnutWeddingBundle\Entity\User;
use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\CallbackTransformer; use Symfony\Component\Form\CallbackTransformer;
use Symfony\Component\Form\Extension\Core\Type\CheckboxType; use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType; 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\IntegerType;
use Symfony\Component\Form\Extension\Core\Type\TextType; use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Form\FormEvents;
use Symfony\Component\Form\FormInterface; use Symfony\Component\Form\FormInterface;
use Symfony\Component\Form\FormView; use Symfony\Component\Form\FormView;
use Symfony\Component\OptionsResolver\OptionsResolver; use Symfony\Component\OptionsResolver\OptionsResolver;
class RegistrationType extends AbstractType class RegistrationType extends AbstractType
{ {
private $userManger;
public function __construct(UserManager $userManager)
{
$this->userManger = $userManager;
}
public function buildForm(FormBuilderInterface $builder, array $options) public function buildForm(FormBuilderInterface $builder, array $options)
{ {
$builder->add('name', TextType::class)
$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;'
],
])
->add('rsvp', IntegerType::class, [ ->add('rsvp', IntegerType::class, [
'attr' => [ 'attr' => [
'class' => 'uk-input uk-form-large uk-padding-small uk-box-shadow-hover-small', 'class' => 'uk-input uk-form-large uk-padding-small uk-box-shadow-hover-small',
'placeholder' => 'Number of Guests (including yourself)', 'placeholder' => 'Number of Guests (including yourself)',
], ],
@ -62,7 +59,14 @@ class RegistrationType extends AbstractType
'label_attr' => [ 'label_attr' => [
'class' => 'uk-form-label uk-text-primary', 'class' => 'uk-form-label uk-text-primary',
], ],
]); ])->remove('username');
$builder->addEventListener(FormEvents::SUBMIT, function(FormEvent $event) {
$user = $event->getData();
$user->setUsername($user->getEmail());
$this->userManger->updateCanonicalFields($user);
});
$builder->get('rsvp') $builder->get('rsvp')
->addModelTransformer(new CallbackTransformer( ->addModelTransformer(new CallbackTransformer(
@ -70,11 +74,13 @@ class RegistrationType extends AbstractType
if (null === $rsvp) { if (null === $rsvp) {
return $rsvp; return $rsvp;
} }
return $rsvp->getGuests(); return $rsvp->getGuests();
}, },
function (Int $rsvpInt) { function (Int $rsvpInt) {
$rsvp = new Rsvp(); $rsvp = new Rsvp();
$rsvp->setGuests($rsvpInt); $rsvp->setGuests($rsvpInt);
return $rsvp; return $rsvp;
} }
)); ));
@ -83,9 +89,10 @@ class RegistrationType extends AbstractType
public function configureOptions(OptionsResolver $resolver) 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() {
public function getParent()
{
return RegistrationFormType::class; return RegistrationFormType::class;
} }
@ -96,6 +103,8 @@ class RegistrationType extends AbstractType
) { ) {
$view->children['email']->vars['attr']['class'] = 'uk-input'; $view->children['email']->vars['attr']['class'] = 'uk-input';
$view->children['email']->vars['label_attr']['class'] = 'uk-form-label'; $view->children['email']->vars['label_attr']['class'] = 'uk-form-label';
$p = new PathUserResponse();
//$p->getResourceOwner()->getName();
} }
public function getBlockPrefix() public function getBlockPrefix()

View File

@ -93,7 +93,6 @@ class RsvpType extends AbstractType
]) ])
->add('familyside', ChoiceType::class, [ ->add('familyside', ChoiceType::class, [
'choices' => [ 'choices' => [
User::ERIC_SIDE => User::ERIC_SIDE, User::ERIC_SIDE => User::ERIC_SIDE,
User::KATRINA_SIDE => User::KATRINA_SIDE, User::KATRINA_SIDE => User::KATRINA_SIDE,
], ],
@ -111,11 +110,10 @@ class RsvpType extends AbstractType
'required' => false, 'required' => false,
'attr' => [ 'attr' => [
'class' => 'uk-checkbox uk-box-shadow-hover-small', 'class' => 'uk-checkbox uk-box-shadow-hover-small',
'style' => 'padding-left:16px;' 'style' => 'padding-left:16px;',
], ],
'label_attr' => [ 'label_attr' => [
'class' => 'uk-form-label uk-text-primary', 'class' => 'uk-form-label uk-text-primary',
], ],
]); ]);
$builder->get('rsvp') $builder->get('rsvp')

View File

@ -1,5 +1,23 @@
<?php <?php
/*
* doughnutwedding.com
* Copyright (C) 2017 http://doughnutwedding.com eric@doughnutwedding.com
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
namespace Sikofitt\DoughnutWeddingBundle; namespace Sikofitt\DoughnutWeddingBundle;
use Symfony\Component\HttpKernel\Bundle\Bundle; use Symfony\Component\HttpKernel\Bundle\Bundle;

View File

@ -1,5 +1,23 @@
<?php <?php
/*
* doughnutwedding.com
* Copyright (C) 2017 http://doughnutwedding.com eric@doughnutwedding.com
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
namespace Sikofitt\DoughnutWeddingBundle\Tests\Controller; namespace Sikofitt\DoughnutWeddingBundle\Tests\Controller;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
@ -12,5 +30,4 @@ class DefaultControllerTest extends WebTestCase
$crawler = $client->request('GET', '/'); $crawler = $client->request('GET', '/');
} }
} }

View File

@ -1,5 +1,23 @@
<?php <?php
/*
* doughnutwedding.com
* Copyright (C) 2017 http://doughnutwedding.com eric@doughnutwedding.com
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
namespace Sikofitt\DoughnutWeddingBundle\Tests\Controller; namespace Sikofitt\DoughnutWeddingBundle\Tests\Controller;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
@ -33,5 +51,4 @@ class ImageControllerTest extends WebTestCase
$crawler = $client->request('GET', '/category'); $crawler = $client->request('GET', '/category');
} }
} }

0
var/SymfonyRequirements.php Normal file → Executable file
View File

View File

@ -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. // 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. // 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']) || 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') || !(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'); header('HTTP/1.0 403 Forbidden');
exit('You are not allowed to access this file. Check '.basename(__FILE__).' for more information.'); exit('You are not allowed to access this file. Check '.basename(__FILE__).' for more information.');
} }*/
/** @var \Composer\Autoload\ClassLoader $loader */ /** @var \Composer\Autoload\ClassLoader $loader */
$loader = require __DIR__.'/../app/autoload.php'; $loader = require __DIR__.'/../app/autoload.php';

View File

@ -14,13 +14,13 @@ if (!isset($_SERVER['HTTP_HOST'])) {
exit('This script cannot be run from the CLI. Run it from a browser.'); exit('This script cannot be run from the CLI. Run it from a browser.');
} }
if (!in_array(@$_SERVER['REMOTE_ADDR'], array( //if (!in_array(@$_SERVER['REMOTE_ADDR'], array(
'127.0.0.1', // '127.0.0.1',
'::1', // '::1',
))) { //))) {
header('HTTP/1.0 403 Forbidden'); // header('HTTP/1.0 403 Forbidden');
exit('This script is only accessible from localhost.'); // exit('This script is only accessible from localhost.');
} //}
require_once dirname(__FILE__).'/../var/SymfonyRequirements.php'; require_once dirname(__FILE__).'/../var/SymfonyRequirements.php';