Add profile page + disable Turbo

This commit is contained in:
Nicolò P 2024-10-29 15:04:44 +01:00
parent 008cc7218d
commit b3585047be
4 changed files with 107 additions and 1 deletions

View File

@ -2,7 +2,7 @@
"controllers": {
"@symfony/ux-turbo": {
"turbo-core": {
"enabled": true,
"enabled": false,
"fetch": "eager"
},
"mercure-turbo-stream": {

View File

@ -0,0 +1,18 @@
<?php
namespace App\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Attribute\Route;
class ProfileController extends AbstractController
{
#[Route('/profile', name: 'app_profile')]
public function index(): Response
{
return $this->render('profile/index.html.twig', [
'controller_name' => 'ProfileController',
]);
}
}

View File

@ -37,6 +37,9 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface
#[ORM\Column(length: 40, nullable: true)]
private ?string $lastname = null;
#[ORM\Column(length: 100, nullable: true)]
private ?string $email = null;
public function getId(): ?int
{
return $this->id;
@ -103,6 +106,11 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface
return $this;
}
public function getEmail(): ?string
{
return $this->email;
}
/**
* @see UserInterface
*/

View File

@ -0,0 +1,80 @@
{% extends 'data_entry.html.twig' %}
{% block title %}Profile | ArCOA{% endblock %}
{% block rightpanel %}
<h1 class="is-size-1 mb-2 has-text-centered">User profile</h1>
<div class="ml-6 pl-6 container">
<div class="card ml-6">
<div class="card-content">
<div class="media">
<div class="media-left">
<span class="icon is-large">
<i class="fa fa-user-circle fa-2x"></i>
</span>
</div>
<div class="media-content">
<p class="title is-4">{{ app.user.firstname }} {{ app.user.lastname }}</p>
<p class="subtitle is-6">
<span class="icon is-small">
<i class="fa fa-envelope"></i>
</span>
{{ app.user.email }}
</p>
</div>
</div>
<div class="content">
<p class="is-size-4 pl-3">
<strong>ArCOA Role:</strong>
{% if 'ROLE_ADMIN' in app.user.roles %}
Administrator
{% elseif 'ROLE_REVISOR' in app.user.roles %}
Revisor
{% else %}
Reader
{% endif %}
<span class="icon is-small is-size-5 pl-3 has-text-link">
<i class="fa fa-question-circle"></i>
</span>
</p>
</div>
</div>
</div>
<div class="card ml-6 content">
<form class="card-content" id="change-password">
<div class="field">
<h3 class="is-size-4 has-text-centered">Change password</h3>
</div>
<div class="field">
<label class="label">Current password</label>
<p class="control">
<input class="input" name="_current_pass" required type="password" placeholder="Current password">
</p>
</div>
<div class="field">
<label class="label">New password</label>
<p class="control">
<input class="input" name="_new_pass" required type="password" placeholder="New password">
</p>
</div>
<div class="field">
<label class="label">Confirm password</label>
<p class="control">
<input class="input" name="_confirm_pass" required type="password" placeholder="Confirm password">
</p>
</div>
<input type="hidden" name="_csrf_token" value="{{ csrf_token('authenticate') }}">
<div class="field mt-5">
<p class="control" id="submit">
<button class="button is-link is-fullwidth" type="submit">
Submit
</button>
</p>
</div>
</form>
</div>
</div>
{% endblock %}