correct fosub cycles

This commit is contained in:
Kayn Ty 2018-05-08 11:27:06 +02:00
parent b4d819dd22
commit ddc8df4af1
16 changed files with 102 additions and 203 deletions

View File

@ -1,8 +1,8 @@
<?php <?php
use Symfony\Component\Config\Loader\LoaderInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\HttpKernel\Kernel;
use Symfony\Component\Config\Loader\LoaderInterface;
class AppKernel extends Kernel { class AppKernel extends Kernel {
public function registerBundles() { public function registerBundles() {
@ -16,8 +16,8 @@ class AppKernel extends Kernel {
new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(), new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(),
new AppBundle\AppBundle(), new AppBundle\AppBundle(),
new FOS\UserBundle\FOSUserBundle(), new FOS\UserBundle\FOSUserBundle(),
new Http\HttplugBundle\HttplugBundle(), // new Http\HttplugBundle\HttplugBundle(),
new HWI\Bundle\OAuthBundle\HWIOAuthBundle(), // new HWI\Bundle\OAuthBundle\HWIOAuthBundle(),
]; ];
if ( in_array( $this->getEnvironment(), [ 'dev', 'test' ], true ) ) { if ( in_array( $this->getEnvironment(), [ 'dev', 'test' ], true ) ) {

View File

@ -11,7 +11,7 @@
ou bien, ou bien,
<a class="btn btn-info" href="{{ path('fos_user_security_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') }}"> <a class="btn btn-info" href="{{ path('fos_user_resetting_request') }}">
Mot de passe oublié? Mot de passe oublié?
</a> </a>

View File

@ -1,5 +1,5 @@
{% extends "@FOSUser/layout.html.twig" %} {% extends "@FOSUser/layout.html.twig" %}
{% trans_default_domain 'FOSUserBundle' %}
{% block fos_user_content %} {% block fos_user_content %}
<div class="row"> <div class="row">
<div class="col-xs-6"> <div class="col-xs-6">
@ -8,7 +8,7 @@
</div> </div>
<div class="col-xs-6"> <div class="col-xs-6">
ou bien, 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>#}
</div> </div>
</div> </div>

View File

@ -1,54 +1,60 @@
{% extends "@FOSUser/layout.html.twig" %} {% extends "@FOSUser/layout.html.twig" %}
{% trans_default_domain 'FOSUserBundle' %}
{% block fos_user_content %}
<div class="row">
<div class="col-xs-6">
<h1>
<i class="fa fa-key"></i>
Se connecter
</h1>
{% if error %}
<div class="alert alert-info">{{ error.messageKey|trans(error.messageData, 'security') }}</div>
{% endif %}
{% block bigMain %} <form action="{{ path("fos_user_security_check") }}" method="post">
{% block fos_user_content %} {% if csrf_token %}
<div class="row"> <input type="hidden" name="_csrf_token" value="{{ csrf_token }}"/>
<div class="col-xs-6">
<h1>
<i class="fa fa-key"></i>
Se connecter
</h1>
{% if error %}
<div>{{ error.messageKey|trans(error.messageData, 'security') }}</div>
{% endif %} {% endif %}
<div>
<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> <label for="username">{{ 'security.login.username'|trans }}</label>
<input type="text" id="username" name="_username" value="{{ last_username }}" required="required" <input type="text" id="username" name="_username" value="{{ last_username }}" required="required"
autocomplete="username"/> autocomplete="username"/>
</div>
<div>
<label for="password">{{ 'security.login.password'|trans }}</label> <label for="password">{{ 'security.login.password'|trans }}</label>
<input type="password" id="password" name="_password" required="required" <input type="password" id="password" name="_password" required="required"
autocomplete="current-password"/> autocomplete="current-password"/>
</div>
<div>
<input type="checkbox" id="remember_me" name="_remember_me" value="on"/> <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="submit" id="_submit" name="_submit" value="{{ 'security.login.submit'|trans }}"/>
</form>
</div> </div>
<div class="col-xs-6">
<p>
<a class="btn btn-info" href="{{ path('fos_user_resetting_request') }}"> <input type="submit" id="_submit" name="_submit" value="{{ 'security.login.submit'|trans }}"/>
Mot de passe oublié? </form>
</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">
<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>
{% endblock fos_user_content %}
{% endblock %} {% endblock %}

View File

@ -1,4 +1,4 @@
{% extends '::default/index.html.twig' %} {% extends 'base.html.twig' %}
{% trans_default_domain 'FOSUserBundle' %} {% trans_default_domain 'FOSUserBundle' %}
{% block title %}Caisse{% endblock %} {% block title %}Caisse{% endblock %}
@ -10,47 +10,6 @@
<div class="col-md-auto"> <div class="col-md-auto">
<fieldset class="bg-shader pull-left form-group padded"> <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 %} {% block fos_user_content %}{% endblock %}
</fieldset> </fieldset>

View File

@ -71,18 +71,18 @@
</div> </div>
</div> </div>
<div class="col-xs-6"> <div class="col-xs-6">
{% block hwi_oauth_content %} {#{% block hwi_oauth_content %}#}
<h1>oauth login</h1> {#<h1>oauth login</h1>#}
{% if error is defined and error %} {#{% if error is defined and error %}#}
<div class="alert alert-danger pull-left">{{ error|trans }}</div> {#<div class="alert alert-danger pull-left">{{ error|trans }}</div>#}
{% endif %} {#{% endif %}#}
<a class="btn btn-default btn-{{ "twitter" }}" {#<a class="btn btn-default btn-{{ "twitter" }}"#}
href="{{ hwi_oauth_login_url("twitter") }}"> {#href="{{ hwi_oauth_login_url("twitter") }}">#}
<i class="fa fa-{{ "twitter" }}"></i> {#<i class="fa fa-{{ "twitter" }}"></i>#}
{{ "twitter" | trans({}, 'HWIOAuthBundle') }} {#{{ "twitter" | trans({}, 'HWIOAuthBundle') }}#}
</a> {#</a>#}
{% endblock hwi_oauth_content %} {#{% endblock hwi_oauth_content %}#}
</div> </div>
</div> </div>
</fieldset> </fieldset>

View File

@ -33,8 +33,8 @@
</form> </form>
</div> </div>
<div class="col-xs-6"> <div class="col-xs-6">
{% block hwi_oauth_content %} {#{% block hwi_oauth_content %}#}
{% endblock %} {#{% endblock %}#}
</div> </div>
</div> </div>

View File

@ -3,6 +3,8 @@
<div class="container"> <div class="container">
<div class="row"> <div class="row">
<div class="col-xs-12"> <div class="col-xs-12">
{% include 'default/login-choices.html.twig' %} {% include 'default/login-choices.html.twig' %}
</div> </div>
</div> </div>

View File

@ -3,11 +3,16 @@
<div class="loginland "> <div class="loginland ">
<div class="login-choices"> <div class="login-choices">
<a href="{{ path('homepage') }}" class="btn btn-default logo-home pull-left">
<i class="fa fa-home"></i>
Caisse Bliss
</a>
{% if is_granted("IS_AUTHENTICATED_REMEMBERED") %} {% if is_granted("IS_AUTHENTICATED_REMEMBERED") %}
<div class="row"> <div class="row">
<div class="col-xs-9"> <div class="col-xs-9">
<div id="menu-dashboard"> <div id="menu-dashboard">
<ul class="nav nav-pills"> <ul class="nav nav-pills pull-right">
<li> <li>
<a class="btn {% if app.request.attributes.get('_route') == 'homepage' %} <a class="btn {% if app.request.attributes.get('_route') == 'homepage' %}
btn-success btn-success
@ -113,23 +118,14 @@
{% else %} {% else %}
<h1 class="text-right"> <div class="text-right pull-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" <a class="btn btn-primary"
href="{{ path('fos_user_security_login') }}"> href="{{ path('fos_user_security_login') }}">
<i class="fa fa-key"></i> <i class="fa fa-key"></i>
{{ 'layout.login'|trans }}</a> {{ 'layout.login'|trans }}</a>
<a class="btn btn-default" <a class="btn btn-default"
href="{{ path('fos_user_registration_register') }}">{{ 'layout.register'|trans }}</a> href="{{ path('fos_user_registration_register') }}">{{ 'layout.register'|trans }}</a>
</h1> </div>
{% endif %} {% endif %}
</div> </div>
</div> </div>

View File

@ -70,10 +70,10 @@
</p> </p>
</div> </div>
<div class="col-xs-6"> <div class="col-xs-6">
<a class="btn btn-default" href="{{ path('fos_user_security_login') }}"> {#<a class="btn btn-default" href="{{ path('fos_user_security_login') }}">#}
<i class="fa fa-key"></i> {#<i class="fa fa-key"></i>#}
Se connecter {#Se connecter#}
</a> {#</a>#}
<a class="btn btn-primary" href="{{ path('fos_user_registration_register') }}"> <a class="btn btn-primary" href="{{ path('fos_user_registration_register') }}">
<i class="fa fa-user"></i> <i class="fa fa-user"></i>
Créer un compte Créer un compte

View File

@ -74,7 +74,7 @@ swiftmailer:
#fos user bundle #fos user bundle
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: main
user_class: AppBundle\Entity\User user_class: AppBundle\Entity\User
registration: registration:
confirmation: confirmation:
@ -82,50 +82,3 @@ fos_user:
from_email: from_email:
address: "%mailer_user%" address: "%mailer_user%"
sender_name: "%mailer_user%" sender_name: "%mailer_user%"
# oauth land
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
# set then the user will be redirected to the original resource that they requested, or
# the base address if no resource was requested. This is similar to the behaviour of
# [target_path_parameter for form login](http://symfony.com/doc/2.0/cookbook/security/form_login.html).
# target_path_parameter: _destination
# an optional setting to use the HTTP REFERER header to be used in case no
# previous URL was stored in the session (i.e. no resource was requested).
# This is similar to the behaviour of
# [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
twitter:
type: twitter
client_id: "%twitter_id%"
client_secret: "%twitter_secret%"
scope: "email"
options:
csrf: true
# disqus:
# type: disqus
# client_id: "%disqus_id%"
# client_secret: "%disqus_secret%"
# scope: "email"
# options:
# csrf: true

0
app/config/parameters.yml.save Normal file → Executable file
View File

View File

@ -1,27 +1,19 @@
hwi_oauth_login:
resource: "@HWIOAuthBundle/Resources/config/routing/login.xml"
prefix: /login
hwi_oauth_redirect: fos_user_profile:
resource: "@HWIOAuthBundle/Resources/config/routing/redirect.xml" resource: "@FOSUserBundle/Resources/config/routing/profile.xml"
prefix: /connect prefix: /profile
hwi_oauth_connect: fos_user_register:
resource: "@HWIOAuthBundle/Resources/config/routing/connect.xml" resource: "@FOSUserBundle/Resources/config/routing/registration.xml"
prefix: /connect prefix: /register
fos_user:
resource: "@FOSUserBundle/Resources/config/routing/all.xml"
#facebook_login:
# path: /login/check-facebook
google_login: fos_user_resetting:
path: /login/check-google resource: "@FOSUserBundle/Resources/config/routing/resetting.xml"
prefix: /resetting
disqus_login: fos_user_change_password:
path: /login/check-disqus resource: "@FOSUserBundle/Resources/config/routing/change_password.xml"
prefix: /profile
twitter_login:
path: /login/check-twitter
app: app:
resource: '@AppBundle/Controller/' resource: '@AppBundle/Controller/'
type: annotation type: annotation
@ -55,3 +47,6 @@ get_my_products:
add_selling: add_selling:
path: /add-selling path: /add-selling
defaults: { _controller: AppBundle:Default:addSelling } defaults: { _controller: AppBundle:Default:addSelling }
fos_user:
resource: "@FOSUserBundle/Resources/config/routing/all.xml"

View File

@ -1,4 +1,4 @@
# To get started with security, check out the documentation: # To get started with security, check out the documentation:# To get started with security, check out the documentation:
# https://symfony.com/doc/current/security.html # https://symfony.com/doc/current/security.html
security: security:
encoders: encoders:
@ -8,45 +8,31 @@ security:
fos_userbundle: fos_userbundle:
id: fos_user.user_provider.username id: fos_user.user_provider.username
firewalls: firewalls:
secured_area: 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: ~
main:
pattern: ^/ pattern: ^/
anonymous: ~ anonymous: ~
logout_on_user_change: true logout: true
form_login: form_login:
provider: fos_userbundle provider: fos_userbundle
csrf_token_generator: security.csrf.token_manager csrf_token_generator: security.csrf.token_manager
default_target_path: dashboard default_target_path: dashboard
logout: login_path: fos_user_security_login
path: /logout check_path: /login_check
target: /login
anonymous: true
logout_on_user_change: true
oauth:
resource_owners:
google: "/login/check-google"
disqus: "/login/check-disqus"
twitter: "/login/check-twitter"
login_path: /login
use_forward: false
failure_path: /login
oauth_user_provider:
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_hierarchy:
ROLE_ADMIN: ROLE_USER ROLE_ADMIN: ROLE_USER
ROLE_SUPER_ADMIN: ROLE_ADMIN ROLE_SUPER_ADMIN: ROLE_ADMIN
access_control: access_control:
- { path: ^/dashboard$, role: IS_AUTHENTICATED_REMEMBERED }
- { path: ^/login$, role: IS_AUTHENTICATED_ANONYMOUSLY } - { path: ^/login$, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/dashboard$, role: IS_AUTHENTICATED_REMEMBERED }
- { 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: ^/admin/, role: ROLE_ADMIN } - { path: ^/admin/, role: ROLE_ADMIN }

0
assets/css/pages/_dashboard.scss Normal file → Executable file
View File

View File

@ -0,0 +1,2 @@
layout.logout: __layout.logout
layout.register: __layout.register