1000 search results

31 lines | src/Security/Voter/SuperAdminVoter.php
// ... lines 1 - 9
final class SuperAdminVoter extends Voter
{
// ... lines 12 - 20
protected function supports(string $attribute, mixed $subject): bool
{
return !in_array($attribute, self::EXCLUSIONS, true);
}
// ... lines 25 - 29
}
See Code Block in Script
75 lines | templates/security/login.html.twig
// ... lines 1 - 4
{% block body %}
<section class="px-6 py-10 sm:py-16">
<div class="mx-auto max-w-md">
<div class="rounded-2xl border border-white/10 bg-[#16202A]/80 p-8 shadow-2xl shadow-black/30 backdrop-blur-sm">
<div class="mb-8">
<p class="text-sm font-semibold uppercase tracking-[0.3em] text-cyan-300">Security</p>
{% if app.user %}
<h1 class="mt-3 text-4xl font-semibold">Confirm your password</h1>
{% else %}
<h1 class="mt-3 text-4xl font-semibold">Sign in</h1>
<p class="mt-3 text-sm text-white/70">Use your email and password to continue.</p>
{% endif %}
</div>
// ... lines 18 - 70
</div>
</div>
</section>
{% endblock %}
See Code Block in Script
75 lines | templates/security/login.html.twig
// ... lines 1 - 4
{% block body %}
<section class="px-6 py-10 sm:py-16">
<div class="mx-auto max-w-md">
<div class="rounded-2xl border border-white/10 bg-[#16202A]/80 p-8 shadow-2xl shadow-black/30 backdrop-blur-sm">
// ... lines 9 - 18
<form method="post" class="space-y-6" data-turbo="false">
// ... lines 20 - 25
{% if app.user %}
<input type="hidden" name="_username" value="{{ app.user.userIdentifier }}">
{% else %}
// ... lines 29 - 41
{% endif %}
// ... lines 43 - 69
</form>
</div>
</div>
</section>
{% endblock %}
See Code Block in Script
75 lines | templates/security/login.html.twig
// ... lines 1 - 4
{% block body %}
<section class="px-6 py-10 sm:py-16">
<div class="mx-auto max-w-md">
<div class="rounded-2xl border border-white/10 bg-[#16202A]/80 p-8 shadow-2xl shadow-black/30 backdrop-blur-sm">
// ... lines 9 - 18
<form method="post" class="space-y-6" data-turbo="false">
// ... lines 20 - 57
{% if app.user %}
<input type="hidden" name="_remember_me" value="1">
{% else %}
// ... lines 61 - 64
{% endif %}
// ... lines 66 - 69
</form>
</div>
</div>
</section>
{% endblock %}
See Code Block in Script
75 lines | templates/security/login.html.twig
// ... lines 1 - 4
{% block body %}
<section class="px-6 py-10 sm:py-16">
<div class="mx-auto max-w-md">
<div class="rounded-2xl border border-white/10 bg-[#16202A]/80 p-8 shadow-2xl shadow-black/30 backdrop-blur-sm">
// ... lines 9 - 18
<form method="post" class="space-y-6" data-turbo="false">
// ... lines 20 - 66
<button class="w-full rounded-lg bg-green-700 px-5 py-3 font-semibold text-white transition hover:bg-green-800 cursor-pointer" type="submit">
{{ app.user ? 'Confirm' : 'Sign in' }}
</button>
</form>
</div>
</div>
</section>
{% endblock %}
See Code Block in Script
28 lines | src/Security/UserChecker.php
// ... lines 1 - 10
final class UserChecker implements UserCheckerInterface
{
public function checkPreAuth(UserInterface $user): void
{
}
public function checkPostAuth(UserInterface $user, ?TokenInterface $token = null): void
{
if (!$user instanceof User) {
return;
}
if (!$user->isEnabled()) {
throw new DisabledException();
}
}
}
See Code Block in Script
'Invalid credentials.': 'Your email or password is incorrect.'
See Code Block in Script
59 lines | src/Security/Voter/StarshipVoter.php
// ... lines 1 - 11
final class StarshipVoter extends Voter
{
// ... lines 14 - 16
public function __construct(
private AccessDecisionManagerInterface $accessDecisionManager,
) {
}
// ... lines 21 - 57
}
See Code Block in Script
59 lines | src/Security/Voter/StarshipVoter.php
// ... lines 1 - 11
final class StarshipVoter extends Voter
{
// ... lines 14 - 30
protected function voteOnAttribute(string $attribute, mixed $subject, TokenInterface $token, ?Vote $vote = null): bool
{
if ($this->accessDecisionManager->decide($token, ['ROLE_ADMIN'])) {
return true;
}
// ... lines 36 - 46
}
// ... lines 48 - 57
}
See Code Block in Script
59 lines | src/Security/Voter/StarshipVoter.php
// ... lines 1 - 11
final class StarshipVoter extends Voter
{
// ... lines 14 - 48
public function supportsType(string $subjectType): bool
{
return is_a($subjectType, Starship::class, true);
}
// ... lines 53 - 57
}
See Code Block in Script
59 lines | src/Security/Voter/StarshipVoter.php
// ... lines 1 - 11
final class StarshipVoter extends Voter
{
// ... lines 14 - 53
public function supportsAttribute(string $attribute): bool
{
return in_array($attribute, [self::EDIT, self::DELETE]);
}
}
See Code Block in Script
39 lines | src/Security/Voter/StarshipVoter.php
// ... lines 1 - 10
final class StarshipVoter extends Voter
{
public const EDIT = 'edit';
public const DELETE = 'delete';
// ... lines 15 - 37
}
See Code Block in Script
39 lines | src/Security/Voter/StarshipVoter.php
// ... lines 1 - 10
final class StarshipVoter extends Voter
{
// ... lines 13 - 15
protected function supports(string $attribute, mixed $subject): bool
{
return in_array($attribute, [self::EDIT, self::DELETE])
&& $subject instanceof Starship;
}
// ... lines 21 - 37
}
See Code Block in Script
39 lines | src/Security/Voter/StarshipVoter.php
// ... lines 1 - 10
final class StarshipVoter extends Voter
{
// ... lines 13 - 21
/**
* @param Starship $subject
*/
protected function voteOnAttribute(string $attribute, mixed $subject, TokenInterface $token, ?Vote $vote = null): bool
// ... lines 26 - 37
}
See Code Block in Script
39 lines | src/Security/Voter/StarshipVoter.php
// ... lines 1 - 10
final class StarshipVoter extends Voter
{
// ... lines 13 - 24
protected function voteOnAttribute(string $attribute, mixed $subject, TokenInterface $token, ?Vote $vote = null): bool
{
// ... lines 27 - 35
return $subject->getId() === $user->getStarship()?->getId();
}
}
See Code Block in Script
70 lines | templates/security/login.html.twig
// ... lines 1 - 4
{% block body %}
<section class="px-6 py-10 sm:py-16">
<div class="mx-auto max-w-md">
<div class="rounded-2xl border border-white/10 bg-[#16202A]/80 p-8 shadow-2xl shadow-black/30 backdrop-blur-sm">
// ... lines 9 - 14
<form method="post" class="space-y-6">
// ... lines 16 - 56
<div class="flex items-center gap-3 rounded-lg border border-white/10 bg-white/5 px-4 py-3 text-sm text-white/80">
<input type="checkbox" checked name="_remember_me" id="_remember_me" class="rounded border-white/20 bg-transparent text-cyan-400 focus:ring-cyan-400">
<label for="_remember_me">Remember me</label>
</div>
// ... lines 61 - 64
</form>
</div>
</div>
</section>
{% endblock %}
See Code Block in Script
62 lines | src/Security/LoginFormAuthenticator.php
// ... lines 1 - 18
final class LoginFormAuthenticator extends AbstractLoginFormAuthenticator
{
// ... lines 21 - 44
public function onAuthenticationSuccess(Request $request, TokenInterface $token, string $firewallName): ?Response
{
if ($targetPath = $request->query->get('_target_path')) {
return new RedirectResponse($targetPath);
}
// ... lines 50 - 54
}
// ... lines 56 - 60
}
See Code Block in Script
16 lines | templates/security/enable2fa.html.twig
{% extends 'base.html.twig' %}
{% block title %}2fa Activation{% endblock %}
{% block body %}
<div class="container">
<div class="row">
<div class="login-form bg-light mt-4 p-4">
<h1 class="h3 mb-3 font-weight-normal">Use Authy or Google Authenticator to Scan the QR Code</h1>
// ... lines 10 - 11
</div>
</div>
</div>
{% endblock %}
See Code Block in Script
{% extends 'base.html.twig' %}
{% block title %}2fa Activation{% endblock %}
{% block body %}
<div class="container">
<div class="row">
<div class="login-form bg-light mt-4 p-4">
<h1 class="h3 mb-3 font-weight-normal">Use Authy or Google Authenticator to Scan the QR Code</h1>
<img src="{{ path('app_qr_code') }}" alt="2fa QR Code">
</div>
</div>
</div>
{% endblock %}
See Code Block in Script
138 lines | src/Security/LoginFormAuthenticator.php
// ... lines 1 - 26
use Symfony\Component\Security\Http\Authenticator\Passport\Passport;
// ... lines 28 - 29
class LoginFormAuthenticator extends AbstractLoginFormAuthenticator
{
// ... lines 32 - 39
public function authenticate(Request $request): Passport
{
// ... lines 42 - 66
}
// ... lines 68 - 136
}
See Code Block in Script