This commit is contained in:
Kayn Ty 2018-05-04 15:05:24 +00:00
commit c32fc1c092
68 changed files with 1118 additions and 854 deletions

View File

@ -11,7 +11,7 @@
ou bien,
<a class="btn btn-info" href="/login">se connecter.</a>
<a class="btn btn-info" href="{{ path('fos_user_security_login') }}">se connecter.</a>
<a class="btn btn-info" href="{{ path('fos_user_resetting_request') }}">
Mot de passe oublié?
</a>

View File

View File

@ -1,5 +1,6 @@
{% extends "@FOSUser/layout.html.twig" %}
{% block bigMain %}
{% block fos_user_content %}
<div class="row">
<div class="col-xs-6">
@ -7,7 +8,29 @@
<i class="fa fa-key"></i>
Se connecter
</h1>
{{ include('@FOSUser/Security/login_content.html.twig') }}
{% if error %}
<div>{{ error.messageKey|trans(error.messageData, 'security') }}</div>
{% endif %}
<form action="{{ path("fos_user_security_check") }}" method="post">
{% if csrf_token %}
<input type="hidden" name="_csrf_token" value="{{ csrf_token }}"/>
{% endif %}
<label for="username">{{ 'security.login.username'|trans }}</label>
<input type="text" id="username" name="_username" value="{{ last_username }}" required="required"
autocomplete="username"/>
<label for="password">{{ 'security.login.password'|trans }}</label>
<input type="password" id="password" name="_password" required="required"
autocomplete="current-password"/>
<input type="checkbox" id="remember_me" name="_remember_me" value="on"/>
<label for="remember_me">{{ 'security.login.remember_me'|trans }}</label>
<input type="submit" id="_submit" name="_submit" value="{{ 'security.login.submit'|trans }}"/>
</form>
</div>
<div class="col-xs-6">
<p>
@ -27,3 +50,5 @@
{% endblock fos_user_content %}
{% endblock %}

View File

@ -1,17 +1,63 @@
{% extends '::default/index.html.twig' %}
{% trans_default_domain 'FOSUserBundle' %}
{% block title %}Caisse{% endblock %}
{% block body %}
{% block bigMain %}
{% include 'default/header.html.twig' %}
<section class="bg-girl padded">
<div class="container">
<div class="row justify-content-md-center align-items-center">
<div class="col-md-auto">
<div class="well form-group">
<fieldset class="bg-shader pull-left form-group padded">
{#<div class="row">#}
{#<div class="col-xs-6">#}
{#<h1>#}
{#<i class="fa fa-key"></i>#}
{#Se connecter#}
{#</h1>#}
{#{% if error is defined %}#}
{#<div>{{ error.messageKey|trans(error.messageData, 'security') }}</div>#}
{#{% endif %}#}
{#<form action="{{ path("fos_user_security_check") }}" method="post">#}
{#{% if csrf_token is defined %}#}
{#<input type="hidden" name="_csrf_token" value="{{ csrf_token }}"/>#}
{#{% endif %}#}
{#<label for="username">{{ 'security.login.username'|trans }}</label>#}
{#<input type="text" id="username" name="_username" value=""#}
{#required="required"#}
{#autocomplete="username"/>#}
{#<label for="password">{{ 'security.login.password'|trans }}</label>#}
{#<input type="password" id="password" name="_password" required="required"#}
{#autocomplete="current-password"/>#}
{#<input type="checkbox" id="remember_me" name="_remember_me" value="on"/>#}
{#<label for="remember_me">{{ 'security.login.remember_me'|trans }}</label>#}
{#<input type="submit" id="_submit" name="_submit"#}
{#value="{{ 'security.login.submit'|trans }}"/>#}
{#</form>#}
{#</div>#}
{#<div class="col-xs-6">#}
{#<p>#}
{#<a class="btn btn-info" href="{{ path('fos_user_resetting_request') }}">#}
{#Mot de passe oublié?#}
{#</a>#}
{#</p>#}
{#</div>#}
{#</div>#}
{% block fos_user_content %}{% endblock %}
</div>
</fieldset>
</div>
</div>
</div>
</section>
{% include 'default/footer.html.twig' %}
{% endblock %}

View File

@ -1,496 +0,0 @@
<?php
/*
* This file is part of the HWIOAuthBundle package.
*
* (c) Hardware.Info <opensource@hardware.info>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace HWI\Bundle\OAuthBundle\Controller;
use HWI\Bundle\OAuthBundle\Event\FilterUserResponseEvent;
use HWI\Bundle\OAuthBundle\Event\FormEvent;
use HWI\Bundle\OAuthBundle\Event\GetResponseUserEvent;
use HWI\Bundle\OAuthBundle\HWIOAuthEvents;
use HWI\Bundle\OAuthBundle\OAuth\ResourceOwnerInterface;
use HWI\Bundle\OAuthBundle\OAuth\Response\UserResponseInterface;
use HWI\Bundle\OAuthBundle\Security\Core\Authentication\Token\OAuthToken;
use HWI\Bundle\OAuthBundle\Security\Core\Exception\AccountNotLinkedException;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\Form\Extension\Core\Type\FormType;
use Symfony\Component\Form\FormInterface;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\Session\SessionInterface;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use Symfony\Component\Security\Core\Exception\AccessDeniedException;
use Symfony\Component\Security\Core\Exception\AccountStatusException;
use Symfony\Component\Security\Core\Exception\AuthenticationException;
use Symfony\Component\Security\Core\Security;
use Symfony\Component\Security\Core\User\UserInterface;
use Symfony\Component\Security\Csrf\CsrfTokenManagerInterface;
use Symfony\Component\Security\Http\Event\InteractiveLoginEvent;
use Symfony\Component\Security\Http\SecurityEvents;
/**
* @author Alexander <iam.asm89@gmail.com>
*/
class ConnectController extends Controller {
private $tokenManager;
public function __construct( CsrfTokenManagerInterface $tokenManager = null ) {
$this->tokenManager = $tokenManager;
}
/**
* Action that handles the login 'form'. If connecting is enabled the
* user will be redirected to the appropriate login urls or registration forms.
*
* @param Request $request
*
* @throws \LogicException
*
* @return Response
*/
public function connectAction( Request $request ) {
var_dump( "overrided" );
$connect = $this->container->getParameter( 'hwi_oauth.connect' );
$hasUser = $this->getUser() ? $this->isGranted( $this->container->getParameter( 'hwi_oauth.grant_rule' ) ) : false;
$error = $this->getErrorForRequest( $request );
// if connecting is enabled and there is no user, redirect to the registration form
if ( $connect && ! $hasUser && $error instanceof AccountNotLinkedException ) {
$key = time();
$session = $request->getSession();
$session->set( '_hwi_oauth.registration_error.' . $key, $error );
return $this->redirectToRoute( 'hwi_oauth_connect_registration', [ 'key' => $key ] );
}
if ( $error ) {
if ( $error instanceof AuthenticationException ) {
$error = $error->getMessageKey();
} else {
$error = $error->getMessage();
}
}
$csrfToken = $this->tokenManager
? $this->tokenManager->getToken( 'authenticate' )->getValue()
: null;
return $this->render( '@HWIOAuth/Connect/login.html.twig',
[
'error' => $error,
'csrf_token' => $csrfToken,
] );
}
/**
* Shows a registration form if there is no user logged in and connecting
* is enabled.
*
* @param Request $request a request
* @param string $key key used for retrieving the right information for the registration form
*
* @return Response
*
* @throws NotFoundHttpException if `connect` functionality was not enabled
* @throws AccessDeniedException if any user is authenticated
* @throws \RuntimeException
*/
public function registrationAction( Request $request, $key ) {
$connect = $this->container->getParameter( 'hwi_oauth.connect' );
if ( ! $connect ) {
throw new NotFoundHttpException();
}
$hasUser = $this->isGranted( $this->container->getParameter( 'hwi_oauth.grant_rule' ) );
if ( $hasUser ) {
throw new AccessDeniedException( 'Cannot connect already registered account.' );
}
$session = $request->getSession();
$error = $session->get( '_hwi_oauth.registration_error.' . $key );
$session->remove( '_hwi_oauth.registration_error.' . $key );
if ( ! $error instanceof AccountNotLinkedException ) {
throw new \RuntimeException( 'Cannot register an account.',
0,
$error instanceof \Exception ? $error : null );
}
$userInformation = $this
->getResourceOwnerByName( $error->getResourceOwnerName() )
->getUserInformation( $error->getRawToken() );
/* @var $form FormInterface */
if ( $this->container->getParameter( 'hwi_oauth.fosub_enabled' ) ) {
// enable compatibility with FOSUserBundle 1.3.x and 2.x
if ( interface_exists( 'FOS\UserBundle\Form\Factory\FactoryInterface' ) ) {
$form = $this->container->get( 'hwi_oauth.registration.form.factory' )->createForm();
} else {
$form = $this->container->get( 'hwi_oauth.registration.form' );
}
} else {
$form = $this->container->get( 'hwi_oauth.registration.form' );
}
$formHandler = $this->container->get( 'hwi_oauth.registration.form.handler' );
if ( $formHandler->process( $request, $form, $userInformation ) ) {
$event = new FormEvent( $form, $request );
$this->get( 'event_dispatcher' )->dispatch( HWIOAuthEvents::REGISTRATION_SUCCESS, $event );
$this->container->get( 'hwi_oauth.account.connector' )->connect( $form->getData(), $userInformation );
// Authenticate the user
$this->authenticateUser( $request,
$form->getData(),
$error->getResourceOwnerName(),
$error->getAccessToken() );
if ( null === $response = $event->getResponse() ) {
if ( $targetPath = $this->getTargetPath( $session ) ) {
$response = $this->redirect( $targetPath );
} else {
$response = $this->render( '@HWIOAuth/Connect/registration_success.html.twig',
[
'userInformation' => $userInformation,
] );
}
}
$event = new FilterUserResponseEvent( $form->getData(), $request, $response );
$this->get( 'event_dispatcher' )->dispatch( HWIOAuthEvents::REGISTRATION_COMPLETED, $event );
return $response;
}
// reset the error in the session
$session->set( '_hwi_oauth.registration_error.' . $key, $error );
$event = new GetResponseUserEvent( $form->getData(), $request );
$this->get( 'event_dispatcher' )->dispatch( HWIOAuthEvents::REGISTRATION_INITIALIZE, $event );
if ( $response = $event->getResponse() ) {
return $response;
}
return $this->render( '@HWIOAuth/Connect/registration.html.twig',
[
'key' => $key,
'form' => $form->createView(),
'userInformation' => $userInformation,
] );
}
/**
* Connects a user to a given account if the user is logged in and connect is enabled.
*
* @param Request $request the active request
* @param string $service name of the resource owner to connect to
*
* @throws \Exception
*
* @return Response
*
* @throws NotFoundHttpException if `connect` functionality was not enabled
* @throws AccessDeniedException if no user is authenticated
*/
public function connectServiceAction( Request $request, $service ) {
$connect = $this->container->getParameter( 'hwi_oauth.connect' );
if ( ! $connect ) {
throw new NotFoundHttpException();
}
$hasUser = $this->isGranted( $this->container->getParameter( 'hwi_oauth.grant_rule' ) );
if ( ! $hasUser ) {
throw new AccessDeniedException( 'Cannot connect an account.' );
}
// Get the data from the resource owner
$resourceOwner = $this->getResourceOwnerByName( $service );
$session = $request->getSession();
$key = $request->query->get( 'key', time() );
if ( $resourceOwner->handles( $request ) ) {
$accessToken = $resourceOwner->getAccessToken(
$request,
$this->container->get( 'hwi_oauth.security.oauth_utils' )->getServiceAuthUrl( $request, $resourceOwner )
);
// save in session
$session->set( '_hwi_oauth.connect_confirmation.' . $key, $accessToken );
} else {
$accessToken = $session->get( '_hwi_oauth.connect_confirmation.' . $key );
}
// Redirect to the login path if the token is empty (Eg. User cancelled auth)
if ( null === $accessToken ) {
if ( $this->container->getParameter( 'hwi_oauth.failed_use_referer' ) && $targetPath = $this->getTargetPath( $session,
'failed_target_path' ) ) {
return $this->redirect( $targetPath );
}
return $this->redirectToRoute( $this->container->getParameter( 'hwi_oauth.failed_auth_path' ) );
}
$userInformation = $resourceOwner->getUserInformation( $accessToken );
// Show confirmation page?
if ( ! $this->container->getParameter( 'hwi_oauth.connect.confirmation' ) ) {
return $this->getConfirmationResponse( $request, $accessToken, $service );
}
// Symfony <3.0 BC
/** @var $form FormInterface */
$form = method_exists( 'Symfony\Component\Form\AbstractType', 'getBlockPrefix' )
? $this->createForm( FormType::class )
: $this->createForm( 'form' );
// Handle the form
$form->handleRequest( $request );
if ( $form->isSubmitted() && $form->isValid() ) {
return $this->getConfirmationResponse( $request, $accessToken, $service );
}
$event = new GetResponseUserEvent( $this->getUser(), $request );
$this->get( 'event_dispatcher' )->dispatch( HWIOAuthEvents::CONNECT_INITIALIZE, $event );
if ( $response = $event->getResponse() ) {
return $response;
}
return $this->render( '@HWIOAuth/Connect/connect_confirm.html.twig',
[
'key' => $key,
'service' => $service,
'form' => $form->createView(),
'userInformation' => $userInformation,
] );
}
/**
* @param Request $request
* @param string $service
*
* @throws NotFoundHttpException
*
* @return RedirectResponse
*/
public function redirectToServiceAction( Request $request, $service ) {
try {
$authorizationUrl = $this->container->get( 'hwi_oauth.security.oauth_utils' )->getAuthorizationUrl( $request,
$service );
} catch ( \RuntimeException $e ) {
throw new NotFoundHttpException( $e->getMessage(), $e );
}
// Check for a return path and store it before redirect
if ( $request->hasSession() ) {
// initialize the session for preventing SessionUnavailableException
$session = $request->getSession();
$session->start();
foreach ( $this->container->getParameter( 'hwi_oauth.firewall_names' ) as $providerKey ) {
$sessionKey = '_security.' . $providerKey . '.target_path';
$sessionKeyFailure = '_security.' . $providerKey . '.failed_target_path';
$param = $this->container->getParameter( 'hwi_oauth.target_path_parameter' );
if ( ! empty( $param ) && $targetUrl = $request->get( $param ) ) {
$session->set( $sessionKey, $targetUrl );
}
if ( $this->container->getParameter( 'hwi_oauth.failed_use_referer' ) && ! $session->has( $sessionKeyFailure ) && ( $targetUrl = $request->headers->get( 'Referer' ) ) && $targetUrl !== $authorizationUrl ) {
$session->set( $sessionKeyFailure, $targetUrl );
}
if ( $this->container->getParameter( 'hwi_oauth.use_referer' ) && ! $session->has( $sessionKey ) && ( $targetUrl = $request->headers->get( 'Referer' ) ) && $targetUrl !== $authorizationUrl ) {
$session->set( $sessionKey, $targetUrl );
}
}
}
return $this->redirect( $authorizationUrl );
}
/**
* Get the security error for a given request.
*
* @param Request $request
*
* @return string|\Exception
*/
protected function getErrorForRequest( Request $request ) {
$authenticationErrorKey = Security::AUTHENTICATION_ERROR;
$session = $request->getSession();
if ( $request->attributes->has( $authenticationErrorKey ) ) {
$error = $request->attributes->get( $authenticationErrorKey );
} elseif ( null !== $session && $session->has( $authenticationErrorKey ) ) {
$error = $session->get( $authenticationErrorKey );
$session->remove( $authenticationErrorKey );
} else {
$error = '';
}
return $error;
}
/**
* Get a resource owner by name.
*
* @param string $name
*
* @return ResourceOwnerInterface
*
* @throws NotFoundHttpException if there is no resource owner with the given name
*/
protected function getResourceOwnerByName( $name ) {
foreach ( $this->container->getParameter( 'hwi_oauth.firewall_names' ) as $firewall ) {
$id = 'hwi_oauth.resource_ownermap.' . $firewall;
if ( ! $this->container->has( $id ) ) {
continue;
}
$ownerMap = $this->container->get( $id );
if ( $resourceOwner = $ownerMap->getResourceOwnerByName( $name ) ) {
return $resourceOwner;
}
}
throw new NotFoundHttpException( sprintf( "No resource owner with name '%s'.", $name ) );
}
/**
* Generates a route.
*
* @deprecated since version 0.4. Will be removed in 1.0.
*
* @param string $route Route name
* @param array $params Route parameters
* @param bool $absolute absolute url or note
*
* @return string
*/
protected function generate( $route, array $params = [], $absolute = false ) {
@trigger_error( 'The ' . __METHOD__ . ' method is deprecated since version 0.4 and will be removed in 1.0. Use Symfony\Bundle\FrameworkBundle\Controller\Controller::generateUrl instead.',
E_USER_DEPRECATED );
return $this->container->get( 'router' )->generate( $route, $params, $absolute );
}
/**
* Authenticate a user with Symfony Security.
*
* @param Request $request
* @param UserInterface $user
* @param string $resourceOwnerName
* @param string $accessToken
* @param bool $fakeLogin
*/
protected function authenticateUser(
Request $request,
UserInterface $user,
$resourceOwnerName,
$accessToken,
$fakeLogin = true
) {
try {
$this->container->get( 'hwi_oauth.user_checker' )->checkPreAuth( $user );
$this->container->get( 'hwi_oauth.user_checker' )->checkPostAuth( $user );
} catch ( AccountStatusException $e ) {
// Don't authenticate locked, disabled or expired users
return;
}
$token = new OAuthToken( $accessToken, $user->getRoles() );
$token->setResourceOwnerName( $resourceOwnerName );
$token->setUser( $user );
$token->setAuthenticated( true );
$this->get( 'security.token_storage' )->setToken( $token );
if ( $fakeLogin ) {
// Since we're "faking" normal login, we need to throw our INTERACTIVE_LOGIN event manually
$this->container->get( 'event_dispatcher' )->dispatch(
SecurityEvents::INTERACTIVE_LOGIN,
new InteractiveLoginEvent( $request, $token )
);
}
}
/**
* @param SessionInterface $session
*
* @return string|null
*/
private function getTargetPath( SessionInterface $session ) {
foreach ( $this->container->getParameter( 'hwi_oauth.firewall_names' ) as $providerKey ) {
$sessionKey = '_security.' . $providerKey . '.target_path';
if ( $session->has( $sessionKey ) ) {
return $session->get( $sessionKey );
}
}
return null;
}
/**
* @param Request $request The active request
* @param array $accessToken The access token
* @param string $service Name of the resource owner to connect to
*
* @return Response
*
* @throws NotFoundHttpException if there is no resource owner with the given name
*/
private function getConfirmationResponse( Request $request, array $accessToken, $service ) {
/** @var $currentToken OAuthToken */
$currentToken = $this->container->get( 'security.token_storage' )->getToken();
/** @var $currentUser UserInterface */
$currentUser = $currentToken->getUser();
/** @var $resourceOwner ResourceOwnerInterface */
$resourceOwner = $this->getResourceOwnerByName( $service );
/** @var $userInformation UserResponseInterface */
$userInformation = $resourceOwner->getUserInformation( $accessToken );
$event = new GetResponseUserEvent( $currentUser, $request );
$this->get( 'event_dispatcher' )->dispatch( HWIOAuthEvents::CONNECT_CONFIRMED, $event );
$this->container->get( 'hwi_oauth.account.connector' )->connect( $currentUser, $userInformation );
if ( $currentToken instanceof OAuthToken ) {
// Update user token with new details
$newToken =
is_array( $accessToken ) &&
( isset( $accessToken[ 'access_token' ] ) || isset( $accessToken[ 'oauth_token' ] ) ) ?
$accessToken : $currentToken->getRawToken();
$this->authenticateUser( $request, $currentUser, $service, $newToken, false );
}
if ( null === $response = $event->getResponse() ) {
if ( $targetPath = $this->getTargetPath( $request->getSession() ) ) {
$response = $this->redirect( $targetPath );
} else {
$response = $this->render( '@HWIOAuth/Connect/connect_success.html.twig',
[
'userInformation' => $userInformation,
'service' => $service,
] );
}
}
$event = new FilterUserResponseEvent( $currentUser, $request, $response );
$this->get( 'event_dispatcher' )->dispatch( HWIOAuthEvents::CONNECT_COMPLETED, $event );
return $response;
}
}

View File

@ -1,14 +1,91 @@
{% trans_default_domain 'FOSUserBundle' %}
{% extends '@HWIOAuth/layout.html.twig' %}
{% block bigMain %}
{% include 'default/header.html.twig' %}
<section class="bg-girl padded">
<div class="container">
<div class="row justify-content-md-center align-items-center">
<div class="col-md-auto">
<fieldset class="bg-shader pull-left form-group padded">
<div class="row">
<div class="col-xs-6">
<div class="row">
<div class="col-xs-6">
<h1>
<i class="fa fa-key"></i>
Se connecter
</h1>
<div class="alert alert-info">
En raison de maintenance technique, seul le login via twitter fonctionne
actuellement.
</div>
{#{% if error %}#}
{% block hwi_oauth_content %}
{% if error is defined and error %}
<span>{{ error }}</span>
{% endif %}
{% for owner in hwi_oauth_resource_owners() %}
<a class="btn btn-default btn-block btn-{{ owner }}" href="{{ hwi_oauth_login_url(owner) }}">
<i class="fa fa-{{ owner }}"></i>
{{ owner | trans({}, 'HWIOAuthBundle') }}
{#<div class="alert alert-danger">{{ error|trans }}</div>#}
{#{% endif %}#}
{#<form action="{{ path("fos_user_security_check") }}" method="post">#}
{#{% if csrf_token is defined %}#}
{#csrf_token : {{ csrf_token }}#}
{#<input type="hidden" name="_csrf_token" value="{{ csrf_token }}"/>#}
{#{% else %}#}
{#PAS DE TOKEN#}
{#{% endif %}#}
{#<label for="username">{{ 'security.login.username'|trans }}</label>#}
{#<input type="text" id="username" name="_username"#}
{#value="" required="required"#}
{#autocomplete="username"/>#}
{#<label for="password">{{ 'security.login.password'|trans }}</label>#}
{#<input type="password" id="password" name="_password"#}
{#required="required"#}
{#autocomplete="current-password"/>#}
{#<input type="checkbox" id="remember_me" name="_remember_me" value="on"/>#}
{#<label for="remember_me">{{ 'security.login.remember_me'|trans }}</label>#}
{#<input type="submit" id="_submit" name="_submit"#}
{#value="{{ 'security.login.submit'|trans }}"/>#}
{#</form>#}
</div>
<div class="col-xs-6">
{#<p>#}
{#<a class="btn btn-info" href="{{ path('fos_user_resetting_request') }}">#}
{#Mot de passe oublié?#}
{#</a>#}
{#</p>#}
<p>
<a class="btn btn-info"
href="{{ path('fos_user_registration_register') }}">
Créer un compte
</a>
</p>
</div>
</div>
</div>
<div class="col-xs-6">
{% block hwi_oauth_content %}
<h1>oauth login</h1>
{% if error is defined and error %}
<div class="alert alert-danger pull-left">{{ error|trans }}</div>
{% endif %}
<a class="btn btn-default btn-{{ "twitter" }}"
href="{{ hwi_oauth_login_url("twitter") }}">
<i class="fa fa-{{ "twitter" }}"></i>
{{ "twitter" | trans({}, 'HWIOAuthBundle') }}
</a>
<br/>
{% endfor %}
{% endblock hwi_oauth_content %}
</div>
</div>
</fieldset>
</div>
</div>
</div>
</section>
{% include 'default/footer.html.twig' %}
{% endblock %}

View File

@ -14,6 +14,8 @@
<form action="{{ path("fos_user_security_check") }}" method="post">
{% if csrf_token is defined %}
<input type="hidden" name="_csrf_token" value="{{ csrf_token }}"/>
{% else %}
PAS DE TOKEN CSRF
{% endif %}
<label for="username">{{ 'security.login.username'|trans }}</label>
@ -29,7 +31,6 @@
<input type="submit" id="_submit" name="_submit" value="{{ 'security.login.submit'|trans }}"/>
</form>
</div>
<div class="col-xs-6">
{% block hwi_oauth_content %}
@ -38,4 +39,4 @@
</div>
{% endblock body %}
{% endblock %}

View File

@ -2,27 +2,28 @@
<html>
<head>
<meta charset="UTF-8">
<meta name="google-signin-client_id"
content="938689189350-frtrg93bnva4b3p7c1al880mi3ts5i35.apps.googleusercontent.com">
<title>{% block title %}Fiche de compte dynamique{% endblock %}</title>
{% block stylesheets %}
<link rel="stylesheet" href="{{ asset('build/app.css') }}">
{% endblock %}
</head>
<body>
{% if app.user is not defined %}
<div class="bg-img"></div>
{% else %}
<div class="bg-img-logged-in"></div>
{% endif %}
{% block navigation %}
{% endblock %}
<div id="bodyland">
<div class="container">
{% block bigMain %}
{% include 'default/header.html.twig' %}
<div class="container">
{% block body %}
{% endblock %}
{% include 'default/footer.html.twig' %}
</div>
{% include 'default/footer.html.twig' %}
{% endblock %}
</div>
{% block javascripts %}
<script src="{{ asset('build/app.js') }}"></script>
@ -35,7 +36,7 @@
_paq.push(['trackPageView']);
_paq.push(['enableLinkTracking']);
(function () {
var u = "//piwik.cipherbliss.com/";
var u = "https://piwik.cipherbliss.com/";
_paq.push(['setTrackerUrl', u + 'piwik.php']);
_paq.push(['setSiteId', '1']);
var d = document, g = d.createElement('script'), s = d.getElementsByTagName('script')[0];

12
app/Resources/views/default/description-app.html.twig Normal file → Executable file
View File

@ -1,19 +1,19 @@
<div class="product-values marged-v">
<div class="row">
<div class="col-xs-4 text-center">
<div class="col-xs-12 col-sm-4 text-center">
<i class="fa fa-check-circle fa-3x"></i>
<h2 class="text-center">Gratuit</h2>
<p>Gérez votre comptabilité de stand en ligne sans dépenser un rond. Plus besoin de transporter un
inventaire et des feuilles de calcul faites à l'arrache.</p>
</div>
<div class="col-xs-4 text-center">
<div class="col-xs-12 col-sm-4 text-center">
<i class="fa fa-random fa-3x"></i>
<h2>Flexible</h2>
<p>Modifiez vos produits à la volée, soyez plusieurs à gérer la caisse si vous le souhaitez, changez de
responsable en cours de journée. Créez plusieurs produits juste en écrivant leur nom avec l'interface
d'importation simplifiée.</p>
</div>
<div class="col-xs-4 text-center">
<div class="col-xs-12 col-sm-4 text-center">
<i class="fa fa-truck fa-3x"></i>
<h2>Portable</h2>
<p>Fait pour être utilisé sur les marchés et les salons. Votre gestion des stocks n'en sera que
@ -21,7 +21,7 @@
</div>
</div>
<div class="row">
<div class="col-xs-4 text-center">
<div class="col-xs-12 col-sm-4 text-center">
<i class="fa fa-rotate-left fa-3x"></i>
<h2>Open Source</h2>
@ -32,12 +32,12 @@
.
</p>
</div>
<div class="col-xs-4 text-center">
<div class="col-xs-12 col-sm-4 text-center">
<i class="fa fa-pie-chart fa-3x"></i>
<h2>Statistiques</h2>
<p>Données statistiques et gestion des stocks actualisée au fur et à mesure des ventes.</p>
</div>
<div class="col-xs-4 text-center">
<div class="col-xs-12 col-sm-4 text-center">
<i class="fa fa-heart-o fa-3x"></i>
<h2>Data Love</h2>
<p>Données exportables et importables en masse librement.</p>

View File

@ -1,4 +1,5 @@
<footer class="big-footer text-center container">
<footer class="big-footer text-center navbar-inverse navbar-footer ">
<div class="container">
<sub class="footer-note text-center"> développé par Tykayn /
<a href="http://www.cipherbliss.com">
Cipher Bliss
@ -9,5 +10,5 @@
contact
</a>
</sub>
</div>
</footer>

View File

@ -1,4 +1,6 @@
<div class="header-block container">
<div class="header-block ">
<div class="nav navbar-inverse padded">
<div class="container">
<div class="row">
<div class="col-xs-12">
{% include 'default/login-choices.html.twig' %}
@ -25,3 +27,5 @@
</div>
</div>
</div>
</div>
</div>

View File

@ -1,16 +1,8 @@
{% extends 'base.html.twig' %}
{% trans_default_domain 'FOSUserBundle' %}
{% block body %}
<div id="wrapper">
<main>
{% block bigMain %}
<div id="container" class="container">
<main>
{% include 'default/main-screen.html.twig' %}
</main>
</div>
</main>
</div>
{% endblock %}

View File

@ -1,7 +1,7 @@
{% trans_default_domain 'FOSUserBundle' %}
{% block loginchoices %}
<div class="loginland ">
<div class="bg-img padded">
<div class="login-choices">
{% if is_granted("IS_AUTHENTICATED_REMEMBERED") %}
<div class="row">
@ -111,7 +111,18 @@
{% else %}
<h1 class="text-right">
{#<a class="btn btn-default btn-{{ "google" }}" href="{{ hwi_oauth_login_url("google") }}">#}
{#<i class="fa fa-{{ "google" }}"></i>#}
{#Login via {{ "google" | trans({}, 'HWIOAuthBundle') }}#}
{#</a>#}
<a class="btn btn-default btn-{{ "twitter" }}"
href="{{ hwi_oauth_login_url("twitter") }}">
<i class="fa fa-{{ "twitter" }}"></i>
Login via {{ "twitter" | trans({}, 'HWIOAuthBundle') }}
</a>
<a class="btn btn-primary"
href="{{ path('fos_user_security_login') }}">
<i class="fa fa-key"></i>
@ -122,6 +133,5 @@
{% endif %}
</div>
</div>
</div>
{% endblock loginchoices %}

View File

@ -1,34 +1,72 @@
<div class="main-screen">
<div id="welcome" class="jumbotron text-center">
<h1>
<i class="fa fa-circle-o-notch logo-main"></i>
Caisse
</h1>
<div class="description">
Votre caisse mobile dynamique en ligne
</div>
<div class="try">
<a class="btn btn-primary" href="{{ path('fos_user_security_login') }}" class="btn btn-primary">Essayez dès
maintenant
</a>
<p>
Démonstration en vous connectant avec le login: <strong>demo</strong> et le mot de passe
<strong>demo</strong>.
</p>
</div>
</div>
{% include 'default/description-app.html.twig' %}
{% block bigMain %}
<div class="try jumbotron">
<fieldset>
{% include 'default/header.html.twig' %}
{% block body %}
<div class="main-screen">
<div id="welcome">
<section class="bg-accessories">
<div class="bg-shader">
<div class="container main-section">
<div class="row">
<div class="col-xs-6">
<a class="btn btn-primary" href="{{ path('dashboard') }}" class="btn btn-success">Essayez dès
maintenant
<h1>
{#<i class="fa fa-circle-o-notch logo-main"></i>#}
Caisse Bliss
</h1>
</div>
<div class="col-xs-6">
<div class="description">
<strong> Votre caisse mobile dynamique en ligne </strong> Pensé pour les
exposants et les créateurs divers en festival, cette caisse saura s'adapter à
l'évolution de vos stocks et vous libèrera des affres de la fiche de compte à
faire et compléter soi même.
</div>
<div class="try">
<br>
<div class="row">
<div class="col-xs-6 padded text-right">
<a class="btn btn-primary"
href="{{ path('fos_user_security_login') }}"
class="btn btn-primary">
Essayez dès maintenant
</a>
</div>
<div class="col-xs-6">
<sub> Démonstration en vous connectant avec le login:
<strong>demo</strong> et le mot de passe <strong>demo</strong>.
</sub>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</section>
</div>
<section class="bg-girl">
<div class="bg-shader">
<div class="container">
{% include 'default/description-app.html.twig' %}
<div class="try">
<fieldset class="bg-dark padded">
<div class="row">
<div class="col-xs-6">
<a class="btn btn-primary" href="{{ path('dashboard') }}"
class="btn btn-success">
Essayez dès maintenant
</a>
<p>
Démonstration en vous connectant avec le login: <strong>demo</strong> et le mot de passe
<strong>demo</strong>.
Démonstration en vous connectant avec le login: <strong>demo</strong> et le
mot de passe <strong>demo</strong>.
</p>
</div>
<div class="col-xs-6">
@ -45,7 +83,10 @@
</div>
</fieldset>
</div>
<hr>
</div>
</div>
</section>
<section class="bg-color">
<div id="contact" class="text-center">
<i class="fa fa-envelope-open-o"></i>
contactez-moi pour tout renseignement:
@ -55,7 +96,11 @@
<img src="https://en.gravatar.com/userimage/53061325/811d383aa2ebb8d2d83baab7da5f4a7b.jpeg"
alt="avatar Mastodon" width="50" height="50"> @tykayn@mamot.fr
</a>
</div>
</section>
</div>
{% endblock %}
{% include 'default/footer.html.twig' %}
{% endblock %}

View File

@ -0,0 +1 @@
<h1>Privacy</h1>

View File

@ -0,0 +1 @@
<h1>Terms of service</h1>

View File

@ -1,16 +1,4 @@
<div class="selling-history">
{#<h4>#}
{#Ventes récentes#}
{#</h4>#}
{#{% if recentSells %}#}
{#<ul>#}
{#{% for s in recentSells %}#}
{#<li>{{ s.date|date('Y/m/d H:i:s') }} {{ s.sellingComment }} | {{ s.amount }}€</li>#}
{#{% endfor %}#}
{#</ul>#}
{#{% else %}#}
{#aucune#}
{#{% endif %}#}
{% verbatim %}
<div ng-repeat="s in recentSelling track by $index">
{{s.id}} )

View File

0
app/Resources/views/logged/history.html.twig Normal file → Executable file
View File

0
app/Resources/views/logged/import.html.twig Normal file → Executable file
View File

0
app/Resources/views/logged/mass-register.html.twig Normal file → Executable file
View File

View File

@ -74,7 +74,7 @@ swiftmailer:
#fos user bundle
fos_user:
db_driver: orm # other valid values are 'mongodb' and 'couchdb'
firewall_name: main
firewall_name: secured_area
user_class: AppBundle\Entity\User
registration:
confirmation:
@ -86,6 +86,14 @@ fos_user:
hwi_oauth:
# list of names of the firewalls in which this bundle is active, this setting MUST be set
firewall_names: [secured_area]
connect:
account_connector: my.custom.user_provider
fosub:
username_iterations: 30
properties:
google: google_id
twitter: twitter_id
disqus: disqus_id
# an optional setting to configure a query string parameter which can be used to redirect
# the user after authentication, e.g. /connect/facebook?_destination=/my/destination will
# redirect the user to /my/destination after facebook authenticates them. If this is not
@ -100,20 +108,13 @@ hwi_oauth:
# [using the referring URL for form login](http://symfony.com/doc/2.0/cookbook/security/form_login.html#using-the-referring-url).
# use_referer: true
resource_owners:
google:
type: google
client_id: "%google_id%"
client_secret: "%google_secret%"
scope: "email"
options:
csrf: true
facebook:
type: facebook
client_id: "%facebook_id%"
client_secret: "%facebook_secret%"
scope: "email"
options:
csrf: true
# google:
# type: google
# client_id: "%google_id%"
# client_secret: "%google_secret%"
# scope: "email"
# options:
# csrf: true
twitter:
type: twitter
client_id: "%twitter_id%"
@ -121,3 +122,10 @@ hwi_oauth:
scope: "email"
options:
csrf: true
# disqus:
# type: disqus
# client_id: "%disqus_id%"
# client_secret: "%disqus_secret%"
# scope: "email"
# options:
# csrf: true

View File

@ -1,6 +1,38 @@
hwi_oauth_login:
resource: "@HWIOAuthBundle/Resources/config/routing/login.xml"
prefix: /login
hwi_oauth_redirect:
resource: "@HWIOAuthBundle/Resources/config/routing/redirect.xml"
prefix: /connect
hwi_oauth_connect:
resource: "@HWIOAuthBundle/Resources/config/routing/connect.xml"
prefix: /connect
fos_user:
resource: "@FOSUserBundle/Resources/config/routing/all.xml"
#facebook_login:
# path: /login/check-facebook
google_login:
path: /login/check-google
disqus_login:
path: /login/check-disqus
twitter_login:
path: /login/check-twitter
app:
resource: '@AppBundle/Controller/'
type: annotation
## app specific stuff
app_festival:
resource: "@AppBundle/Controller/FestivalController.php"
type: annotation
# legal info pages
app_legal:
resource: "@AppBundle/Controller/LegalController.php"
type: annotation
app_product_category:
resource: "@AppBundle/Controller/ProductCategoryController.php"
@ -14,34 +46,7 @@ app_sell_record:
resource: "@AppBundle/Controller/SellRecordController.php"
type: annotation
hwi_oauth_redirect:
resource: "@HWIOAuthBundle/Resources/config/routing/redirect.xml"
prefix: /connect
hwi_oauth_connect:
resource: "@HWIOAuthBundle/Resources/config/routing/connect.xml"
prefix: /connect
#hwi_oauth_login:
# resource: "@HWIOAuthBundle/Resources/config/routing/login.xml"
# prefix: /login
facebook_login:
path: /login/check-facebook
google_login:
path: /login/check-google
custom_login:
path: /login/check-custom
twitter_login:
path: /login/check-twitter
app:
resource: '@AppBundle/Controller/'
type: annotation
fos_user:
resource: "@FOSUserBundle/Resources/config/routing/all.xml"
get_my_products:
path: /get-my-products

View File

@ -8,41 +8,38 @@ security:
fos_userbundle:
id: fos_user.user_provider.username
firewalls:
# disables authentication for assets and the profiler, adapt it according to your needs
dev:
pattern: ^/(_(profiler|wdt)|css|images|js)/
security: false
main:
secured_area:
pattern: ^/
anonymous: ~
logout_on_user_change: true
form_login:
provider: fos_userbundle
csrf_token_generator: security.csrf.token_manager
default_target_path: dashboard
logout: true
logout:
path: /logout
target: /login
anonymous: true
logout_on_user_change: true
# https://symfony.com/doc/current/security/form_login_setup.html
# activate different ways to authenticate
# https://symfony.com/doc/current/security.html#a-configuring-how-your-users-will-authenticate
#http_basic: ~
secured_area:
anonymous: ~
logout_on_user_change: true
oauth:
resource_owners:
facebook: "/login/check-facebook"
google: "/login/check-google"
# my_custom_provider: "/login/check-custom"
disqus: "/login/check-disqus"
twitter: "/login/check-twitter"
login_path: /login
use_forward: false
failure_path: /login
oauth_user_provider:
service: my.oauth_aware.user_provider.service
service: my.custom.user_provider
# disables authentication for assets and the profiler, adapt it according to your needs
dev:
pattern: ^/(_(profiler|wdt)|css|images|js)/
security: false
# https://symfony.com/doc/current/security/form_login_setup.html
# activate different ways to authenticate
# https://symfony.com/doc/current/security.html#a-configuring-how-your-users-will-authenticate
#http_basic: ~
role_hierarchy:
ROLE_ADMIN: ROLE_USER
ROLE_SUPER_ADMIN: ROLE_ADMIN

View File

@ -4,10 +4,12 @@ parameters:
#parameter_name: value
services:
em:
alias: doctrine.orm.entity_manager
# default configuration for services in *this* file
_defaults:
# automatically injects dependencies in your services
autowire: true
autowire: false
# automatically registers your services as commands, event subscribers, etc.
autoconfigure: true
# this means you cannot fetch services directly from the container via $container->get()
@ -33,8 +35,17 @@ services:
# AppBundle\Service\ExampleService:
# arguments:
# $someArgument: 'some_value'
# OAUTH
my.oauth_aware.user_provider.service:
class: HWI\Bundle\OAuthBundle\Security\Core\User\FOSUBUserProvider
arguments:
- '@fos_user.user_manager'
- ['pass properties as array']
- ['@fos_user.user_manager', twitter: twitter_id]
- 'doctrine.orm.default_entity_manager'
my.custom.user_provider:
class: AppBundle\Security\Core\User\MyFOSUBUserProvider
arguments:
- '@fos_user.user_manager'
- ['@fos_user.user_manager', twitter: twitter_id]
- '@doctrine.orm.default_entity_manager'

View File

@ -1,9 +1,11 @@
@import 'pages/libs';
@import 'fonts/all';
@import 'split/override_libs';
@import 'split/custom_vars';
@import 'split/formulaires';
@import 'split/typo';
@import 'pages/global';
//@import 'pages/demo';
@import 'pages/home';
@import 'pages/special';
@import 'pages/responsive';

6
assets/css/fonts/all.scss Executable file
View File

@ -0,0 +1,6 @@
@font-face {
font-family: "Source Sans";
src: url("source-sans-pro/SourceSansPro-Bold.otf") format('opentype');
src: url("source-sans-pro/SourceSansPro-Regular.otf") format('opentype');
src: url("source-sans-pro/SourceSansPro-Light.otf") format('opentype');
}

View File

@ -0,0 +1,43 @@
Copyright 2010, 2012 Adobe Systems Incorporated (http://www.adobe.com/), with Reserved Font Name 'Source'. All Rights Reserved. Source is a trademark of Adobe Systems Incorporated in the United States and/or other countries.
This Font Software is licensed under the SIL Open Font License, Version 1.1.
This license is copied below, and is also available with a FAQ at: http://scripts.sil.org/OFL
-----------------------------------------------------------
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
-----------------------------------------------------------
PREAMBLE
The goals of the Open Font License (OFL) are to stimulate worldwide development of collaborative font projects, to support the font creation efforts of academic and linguistic communities, and to provide a free and open framework in which fonts may be shared and improved in partnership with others.
The OFL allows the licensed fonts to be used, studied, modified and redistributed freely as long as they are not sold by themselves. The fonts, including any derivative works, can be bundled, embedded, redistributed and/or sold with any software provided that any reserved names are not used by derivative works. The fonts and derivatives, however, cannot be released under any other type of license. The requirement for fonts to remain under this license does not apply to any document created using the fonts or their derivatives.
DEFINITIONS
"Font Software" refers to the set of files released by the Copyright Holder(s) under this license and clearly marked as such. This may include source files, build scripts and documentation.
"Reserved Font Name" refers to any names specified as such after the copyright statement(s).
"Original Version" refers to the collection of Font Software components as distributed by the Copyright Holder(s).
"Modified Version" refers to any derivative made by adding to, deleting, or substituting -- in part or in whole -- any of the components of the Original Version, by changing formats or by porting the Font Software to a new environment.
"Author" refers to any designer, engineer, programmer, technical writer or other person who contributed to the Font Software.
PERMISSION & CONDITIONS
Permission is hereby granted, free of charge, to any person obtaining a copy of the Font Software, to use, study, copy, merge, embed, modify, redistribute, and sell modified and unmodified copies of the Font Software, subject to the following conditions:
1) Neither the Font Software nor any of its individual components, in Original or Modified Versions, may be sold by itself.
2) Original or Modified Versions of the Font Software may be bundled, redistributed and/or sold with any software, provided that each copy contains the above copyright notice and this license. These can be included either as stand-alone text files, human-readable headers or in the appropriate machine-readable metadata fields within text or binary files as long as those fields can be easily viewed by the user.
3) No Modified Version of the Font Software may use the Reserved Font Name(s) unless explicit written permission is granted by the corresponding Copyright Holder. This restriction only applies to the primary font name as presented to the users.
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font Software shall not be used to promote, endorse or advertise any Modified Version, except to acknowledge the contribution(s) of the Copyright Holder(s) and the Author(s) or with their explicit written permission.
5) The Font Software, modified or unmodified, in part or in whole, must be distributed entirely under this license, and must not be distributed under any other license. The requirement for fonts to remain under this license does not apply to any document created using the Font Software.
TERMINATION
This license becomes null and void if any of the above conditions are not met.
DISCLAIMER
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM OTHER DEALINGS IN THE FONT SOFTWARE.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -2,6 +2,9 @@ $brand-primary: darken(#428bca, 20%);
// the ~ allows you to reference things in node_modules
@import '~bootstrap-sass/assets/stylesheets/bootstrap';
html, h1, h2, h3, h4, h5, h6 {
font-family: Source Sans, Arial, Helvetica, sans-serif;
}
input {
width: auto;

View File

@ -12,10 +12,41 @@ body {
min-height: 80vh;
}
.bg-dark {
background: rgba(0, 0, 0, 0.25);
}
.bg-shader {
@extend .bg-dark;
height: 100vh;
}
.bg-img {
background-image: url('bg.jpg');
background-attachment: fixed;
background-size: cover;
overflow: hidden;
min-height: 100vh;
}
.bg-accessories {
@extend .bg-img;
background-image: url('../../img/accessories.jpg');
}
.bg-girl {
@extend .bg-img;
background-image: url('../../img/girl_computer.jpg');
}
.bg-color {
background: #1b6d85;
color: white;
a {
color: lightblue;
}
padding: 1rem;
}
.logo-main {
@ -47,7 +78,6 @@ label {
.try {
margin: 0 auto;
text-align: center;
}
.padded {

23
assets/css/pages/home.scss Executable file
View File

@ -0,0 +1,23 @@
.main-section {
padding: 1rem;
display: flex;
color: white;
justify-content: center;
h1 {
font-size: 4em;
}
h2 {
color: $light !important;
}
> div {
height: 80vh;
padding-top: 25vh;
max-widht: 50%;
}
}
.product-values {
color: white;
padding: 4rem;
}

View File

@ -1,4 +1,4 @@
$dark: #222;
$light: #dedede;
$logo-color: mediumslateblue;
$all-text-color: mix(mediumslateblue, $dark);
$logo-color: mix(mediumslateblue, white);
$all-text-color: mix(mediumslateblue, $light);

0
assets/css/split/override_libs.scss Normal file → Executable file
View File

0
assets/css/split/typo.scss Normal file → Executable file
View File

BIN
assets/img/accessories.jpg Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 188 KiB

View File

Before

Width:  |  Height:  |  Size: 176 KiB

After

Width:  |  Height:  |  Size: 176 KiB

BIN
assets/img/girl_computer.jpg Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 247 KiB

View File

@ -24,10 +24,10 @@
"doctrine/doctrine-bundle": "^1.6",
"doctrine/orm": "^2.5",
"friendsofsymfony/user-bundle": "~2.0",
"hwi/oauth-bundle": "^0.6.1",
"hwi/oauth-bundle": "^0.6.2",
"incenteev/composer-parameter-handler": "^2.0",
"php-http/guzzle6-adapter": "^1.1",
"php-http/httplug-bundle": "^1.9",
"php-http/httplug-bundle": "^1.10",
"sensio/distribution-bundle": "^5.0.19",
"sensio/framework-extra-bundle": "^5.0.0",
"symfony/monolog-bundle": "^3.1.0",

2
composer.lock generated
View File

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically"
],
"content-hash": "c18164d1db85ea9fbbe32f2bfbea9ebc",
"content-hash": "340327e74f4d3713baf607c9a61fc0e9",
"packages": [
{
"name": "clue/stream-filter",

View File

@ -54,7 +54,10 @@ class DefaultController extends Controller {
0,
1 );
}
if($lastFestival){
$lastFestival->recalculateChiffreAffaire();
}
$categRepo = $m->getRepository( 'AppBundle:ProductCategory' );
$sellingRepo = $m->getRepository( 'AppBundle:SellRecord' );
$categories = $categRepo->findAll();

View File

@ -0,0 +1,38 @@
<?php
namespace AppBundle\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Security\Csrf\CsrfTokenManagerInterface;
class LegalController extends Controller {
private $tokenManager;
public function __construct( CsrfTokenManagerInterface $tokenManager = null ) {
$this->tokenManager = $tokenManager;
}
/**
* @Route("/tos", name="tos")
*/
public function tosAction( Request $request ) {
return $this->render( 'legal/tos.html.twig',
[] );
}
/**
* @Route("/privacy", name="privacy")
*/
public function privacyAction( Request $request ) {
// replace this example code with whatever you need
return $this->render( 'legal/privacy.html.twig',
[] );
}
}

0
src/AppBundle/Entity/Festival.php Normal file → Executable file
View File

View File

@ -286,4 +286,92 @@ class Festival {
public function getChiffreAffaire() {
return $this->chiffreAffaire;
}
/**
* Set fraisInscription.
*
* @param string|null $fraisInscription
*
* @return Festival
*/
public function setFraisInscription( $fraisInscription = null ) {
$this->fraisInscription = $fraisInscription;
return $this;
}
/**
* Get fraisInscription.
*
* @return string|null
*/
public function getFraisInscription() {
return $this->fraisInscription;
}
/**
* Set fraisHebergement.
*
* @param string|null $fraisHebergement
*
* @return Festival
*/
public function setFraisHebergement( $fraisHebergement = null ) {
$this->fraisHebergement = $fraisHebergement;
return $this;
}
/**
* Get fraisHebergement.
*
* @return string|null
*/
public function getFraisHebergement() {
return $this->fraisHebergement;
}
/**
* Set fraisTransport.
*
* @param string|null $fraisTransport
*
* @return Festival
*/
public function setFraisTransport( $fraisTransport = null ) {
$this->fraisTransport = $fraisTransport;
return $this;
}
/**
* Get fraisTransport.
*
* @return string|null
*/
public function getFraisTransport() {
return $this->fraisTransport;
}
/**
* Set fraisRepas.
*
* @param string|null $fraisRepas
*
* @return Festival
*/
public function setFraisRepas( $fraisRepas = null ) {
$this->fraisRepas = $fraisRepas;
return $this;
}
/**
* Get fraisRepas.
*
* @return string|null
*/
public function getFraisRepas() {
return $this->fraisRepas;
}
}

44
src/AppBundle/Entity/Product.php Normal file → Executable file
View File

@ -42,6 +42,10 @@ class Product {
* @ORM\ManyToOne(targetEntity="AppBundle\Entity\User", inversedBy="products")
*/
private $user;
/**
* @ORM\OneToMany(targetEntity="AppBundle\Entity\ProductSold", mappedBy="product")
*/
private $productsSold;
use Sellable;
use Commentable;
@ -165,4 +169,44 @@ class Product {
public function getStockCount() {
return $this->stockCount;
}
/**
* Constructor
*/
public function __construct() {
$this->productsSold = new \Doctrine\Common\Collections\ArrayCollection();
}
/**
* Add productsSold.
*
* @param \AppBundle\Entity\User $productsSold
*
* @return Product
*/
public function addProductsSold( \AppBundle\Entity\User $productsSold ) {
$this->productsSold[] = $productsSold;
return $this;
}
/**
* Remove productsSold.
*
* @param \AppBundle\Entity\User $productsSold
*
* @return boolean TRUE if this collection contained the specified element, FALSE otherwise.
*/
public function removeProductsSold( \AppBundle\Entity\User $productsSold ) {
return $this->productsSold->removeElement( $productsSold );
}
/**
* Get productsSold.
*
* @return \Doctrine\Common\Collections\Collection
*/
public function getProductsSold() {
return $this->productsSold;
}
}

View File

@ -42,6 +42,10 @@ class Product {
* @ORM\ManyToOne(targetEntity="AppBundle\Entity\User", inversedBy="products")
*/
private $user;
/**
* @ORM\OneToMany(targetEntity="AppBundle\Entity\ProductSold", mappedBy="product")
*/
private $productsSold;
use Sellable;
use Commentable;
@ -165,4 +169,44 @@ class Product {
public function getStockCount() {
return $this->stockCount;
}
/**
* Constructor
*/
public function __construct() {
$this->productsSold = new \Doctrine\Common\Collections\ArrayCollection();
}
/**
* Add productsSold.
*
* @param \AppBundle\Entity\User $productsSold
*
* @return Product
*/
public function addProductsSold( \AppBundle\Entity\User $productsSold ) {
$this->productsSold[] = $productsSold;
return $this;
}
/**
* Remove productsSold.
*
* @param \AppBundle\Entity\User $productsSold
*
* @return boolean TRUE if this collection contained the specified element, FALSE otherwise.
*/
public function removeProductsSold( \AppBundle\Entity\User $productsSold ) {
return $this->productsSold->removeElement( $productsSold );
}
/**
* Get productsSold.
*
* @return \Doctrine\Common\Collections\Collection
*/
public function getProductsSold() {
return $this->productsSold;
}
}

0
src/AppBundle/Entity/ProductCategory.php Normal file → Executable file
View File

0
src/AppBundle/Entity/ProductSold.php Normal file → Executable file
View File

0
src/AppBundle/Entity/SellRecord.php Normal file → Executable file
View File

82
src/AppBundle/Entity/User.php Normal file → Executable file
View File

@ -21,6 +21,16 @@ class User extends BaseUser {
*/
protected $id;
/**
* @ORM\Column(name="twitter_id", type="string", length=255, nullable=true)
*/
private $twitterId;
private $twitterAccessToken;
/**
* @ORM\Column(name="disqus_id", type="string", length=255, nullable=true)
*/
private $disqusId;
private $disqusAccessToken;
/**
* @ORM\Column(name="google_id", type="string", length=255, nullable=true)
*/
@ -117,6 +127,34 @@ class User extends BaseUser {
$this->googleAccessToken = $googleAccessToken;
}
/**
* @return mixed
*/
public function getDisqusAccessToken() {
return $this->disqusAccessToken;
}
/**
* @param mixed $disqusAccessToken
*/
public function setDisqusAccessToken( $disqusAccessToken ) {
$this->disqusAccessToken = $disqusAccessToken;
}
/**
* @return mixed
*/
public function getTwitterAccessToken() {
return $this->twitterAccessToken;
}
/**
* @param mixed $twitterAccessToken
*/
public function setTwitterAccessToken( $TwitterAccessToken ) {
$this->twitterAccessToken = $TwitterAccessToken;
}
/**
* @return mixed
*/
@ -305,4 +343,48 @@ class User extends BaseUser {
public function getActiveFestival() {
return $this->activeFestival;
}
/**
* Set twitterId.
*
* @param string|null $twitterId
*
* @return User
*/
public function setTwitterId( $twitterId = null ) {
$this->twitterId = $twitterId;
return $this;
}
/**
* Get twitterId.
*
* @return string|null
*/
public function getTwitterId() {
return $this->twitterId;
}
/**
* Set disqusId.
*
* @param string|null $disqusId
*
* @return User
*/
public function setDisqusId( $disqusId = null ) {
$this->disqusId = $disqusId;
return $this;
}
/**
* Get disqusId.
*
* @return string|null
*/
public function getDisqusId() {
return $this->disqusId;
}
}

View File

@ -21,6 +21,16 @@ class User extends BaseUser {
*/
protected $id;
/**
* @ORM\Column(name="twitter_id", type="string", length=255, nullable=true)
*/
private $twitterId;
private $twitterAccessToken;
/**
* @ORM\Column(name="disqus_id", type="string", length=255, nullable=true)
*/
private $disqusId;
private $disqusAccessToken;
/**
* @ORM\Column(name="google_id", type="string", length=255, nullable=true)
*/
@ -305,4 +315,48 @@ class User extends BaseUser {
public function getActiveFestival() {
return $this->activeFestival;
}
/**
* Set twitterId.
*
* @param string|null $twitterId
*
* @return User
*/
public function setTwitterId( $twitterId = null ) {
$this->twitterId = $twitterId;
return $this;
}
/**
* Get twitterId.
*
* @return string|null
*/
public function getTwitterId() {
return $this->twitterId;
}
/**
* Set disqusId.
*
* @param string|null $disqusId
*
* @return User
*/
public function setDisqusId( $disqusId = null ) {
$this->disqusId = $disqusId;
return $this;
}
/**
* Get disqusId.
*
* @return string|null
*/
public function getDisqusId() {
return $this->disqusId;
}
}

View File

@ -0,0 +1,111 @@
<?php
namespace AppBundle\Security\Core\User;
use AppBundle\Entity\User;
use Doctrine\ORM\EntityManager;
use FOS\UserBundle\Model\UserManagerInterface;
use HWI\Bundle\OAuthBundle\OAuth\Response\UserResponseInterface;
use HWI\Bundle\OAuthBundle\Security\Core\User\FOSUBUserProvider as BaseFOSUBProvider;
use Symfony\Component\Security\Core\User\UserInterface;
class MyFOSUBUserProvider extends BaseFOSUBProvider {
private $em;
/**
* MyFOSUBUserProvider constructor.
*
* @param UserManagerInterface $userManager
* @param array $properties
* @param EntityManager $em
*/
public function __construct(
UserManagerInterface $userManager,
array $properties,
EntityManager $em
) {
$this->em = $em;
parent::__construct( $userManager, $properties );
}
/**
* {@inheritDoc}
*/
public
function connect(
UserInterface $user,
UserResponseInterface $response
) {
// get property from provider configuration by provider name
// , it will return `facebook_id` in that case (see service definition below)
$property = $this->getProperty( $response );
$username = $response->getUsername(); // get the unique user identifier
//we "disconnect" previously connected users
$existingUser = $this->userManager->findUserBy( [ $property => $username ] );
if ( null !== $existingUser ) {
// set current user id and token to null for disconnect
// ...
$this->userManager->updateUser( $existingUser );
}
// we connect current user, set current user id and token
// ...
$this->userManager->updateUser( $user );
}
/**
* {@inheritdoc}
*/
public
function loadUserByOAuthUserResponse(
UserResponseInterface $response
) {
$userEmail = $response->getEmail();
$username = $response->getRealName();
$user = null;
$em = $this->em;
if ( $userEmail ) {
$user = $this->userManager->findUserByEmail( $userEmail );
} elseif ( $username ) {
$user = $this->userManager->findUserByUsername( $username );
}
// if null just create new user and set it properties
if ( null === $user ) {
$user = new User();
$data = $response->getData();
if ( ! $userEmail ) {
$ressourceOwner = $response->getResourceOwner();
$userEmail = $username . '@' . $ressourceOwner->getName() . '.com';
}
if ( $ressourceOwner == 'twitter' ) {
$userId = $data[ "id" ];
$user->setTwitterId( $userId );
}
$user
->setUsername( $username )
->setPassword( 'sdfvjsdjfsdsjmldfvlkjsdkjlqlkjef56f4sr46g58s6z8r4g+97sr47hz+4' )
->setEmail( $userEmail )
->setEmailCanonical( $userEmail );
// ... save user to database
$em->persist( $user );
$em->flush();
return $user;
}
// else update access token of existing user
$serviceName = $response->getResourceOwner()->getName();
$setter = 'set' . ucfirst( $serviceName ) . 'AccessToken';
$user->$setter( $response->getAccessToken() );//update access token
$em->persist( $user );
$em->flush();
return $user;
}
}

View File

@ -1,24 +0,0 @@
<?php
namespace App\Entity\User;
use MsgPhp\User\Entity\User as BaseUser;
use MsgPhp\User\UserIdInterface;
/**
* @final
*/
class User extends BaseUser
{
private $id;
public function __construct(UserIdInterface $id)
{
$this->id = $id;
}
public function getId(): UserIdInterface
{
return $this->id;
}
}

View File

@ -148,7 +148,7 @@ class PhpIniRequirement extends Requirement
}
if (null === $helpHtml) {
$helpHtml = sprintf('Set <strong>%s</strong> to <strong>%s</strong> in php.ini<a class="btn btn-primary" href="#phpini">*</a>.',
$helpHtml = sprintf('Set <strong>%s</strong> to <strong>%s</strong> in php.ini<a href="#phpini">*</a>.',
$cfgName,
$evaluation ? 'on' : 'off'
);
@ -419,7 +419,7 @@ class SymfonyRequirements extends RequirementCollection
$this->addRequirement(
is_dir(__DIR__.'/../vendor/composer'),
'Vendor libraries must be installed',
'Vendor libraries are missing. Install composer following instructions from <a class="btn btn-primary" href="http://getcomposer.org/">http://getcomposer.org/</a>. '.
'Vendor libraries are missing. Install composer following instructions from <a href="http://getcomposer.org/">http://getcomposer.org/</a>. '.
'Then run "<strong>php composer.phar install</strong>" to install them.'
);
@ -443,7 +443,7 @@ class SymfonyRequirements extends RequirementCollection
$this->addPhpIniRequirement(
'date.timezone', true, false,
'date.timezone setting must be set',
'Set the "<strong>date.timezone</strong>" setting in php.ini<a class="btn btn-primary" href="#phpini">*</a> (like Europe/Paris).'
'Set the "<strong>date.timezone</strong>" setting in php.ini<a href="#phpini">*</a> (like Europe/Paris).'
);
}
@ -458,7 +458,7 @@ class SymfonyRequirements extends RequirementCollection
$this->addRequirement(
isset($timezones[@date_default_timezone_get()]),
sprintf('Configured default timezone "%s" must be supported by your installation of PHP', @date_default_timezone_get()),
'Your default timezone is not supported by PHP. Check for typos in your <strong>php.ini</strong> file and have a look at the list of deprecated timezones at <a class="btn btn-primary" href="http://php.net/manual/en/timezones.others.php">http://php.net/manual/en/timezones.others.php</a>.'
'Your default timezone is not supported by PHP. Check for typos in your <strong>php.ini</strong> file and have a look at the list of deprecated timezones at <a href="http://php.net/manual/en/timezones.others.php">http://php.net/manual/en/timezones.others.php</a>.'
);
}
@ -522,7 +522,7 @@ class SymfonyRequirements extends RequirementCollection
create_function('$cfgValue', 'return false !== stripos($cfgValue, "phar");'),
false,
'suhosin.executor.include.whitelist must be configured correctly in php.ini',
'Add "<strong>phar</strong>" to <strong>suhosin.executor.include.whitelist</strong> in php.ini<a class="btn btn-primary" href="#phpini">*</a>.'
'Add "<strong>phar</strong>" to <strong>suhosin.executor.include.whitelist</strong> in php.ini<a href="#phpini">*</a>.'
);
}
@ -540,7 +540,7 @@ class SymfonyRequirements extends RequirementCollection
create_function('$cfgValue', 'return $cfgValue > 100;'),
true,
'xdebug.max_nesting_level should be above 100 in php.ini',
'Set "<strong>xdebug.max_nesting_level</strong>" to e.g. "<strong>250</strong>" in php.ini<a class="btn btn-primary" href="#phpini">*</a> to stop Xdebug\'s infinite recursion protection erroneously throwing a fatal error in your project.'
'Set "<strong>xdebug.max_nesting_level</strong>" to e.g. "<strong>250</strong>" in php.ini<a href="#phpini">*</a> to stop Xdebug\'s infinite recursion protection erroneously throwing a fatal error in your project.'
);
}
@ -558,7 +558,7 @@ class SymfonyRequirements extends RequirementCollection
create_function('$cfgValue', 'return (int) $cfgValue === 0;'),
true,
'string functions should not be overloaded',
'Set "<strong>mbstring.func_overload</strong>" to <strong>0</strong> in php.ini<a class="btn btn-primary" href="#phpini">*</a> to disable function overloading by the mbstring extension.'
'Set "<strong>mbstring.func_overload</strong>" to <strong>0</strong> in php.ini<a href="#phpini">*</a> to disable function overloading by the mbstring extension.'
);
}
@ -707,7 +707,7 @@ class SymfonyRequirements extends RequirementCollection
create_function('$cfgValue', 'return (int) $cfgValue === 0;'),
true,
'intl.error_level should be 0 in php.ini',
'Set "<strong>intl.error_level</strong>" to "<strong>0</strong>" in php.ini<a class="btn btn-primary" href="#phpini">*</a> to inhibit the messages when an error occurs in ICU functions.'
'Set "<strong>intl.error_level</strong>" to "<strong>0</strong>" in php.ini<a href="#phpini">*</a> to inhibit the messages when an error occurs in ICU functions.'
);
}
@ -735,7 +735,7 @@ class SymfonyRequirements extends RequirementCollection
$this->addRecommendation(
$this->getRealpathCacheSize() >= 5 * 1024 * 1024,
'realpath_cache_size should be at least 5M in php.ini',
'Setting "<strong>realpath_cache_size</strong>" to e.g. "<strong>5242880</strong>" or "<strong>5M</strong>" in php.ini<a class="btn btn-primary" href="#phpini">*</a> may improve performance on Windows significantly in some cases.'
'Setting "<strong>realpath_cache_size</strong>" to e.g. "<strong>5242880</strong>" or "<strong>5M</strong>" in php.ini<a href="#phpini">*</a> may improve performance on Windows significantly in some cases.'
);
}

2
web/config.php Normal file → Executable file
View File

@ -410,7 +410,7 @@ $hasMinorProblems = (bool) count($minorProblems);
<ul class="symfony-install-continue">
<?php if ($hasMajorProblems || $hasMinorProblems): ?>
<li><a class="btn btn-primary" href="config.php">Re-check configuration</a></li>
<li><a href="config.php">Re-check configuration</a></li>
<?php endif; ?>
</ul>
</div>

BIN
web/modele_import_caisse.csv Normal file → Executable file

Binary file not shown.
Can't render this file because it contains an unexpected character in line 1 and column 4.