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

View File

@ -11,7 +11,7 @@
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') }}">
Mot de passe oublié?
</a>

View File

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

View File

@ -1,6 +1,5 @@
{% extends "@FOSUser/layout.html.twig" %}
{% block bigMain %}
{% trans_default_domain 'FOSUserBundle' %}
{% block fos_user_content %}
<div class="row">
<div class="col-xs-6">
@ -9,25 +8,33 @@
Se connecter
</h1>
{% if error %}
<div>{{ error.messageKey|trans(error.messageData, 'security') }}</div>
<div class="alert alert-info">{{ 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 %}
<div>
<label for="username">{{ 'security.login.username'|trans }}</label>
<input type="text" id="username" name="_username" value="{{ last_username }}" required="required"
autocomplete="username"/>
</div>
<div>
<label for="password">{{ 'security.login.password'|trans }}</label>
<input type="password" id="password" name="_password" required="required"
autocomplete="current-password"/>
</div>
<div>
<input type="checkbox" id="remember_me" name="_remember_me" value="on"/>
<label for="remember_me">{{ 'security.login.remember_me'|trans }}</label>
</div>
<input type="submit" id="_submit" name="_submit" value="{{ 'security.login.submit'|trans }}"/>
</form>
@ -49,6 +56,5 @@
</div>
{% endblock fos_user_content %}
{% endblock %}

View File

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

View File

@ -71,18 +71,18 @@
</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 %}
{#{% 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>
{% endblock hwi_oauth_content %}
{#<a class="btn btn-default btn-{{ "twitter" }}"#}
{#href="{{ hwi_oauth_login_url("twitter") }}">#}
{#<i class="fa fa-{{ "twitter" }}"></i>#}
{#{{ "twitter" | trans({}, 'HWIOAuthBundle') }}#}
{#</a>#}
{#{% endblock hwi_oauth_content %}#}
</div>
</div>
</fieldset>

View File

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

View File

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

View File

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

View File

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

View File

@ -74,7 +74,7 @@ swiftmailer:
#fos user bundle
fos_user:
db_driver: orm # other valid values are 'mongodb' and 'couchdb'
firewall_name: secured_area
firewall_name: main
user_class: AppBundle\Entity\User
registration:
confirmation:
@ -82,50 +82,3 @@ fos_user:
from_email:
address: "%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:
resource: "@HWIOAuthBundle/Resources/config/routing/redirect.xml"
prefix: /connect
fos_user_profile:
resource: "@FOSUserBundle/Resources/config/routing/profile.xml"
prefix: /profile
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
fos_user_register:
resource: "@FOSUserBundle/Resources/config/routing/registration.xml"
prefix: /register
google_login:
path: /login/check-google
fos_user_resetting:
resource: "@FOSUserBundle/Resources/config/routing/resetting.xml"
prefix: /resetting
disqus_login:
path: /login/check-disqus
twitter_login:
path: /login/check-twitter
fos_user_change_password:
resource: "@FOSUserBundle/Resources/config/routing/change_password.xml"
prefix: /profile
app:
resource: '@AppBundle/Controller/'
type: annotation
@ -55,3 +47,6 @@ get_my_products:
add_selling:
path: /add-selling
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
security:
encoders:
@ -8,45 +8,31 @@ security:
fos_userbundle:
id: fos_user.user_provider.username
firewalls:
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:
path: /logout
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: ~
http_basic: ~
main:
pattern: ^/
anonymous: ~
logout: true
form_login:
provider: fos_userbundle
csrf_token_generator: security.csrf.token_manager
default_target_path: dashboard
login_path: fos_user_security_login
check_path: /login_check
role_hierarchy:
ROLE_ADMIN: ROLE_USER
ROLE_SUPER_ADMIN: ROLE_ADMIN
access_control:
- { path: ^/dashboard$, role: IS_AUTHENTICATED_REMEMBERED }
- { path: ^/login$, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/dashboard$, role: IS_AUTHENTICATED_REMEMBERED }
- { path: ^/register, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/resetting, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { 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