Giter Site home page Giter Site logo

vanio-user-bundle's Introduction

Vanio User Bundle

Build Status Coverage Status PHP7 License

A Symfony2 Bundle integrating FOSUserBundle and HWIOauthBundle with some additional features and sane defaults.

Installation

Installation can be done as usually using composer. composer require vanio/vanio-user-bundle

You can also install HWIOAuthBundle optionally if you want to support authentication via social accounts. composer require hwi/oauth-bundle

Next step is to register this bundle as well as bundles it depends on inside your AppKernel.

// app/AppKernel.php
// ...

class AppKernel extends Kernel
{
    // ...

    public function registerBundles(): array
    {
        $bundles = [
            // ...
            new FOS\UserBundle\FOSUserBundle,
            new HWI\Bundle\OAuthBundle\HWIOAuthBundle, // Optional
            new Vanio\UserBundle\VanioUserBundle,
            new Vanio\UserBundle\VanioWebBundle,
        ];

        // ...
    }
}

Default Configuration

firewall_name: ~ # firewall name, auto-detected from security configuration when empty
email_only: false # whether to completely omit username and use email only
custom_storage_validation: false # whether to disable predefined uniqueness validation
use_flash_notifications: true # whether to enable notifications using flash messages (notify also on login and logout as an addition to FOSUserBundle)
registration_target_path: ~ # target path used for redirection after completed registration instead of default static pages
pass_target_path: # whether to pass referer in URL query parameter and use it as target path
    enabled: false
    default_target_path: / # default value when target path is not present, default_target_path option inside security configuration is ignored
    target_path_parameter: _target_path: # name of the parameter
    ignored_routes: [] # route names to ignore
    ignored_route_prefixes: # route name prefixes to ignore, the default ones are always merged in
        - fos_user_security_
        - fos_user_registration_
        - fos_user_resetting_
        - hwi_oauth_

social_authentication: ~ # whether to enable social authentication, automatically enabled when HWIOAuthUserBundle is installed
social_registration_form: # social registration form configuration
    type: Vanio\UserBundle\Form\SocialRegistrationFormType # form type
    name: hwi_oauth_registration_form # form name
    validation_groups: [SocialRegistration] # form validation groups

All these values are available as container parameters. They are prefixed using vanio_user. prefix.
This bundle prepends some defaults of SecurityBundle, FOSUserBundle and HWIOAuthBundle based on these configuration values to make the configuration easier.

The default prepended values are:

security:
    encoders:
        FOS\UserBundle\Model: bcrypt
    providers:
        fos_userbundle:
            id: fos_user.user_provider.username # or fos_user.user_provider.username_email when %vanio_user.email_only%

fos_user:
    firewall_name: %vanio_user.firewall_name%
    use_listener: false
    use_flash_notifications: %vanio_user.use_flash_notifications%
    registration:
        form:
            type: FOS\UserBundle\Form\Type\RegistrationFormType # or Vanio\UserBundle\Form\EmailOnlyRegistration when %vanio_user.email_only%
        confirmation:
            template: VanioUserBundle:Registration:email.html.twig
    resetting:
        email:
            template: VanioUserBundle:Resetting:email.html.twig
    profile:
        form:
            type: FOS\UserBundle\Form\Type\ProfileFormType # or Vanio\UserBundle\Form\EmailOnlyProfileType when %vanio_user.email_only%
    service:
        mailer: fos_user.mailer.twig_swift

hwi_oauth:
    firewall_names: [%vanio_user.firewall_name%]

vanio-user-bundle's People

Contributors

maryo avatar

Watchers

James Cloos avatar Vladimír Mlázovský avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.