Skip to content

Commit

Permalink
feature #57 Add CSRF protection for login form (xelaris)
Browse files Browse the repository at this point in the history
This PR was merged into the master branch.

Discussion
----------

Add CSRF protection for login form

Commits
-------

a95a5f9 Add CSRF protection for login form
  • Loading branch information
javiereguiluz committed Apr 24, 2015
2 parents cd2d222 + a95a5f9 commit 7e201d2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions app/Resources/views/security/login.html.twig
Expand Up @@ -23,6 +23,7 @@
<label for="password">Password:</label>
<input type="password" id="password" name="_password" class="form-control" />
</div>
<input type="hidden" name="_csrf_token" value="{{ csrf_token('authenticate') }}"/>
<button type="submit" class="btn btn-primary">
<i class="fa fa-sign-in"></i> Sign in
</button>
Expand Down
3 changes: 3 additions & 0 deletions app/config/security.yml
Expand Up @@ -29,6 +29,9 @@ security:
# The name of the route where the login form lives
# When the user tries to access a protected page, they are redirected here
login_path: security_login_form
# Secure the login form against CSRF
# Reference: http://symfony.com/doc/current/cookbook/security/csrf_in_login_form.html
csrf_provider: security.csrf.token_manager

logout:
# The route name the user can go to in order to logout
Expand Down

0 comments on commit 7e201d2

Please sign in to comment.