initial commit
This commit is contained in:
39
vendor/symfony/maker-bundle/templates/authenticator/EmptyAuthenticator.tpl.php
vendored
Normal file
39
vendor/symfony/maker-bundle/templates/authenticator/EmptyAuthenticator.tpl.php
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
<?= "<?php\n" ?>
|
||||
|
||||
namespace <?= $namespace ?>;
|
||||
|
||||
<?= $use_statements; ?>
|
||||
|
||||
class <?= $class_name ?> extends AbstractAuthenticator
|
||||
{
|
||||
public function supports(Request $request): ?bool
|
||||
{
|
||||
// TODO: Implement supports() method.
|
||||
}
|
||||
|
||||
public function authenticate(Request $request): Passport
|
||||
{
|
||||
// TODO: Implement authenticate() method.
|
||||
}
|
||||
|
||||
public function onAuthenticationSuccess(Request $request, TokenInterface $token, string $firewallName): ?Response
|
||||
{
|
||||
// TODO: Implement onAuthenticationSuccess() method.
|
||||
}
|
||||
|
||||
public function onAuthenticationFailure(Request $request, AuthenticationException $exception): ?Response
|
||||
{
|
||||
// TODO: Implement onAuthenticationFailure() method.
|
||||
}
|
||||
|
||||
// public function start(Request $request, ?AuthenticationException $authException = null): Response
|
||||
// {
|
||||
// /*
|
||||
// * If you would like this class to control what happens when an anonymous user accesses a
|
||||
// * protected page (e.g. redirect to /login), uncomment this method and make this class
|
||||
// * implement Symfony\Component\Security\Http\EntryPoint\AuthenticationEntryPointInterface.
|
||||
// *
|
||||
// * For more details, see https://symfony.com/doc/current/security/experimental_authenticators.html#configuring-the-authentication-entry-point
|
||||
// */
|
||||
// }
|
||||
}
|
||||
9
vendor/symfony/maker-bundle/templates/authenticator/EmptySecurityController.tpl.php
vendored
Normal file
9
vendor/symfony/maker-bundle/templates/authenticator/EmptySecurityController.tpl.php
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
<?= "<?php\n" ?>
|
||||
|
||||
namespace <?= $namespace ?>;
|
||||
|
||||
<?= $use_statements; ?>
|
||||
|
||||
class <?= $class_name; ?> extends AbstractController
|
||||
{
|
||||
}
|
||||
48
vendor/symfony/maker-bundle/templates/authenticator/LoginFormAuthenticator.tpl.php
vendored
Normal file
48
vendor/symfony/maker-bundle/templates/authenticator/LoginFormAuthenticator.tpl.php
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
<?= "<?php\n" ?>
|
||||
|
||||
namespace <?= $namespace ?>;
|
||||
|
||||
<?= $use_statements; ?>
|
||||
|
||||
class <?= $class_name; ?> extends AbstractLoginFormAuthenticator
|
||||
{
|
||||
use TargetPathTrait;
|
||||
|
||||
public const LOGIN_ROUTE = 'app_login';
|
||||
|
||||
public function __construct(private UrlGeneratorInterface $urlGenerator)
|
||||
{
|
||||
}
|
||||
|
||||
public function authenticate(Request $request): Passport
|
||||
{
|
||||
$<?= $username_field_var ?> = $request->getPayload()->getString('<?= $username_field ?>');
|
||||
|
||||
$request->getSession()->set(SecurityRequestAttributes::LAST_USERNAME, $<?= $username_field_var ?>);
|
||||
|
||||
return new Passport(
|
||||
new UserBadge($<?= $username_field_var ?>),
|
||||
new PasswordCredentials($request->getPayload()->getString('password')),
|
||||
[
|
||||
new CsrfTokenBadge('authenticate', $request->getPayload()->getString('_csrf_token')),<?= $remember_me_badge ? "
|
||||
new RememberMeBadge(),\n" : "" ?>
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
public function onAuthenticationSuccess(Request $request, TokenInterface $token, string $firewallName): ?Response
|
||||
{
|
||||
if ($targetPath = $this->getTargetPath($request->getSession(), $firewallName)) {
|
||||
return new RedirectResponse($targetPath);
|
||||
}
|
||||
|
||||
// For example:
|
||||
// return new RedirectResponse($this->urlGenerator->generate('some_route'));
|
||||
throw new \Exception('TODO: provide a valid redirect inside '.__FILE__);
|
||||
}
|
||||
|
||||
protected function getLoginUrl(Request $request): string
|
||||
{
|
||||
return $this->urlGenerator->generate(self::LOGIN_ROUTE);
|
||||
}
|
||||
}
|
||||
38
vendor/symfony/maker-bundle/templates/authenticator/login_form.tpl.php
vendored
Normal file
38
vendor/symfony/maker-bundle/templates/authenticator/login_form.tpl.php
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
{% extends 'base.html.twig' %}
|
||||
|
||||
{% block title %}Log in!{% endblock %}
|
||||
|
||||
{% block body %}
|
||||
<form method="post">
|
||||
{% if error %}
|
||||
<div class="alert alert-danger">{{ error.messageKey|trans(error.messageData, 'security') }}</div>
|
||||
{% endif %}
|
||||
|
||||
<?php if ($logout_setup): ?>
|
||||
{% if app.user %}
|
||||
<div class="mb-3">
|
||||
You are logged in as {{ app.user.userIdentifier }}, <a href="{{ path('app_logout') }}">Logout</a>
|
||||
</div>
|
||||
{% endif %}
|
||||
<?php endif; ?>
|
||||
|
||||
<h1 class="h3 mb-3 font-weight-normal">Please sign in</h1>
|
||||
<label for="input<?= ucfirst($username_field); ?>"><?= $username_label; ?></label>
|
||||
<input type="<?= $username_is_email ? 'email' : 'text'; ?>" value="{{ last_username }}" name="<?= $username_field; ?>" id="input<?= ucfirst($username_field); ?>" class="form-control" autocomplete="<?= $username_is_email ? 'email' : 'username'; ?>" required autofocus>
|
||||
<label for="inputPassword">Password</label>
|
||||
<input type="password" name="password" id="inputPassword" class="form-control" autocomplete="current-password" required>
|
||||
<input type="hidden" name="_csrf_token" data-controller="csrf-protection" value="{{ csrf_token('authenticate') }}">
|
||||
<?php if($support_remember_me && !$always_remember_me): ?>
|
||||
|
||||
<div class="checkbox mb-3">
|
||||
<label>
|
||||
<input type="checkbox" name="_remember_me"> Remember me
|
||||
</label>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<button class="btn btn-lg btn-primary" type="submit">
|
||||
Sign in
|
||||
</button>
|
||||
</form>
|
||||
{% endblock %}
|
||||
Reference in New Issue
Block a user