Skip to content

Instantly share code, notes, and snippets.

@0sc4r123
Created June 11, 2018 17:29
Show Gist options
  • Save 0sc4r123/565419b4e79ed36b93f38705bba61ad8 to your computer and use it in GitHub Desktop.
Save 0sc4r123/565419b4e79ed36b93f38705bba61ad8 to your computer and use it in GitHub Desktop.
# you can read more about security in the related section of the documentation
# http://symfony.com/doc/current/book/security.html
security:
# http://symfony.com/doc/current/book/security.html#where-do-users-come-from-user-providers
providers:
our_db_provider:
entity:
class: GASUserBundle:User
property: username
property: pass
firewalls:
default:
anonymous: ~
http_basic: ~
form_login:
login_path: /login
check_path: /login_check
# field names for the username and password fields:
username_parameter: _username
password_parameter: _password
# default_target_path: default_security_target
# always_use_default_target_path: true
logout:
path: /logout
target: /login
# disables authentication for assets and the profiler, adapt it according to your needs
dev:
pattern: ^/(_(profiler|wdt)|css|images|js)/
security: false
# the login page has to be accessible for everybody
main:
anonymous: ~
# activate different ways to authenticate
# http_basic: ~
# http://symfony.com/doc/current/book/security.html#a-configuring-how-your-users-will-authenticate
# form_login: ~
# http://symfony.com/doc/current/cookbook/security/form_login_setup.html
# http://symfony.com/doc/current/book/security.html#encoding-the-user-s-password
encoders:
GAS\UserBundle\Entity\User:
algorithm: bcrypt
cost: 12
@0sc4r123
Copy link
Author

{{ 'Please sign in'|trans }}

            <div class="form-group">
                <label for="username" class="col-sm-2 control-label">{{ 'Username'|trans }}:</label>
                <div class="col-sm-7">
                    <input type="text" id="username" class="form-control" name="_username" value="{{ last_username }}" placeholder="{{ 'Username'|trans }}" required autofocus />
                </div>
            </div>
            <div class="form-group">
                <label for="password" class="col-sm-2 control-label">{{ 'Password'|trans }}:</label>
                <div class="col-sm-7">
                    <input type="password" id="password" class="form-control" name="_pass" placeholder="{{ 'Password'|trans }}" required />
                </div>
            </div>
            <input type="hidden" name="_target_path" value="gas_user_homepage" />
            <div class="form-group">
                <div class="col-sm-offset-2 col-sm-7">
                    <button type="submit" class="btn btn-default">{{ 'Sign in'|trans }}</button>
                </div>
            </div>
        </form>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment