very good, when I access my /login it shows me a simple FOSUserBundle login that I have commented in login_content.html.twig, instead of showing me the part of code that I edited ->
login_content.html.twig ->
{% trans_default_domain 'FOSUserBundle' %}
<head>
<meta charset="UTF-8">
<title>Login MyBar</title>
<link rel="stylesheet" href="{{ asset('css/main_login.css') }}">
<!-- Font Awesome 5.15.4 CSS -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css" integrity="sha512-..." crossorigin="anonymous">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
</head>
{% if error %}
<div>{{ error.messageKey|trans(error.messageData, 'security') }}</div>
{% endif %}
{# <form action="{{ path("fos_user_security_check") }}" method="post">
{% if csrf_token %}
<input type="hidden" name="_csrf_token" value="{{ csrf_token }}" />
{% endif %}
<label for="username">{{ 'security.login.username'|trans }}</label>
<input type="text" id="username" name="_username" value="{{ last_username }}" required="required" autocomplete="username" />
<label for="password">{{ 'security.login.password'|trans }}</label>
<input type="password" id="password" name="_password" required="required" autocomplete="current-password" />
<input type="checkbox" id="remember_me" name="_remember_me" value="on" />
<label for="remember_me">{{ 'security.login.remember_me'|trans }}</label>
<input type="submit" id="_submit" name="_submit" value="{{ 'security.login.submit'|trans }}" />
</form> #}
<body style="font-family: system-ui;">
<!-- Font Awesome 5.15.4 JS -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/js/all.min.js" integrity="sha512-..." crossorigin="anonymous"></script>
<form action="{{ path('fos_user_security_check') }}" method="post" class="login-form">
{% if csrf_token %}
<input type="hidden" name="_csrf_token" value="{{ csrf_token }}" />
{% endif %}
<div class="login-box">
<div class="login-logo">
<img src="{{ asset('img/logovintagecolon.jpg') }}" alt="Logo" class="logo-img">
</div>
<div class="card">
<div class="card-body login-card-body">
{# <p class="login-box-msg">{{ 'security.login.welcome'|trans }}</p> #}
<div class="form-group">
<label for="username">{{ 'security.login.username'|trans }}</label>
<div class="input-group" style="display: flex;flex-direction: row;">
<div class="input-group-prepend">
<span class="input-group-text"><i class="fas fa-user"></i></span>
</div>
<input type="text" id="username" name="_username" value="{{ last_username }}" class="form-control" required="required" autocomplete="username" />
</div>
</div>
<div class="form-group">
<label for="password">{{ 'security.login.password'|trans }}</label>
<div class="input-group" style="display: flex;flex-direction: row;">
<div class="input-group-prepend">
<span class="input-group-text"><i class="fas fa-lock"></i></span>
</div>
<input type="password" id="password" name="_password" class="form-control" required="required" autocomplete="current-password" />
<div class="input-group-append">
<span class="input-group-text">
<button type="button" id="show-pass" style="border: none;"><i class="fas fa-eye-slash" id="togglePassword"></i></button>
</span>
</div>
</div>
</div>
<div class="form-group form-check">
<input type="checkbox" id="remember_me" name="_remember_me" value="on" class="form-check-input" />
<label for="remember_me" class="form-check-label">{{ 'security.login.remember_me'|trans }}</label>
</div>
<button type="submit" class="btn btn-primary btn-block btn-flat">{{ 'security.login.submit'|trans }}</button>
</div>
</div>
</div>
</form>
<script>
document.addEventListener('DOMContentLoaded', function() {
var togglePassword = document.getElementById('togglePassword');
var passwordInput = document.getElementById('password');
var showPass = document.getElementById('show-pass');
showPass.addEventListener('click', function() {
if (passwordInput.type === 'password') {
passwordInput.type = 'text';
showPass.innerHTML = '<i class="fas fa-eye"></i>';
} else {
passwordInput.type = 'password';
showPass.innerHTML = '<i class="fas fa-eye-slash"></i>';
}
});
});
</script>
</body>
security.yaml
security:
access_denied_url: /error/403
always_authenticate_before_granting: false
encoders:
FOS\UserBundle\Model\UserInterface: bcrypt
role_hierarchy:
ROLE_USER: []
ROLE_GESTOR: []
ROLE_CAMARERO: []
ROLE_ADMIN: [ROLE_USER, ROLE_GESTOR, ROLE_CAMARERO]
ROLE_SUPER_ADMIN: [ROLE_ADMIN, ROLE_USER, ROLE_GESTOR, ROLE_CAMARERO, ROLE_ALLOWED_TO_SWITCH]
# https://symfony.com/doc/current/book/security.html#where-do-users-come-from-user-providers
providers:
fos_userbundle:
id: fos_user.user_provider.username
in_memory: { memory: ~ }
firewalls:
dev:
pattern: ^/(_(profiler|wdt)|css|images|js)/
security: false
prod:
pattern: ^/(_(profiler|wdt)|css|images|js)/
security: false
main:
pattern: ^/
form_login:
provider: fos_userbundle
csrf_token_generator: security.csrf.token_manager
login_path: fos_user_security_login
check_path: fos_user_security_check
# default_target_path: / # Ruta a la que se redirige después de iniciar sesión correctamente
logout:
path: fos_user_security_logout
target: fos_user_security_login
anonymous: true
routes.yaml ->
fos_user:
resource: "@FOSUserBundle/Resources/config/routing/all.xml"
fos_user_security:
resource: "@FOSUserBundle/Resources/config/routing/security.xml"
fos_user_profile:
resource: "@FOSUserBundle/Resources/config/routing/profile.xml"
prefix: /profile
fos_user_register:
resource: "@FOSUserBundle/Resources/config/routing/registration.xml"
prefix: /register
fos_user_resetting:
resource: "@FOSUserBundle/Resources/config/routing/resetting.xml"
prefix: /resetting
fos_user_change_password:
resource: "@FOSUserBundle/Resources/config/routing/change_password.xml"
prefix: /profile
profile:
path: /profile
controller: App\Controller\ProfileController::index
fos_user_security_logout:
path: /logout
methods: [GET]
access_denied_redirect:
path: /error/403
controller: App\Controller\ErrorController::accessDenied
The entire application has worked without problems on a local server (Symfony-CLI)
I installed the apache-pack to have an .htaccess inside the /public folder that did allow me to show the login on my server but without my CSS, I have enabled the apache rewrite module and it doesn't work either, I don't know what else to try...