1000 search results

{% extends 'base.html.twig' %}
{% block title %}Login!{% endblock %}
{% block body %}
<h1>Login to the SpaceBar!</h1>
{% endblock %}
See Code Block in Script
28 lines | templates/security/login.html.twig
// ... lines 1 - 4
{% block body %}
<h1>Login to the SpaceBar!</h1>
{% if error %}
<div>{{ error.messageKey|trans(error.messageData, 'security') }}</div>
{% endif %}
<form action="{{ path('login') }}" method="post">
<label for="username">Username:</label>
<input type="text" id="username" name="_username" value="{{ last_username }}" />
<label for="password">Password:</label>
<input type="password" id="password" name="_password" />
{#
If you want to control the URL the user
is redirected to on success (more details below)
<input type="hidden" name="_target_path" value="/account" />
#}
<button type="submit">login</button>
</form>
{% endblock %}
See Code Block in Script
28 lines | templates/security/login.html.twig
// ... lines 1 - 4
{% block body %}
// ... lines 6 - 11
<form method="post">
// ... lines 13 - 25
</form>
{% endblock %}
See Code Block in Script
32 lines | templates/security/login.html.twig
// ... lines 1 - 10
{% block body %}
<form class="form-signin" method="post">
{% if error %}
<div>{{ error.messageKey|trans(error.messageData, 'security') }}</div>
{% endif %}
<h1 class="h3 mb-3 font-weight-normal">Please sign in</h1>
<label for="inputEmail" class="sr-only">Email address</label>
<input type="email" name="email" id="inputEmail" class="form-control" placeholder="Email address" required autofocus>
<label for="inputPassword" class="sr-only">Password</label>
<input type="password" name="password" id="inputPassword" class="form-control" placeholder="Password" required>
<div class="checkbox mb-3">
<label>
<input type="checkbox" value="remember-me"> Remember me
</label>
</div>
<button class="btn btn-lg btn-primary btn-block" type="submit">
Sign in
</button>
</form>
{% endblock %}
See Code Block in Script
32 lines | templates/security/login.html.twig
// ... lines 1 - 4
{% block stylesheets %}
// ... lines 6 - 8
{% endblock %}
// ... lines 10 - 32
See Code Block in Script
32 lines | templates/security/login.html.twig
// ... lines 1 - 4
{% block stylesheets %}
{{ parent() }}
// ... lines 7 - 8
{% endblock %}
// ... lines 10 - 32
See Code Block in Script
32 lines | templates/security/login.html.twig
// ... lines 1 - 4
{% block stylesheets %}
{{ parent() }}
<link rel="stylesheet" href="{{ asset('css/login.css') }}">
{% endblock %}
// ... lines 10 - 32
See Code Block in Script
32 lines | templates/security/login.html.twig
// ... lines 1 - 10
{% block body %}
<form class="form-signin" method="post">
{% if error %}
<div>{{ error.messageKey|trans(error.messageData, 'security') }}</div>
{% endif %}
// ... lines 16 - 29
</form>
{% endblock %}
See Code Block in Script
32 lines | templates/security/login.html.twig
// ... lines 1 - 10
{% block body %}
<form class="form-signin" method="post">
{% if error %}
<div class="alert alert-danger">{{ error.messageKey|trans(error.messageData, 'security') }}</div>
{% endif %}
// ... lines 16 - 29
</form>
{% endblock %}
See Code Block in Script
90 lines | src/Security/LoginFormAuthenticator.php
// ... lines 1 - 20
class LoginFormAuthenticator extends AbstractFormLoginAuthenticator
{
// ... lines 23 - 56
public function getUser($credentials, UserProviderInterface $userProvider)
{
// ... lines 59 - 60
return $this->em->getRepository(User::class)
// ... line 62
}
// ... lines 64 - 88
}
See Code Block in Script
21 lines | src/Security/Voter/RandomAccessVoter.php
// ... lines 1 - 8
class RandomAccessVoter extends Voter
{
protected function supports($attribute, $subject)
{
return $attribute === 'RANDOM_ACCESS';
}
// ... lines 15 - 19
}
See Code Block in Script
21 lines | src/Security/Voter/RandomAccessVoter.php
// ... lines 1 - 15
protected function voteOnAttribute($attribute, $subject, TokenInterface $token)
{
return random_int(0, 10) > 5;
}
// ... lines 20 - 21
See Code Block in Script
Blog
Composer 2.9 Automatic Security Blocking: Fireside Chat

…a situation where you know a package is safe (or you’re stuck waiting for a patch), you can turn off security blocking: This restores the old behavior where vulnerabilities are reported, but installation is not blocked. Ignore Specific Advisories Instead of disabling blocking globally…

64 lines | config/packages/security.yaml
// ... lines 1 - 51
when@test:
security:
password_hashers:
# By default, password hashers are resource intensive and take time. This is
# important to generate secure password hashes. In tests however, secure hashes
# are not important, waste resources and increase test times. The following
# reduces the work factor to the lowest possible values.
Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface:
algorithm: auto
cost: 4 # Lowest possible value for bcrypt
time_cost: 3 # Lowest possible value for argon
memory_cost: 10 # Lowest possible value for argon
See Code Block in Script
services:
_defaults:
autowire: true
autoconfigure: true
SensioLabs\Security\SecurityChecker: null
SensioLabs\Security\Command\SecurityCheckerCommand: null
See Code Block in Script
414 lines | symfony-docs/security/form_login.rst
// ... lines 1 - 396
Redirecting to the Last Accessed Page with ``TargetPathTrait``
--------------------------------------------------------------
The last request URI is stored in a session variable named
``_security.<your providerKey>.target_path`` (e.g. ``_security.main.target_path``
if the name of your firewall is ``main``). Most of the times you don't have to
deal with this low level session variable. However, if you ever need to get or
remove this variable, it's better to use the
:class:`Symfony\\Component\\Security\\Http\\Util\\TargetPathTrait` utility::
// ...
use Symfony\Component\Security\Http\Util\TargetPathTrait;
$targetPath = $this->getTargetPath($request->getSession(), $providerKey);
// equivalent to:
// $targetPath = $request->getSession()->get('_security.'.$providerKey.'.target_path');
See Code Block in Script
414 lines | symfony-docs/security/form_login.rst
// ... lines 1 - 26
.. note::
Sometimes, redirecting to the originally requested page can cause problems,
like if a background Ajax request "appears" to be the last visited URL,
causing the user to be redirected there. For information on controlling this
behavior, see :doc:`/security`.
// ... lines 33 - 414
See Code Block in Script
<?xml version="1.0" ?>
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
// ... lines 6 - 12
<services>
// ... lines 14 - 135
<service id="security.firewall.map" class="Symfony\Bundle\SecurityBundle\Security\FirewallMap">
<argument /> <!-- Firewall context locator -->
<argument /> <!-- Request matchers -->
</service>
// ... lines 140 - 147
<service id="security.firewall.config" class="Symfony\Bundle\SecurityBundle\Security\FirewallConfig" abstract="true">
<argument /> <!-- name -->
<argument /> <!-- user_checker -->
<argument /> <!-- request_matcher -->
<argument /> <!-- security enabled -->
<argument /> <!-- stateless -->
<argument /> <!-- provider -->
<argument /> <!-- context -->
<argument /> <!-- entry_point -->
<argument /> <!-- access_denied_handler -->
<argument /> <!-- access_denied_url -->
<argument type="collection" /> <!-- listeners -->
<argument /> <!-- switch_user -->
</service>
// ... lines 162 - 223
</services>
</container>
See Code Block in Script
// ... lines 1 - 2
namespace Symfony\Bundle\SecurityBundle\Tests\Security;
use PHPUnit\Framework\TestCase;
class TargetPathHelperTest extends TestCase
{
// ... lines 9 - 12
}
See Code Block in Script
// ... lines 1 - 2
namespace Symfony\Bundle\SecurityBundle\Tests\Security;
use PHPUnit\Framework\TestCase;
class TargetPathHelperTest extends TestCase
{
public function testSavePath()
{
}
}
See Code Block in Script