Compare commits

..

No commits in common. '851bb45f707cad0f63cb6976d6da669f694c9033' and 'dbe828b8d4f8a2c8433279947e65826579d4a2d4' have entirely different histories.

@ -26,7 +26,7 @@ APP_SECRET=
#DATABASE_URL="sqlite:///%kernel.project_dir%/var/data_%kernel.environment%.db" #DATABASE_URL="sqlite:///%kernel.project_dir%/var/data_%kernel.environment%.db"
# DATABASE_URL="mysql://app:!ChangeMe!@127.0.0.1:3306/app?serverVersion=8.0.32&charset=utf8mb4" # DATABASE_URL="mysql://app:!ChangeMe!@127.0.0.1:3306/app?serverVersion=8.0.32&charset=utf8mb4"
# DATABASE_URL="mysql://app:!ChangeMe!@127.0.0.1:3306/app?serverVersion=10.11.2-MariaDB&charset=utf8mb4" # DATABASE_URL="mysql://app:!ChangeMe!@127.0.0.1:3306/app?serverVersion=10.11.2-MariaDB&charset=utf8mb4"
DATABASE_URL="mysql://recipe_manager:%env(DATABASE_PASSWORD)%@127.0.0.1:3306/recipe_manager?serverVersion=10.11.3-MariaDB&charset=utf8mb4" DATABASE_URL="mysql://recipe_manager:%env(DATABASE_PASSWORD)%@127.0.0.1:3306/web_edm?serverVersion=10.11.3-MariaDB&charset=utf8mb4"
###< doctrine/doctrine-bundle ### ###< doctrine/doctrine-bundle ###
###> symfony/messenger ### ###> symfony/messenger ###

@ -1,225 +0,0 @@
# Creative Commons Attribution-NonCommercial 4.0 International
Creative Commons Corporation (“Creative Commons”) is not a law firm and does not provide legal services or legal advice. Distribution of Creative Commons public licenses does not
create a lawyer-client or other relationship. Creative Commons makes its licenses and related information available on an “as-is” basis. Creative Commons gives no warranties
regarding its licenses, any material licensed under their terms and conditions, or any related information. Creative Commons disclaims all liability for damages resulting from
their use to the fullest extent possible.
**Using Creative Commons Public Licenses**
Creative Commons public licenses provide a standard set of terms and conditions that creators and other rights holders may use to share original works of authorship and other
material subject to copyright and certain other rights specified in the public license below. The following considerations are for informational purposes only, are not exhaustive,
and do not form part of our licenses.
* __Considerations for licensors:__ Our public licenses are intended for use by those authorized to give the public permission to use material in ways otherwise restricted by
copyright and certain other rights. Our licenses are irrevocable. Licensors should read and understand the terms and conditions of the license they choose before applying it.
Licensors should also secure all rights necessary before applying our licenses so that the public can reuse the material as expected. Licensors should clearly mark any material
not subject to the license. This includes other CC-licensed material, or material used under an exception or limitation to
copyright. [More considerations for licensors](http://wiki.creativecommons.org/Considerations_for_licensors_and_licensees#Considerations_for_licensors).
* __Considerations for the public:__ By using one of our public licenses, a licensor grants the public permission to use the licensed material under specified terms and conditions.
If the licensors permission is not necessary for any reasonfor example, because of any applicable exception or limitation to copyrightthen that use is not regulated by the
license. Our licenses grant only permissions under copyright and certain other rights that a licensor has authority to grant. Use of the licensed material may still be restricted
for other reasons, including because others have copyright or other rights in the material. A licensor may make special requests, such as asking that all changes be marked or
described. Although not required by our licenses, you are encouraged to respect those requests where
reasonable. [More considerations for the public](http://wiki.creativecommons.org/Considerations_for_licensors_and_licensees#Considerations_for_licensees).
## Creative Commons Attribution-NonCommercial 4.0 International Public License
By exercising the Licensed Rights (defined below), You accept and agree to be bound by the terms and conditions of this Creative Commons Attribution-NonCommercial 4.0 International
Public License ("Public License"). To the extent this Public License may be interpreted as a contract, You are granted the Licensed Rights in consideration of Your acceptance of
these terms and conditions, and the Licensor grants You such rights in consideration of benefits the Licensor receives from making the Licensed Material available under these terms
and conditions.
### Section 1 Definitions.
a. __Adapted Material__ means material subject to Copyright and Similar Rights that is derived from or based upon the Licensed Material and in which the Licensed Material is
translated, altered, arranged, transformed, or otherwise modified in a manner requiring permission under the Copyright and Similar Rights held by the Licensor. For purposes of this
Public License, where the Licensed Material is a musical work, performance, or sound recording, Adapted Material is always produced where the Licensed Material is synched in timed
relation with a moving image.
b. __Adapter's License__ means the license You apply to Your Copyright and Similar Rights in Your contributions to Adapted Material in accordance with the terms and conditions of
this Public License.
c. __Copyright and Similar Rights__ means copyright and/or similar rights closely related to copyright including, without limitation, performance, broadcast, sound recording, and
Sui Generis Database Rights, without regard to how the rights are labeled or categorized. For purposes of this Public License, the rights specified in Section 2(b)(1)-(2) are not
Copyright and Similar Rights.
d. __Effective Technological Measures__ means those measures that, in the absence of proper authority, may not be circumvented under laws fulfilling obligations under Article 11 of
the WIPO Copyright Treaty adopted on December 20, 1996, and/or similar international agreements.
e. __Exceptions and Limitations__ means fair use, fair dealing, and/or any other exception or limitation to Copyright and Similar Rights that applies to Your use of the Licensed
Material.
f. __Licensed Material__ means the artistic or literary work, database, or other material to which the Licensor applied this Public License.
g. __Licensed Rights__ means the rights granted to You subject to the terms and conditions of this Public License, which are limited to all Copyright and Similar Rights that apply
to Your use of the Licensed Material and that the Licensor has authority to license.
h. __Licensor__ means the individual(s) or entity(ies) granting rights under this Public License.
i. __NonCommercial__ means not primarily intended for or directed towards commercial advantage or monetary compensation. For purposes of this Public License, the exchange of the
Licensed Material for other material subject to Copyright and Similar Rights by digital file-sharing or similar means is NonCommercial provided there is no payment of monetary
compensation in connection with the exchange.
j. __Share__ means to provide material to the public by any means or process that requires permission under the Licensed Rights, such as reproduction, public display, public
performance, distribution, dissemination, communication, or importation, and to make material available to the public including in ways that members of the public may access the
material from a place and at a time individually chosen by them.
k. __Sui Generis Database Rights__ means rights other than copyright resulting from Directive 96/9/EC of the European Parliament and of the Council of 11 March 1996 on the legal
protection of databases, as amended and/or succeeded, as well as other essentially equivalent rights anywhere in the world.
l. __You__ means the individual or entity exercising the Licensed Rights under this Public License. __Your__ has a corresponding meaning.
### Section 2 Scope.
a. ___License grant.___
1. Subject to the terms and conditions of this Public License, the Licensor hereby grants You a worldwide, royalty-free, non-sublicensable, non-exclusive, irrevocable license to
exercise the Licensed Rights in the Licensed Material to:
A. reproduce and Share the Licensed Material, in whole or in part, for NonCommercial purposes only; and
B. produce, reproduce, and Share Adapted Material for NonCommercial purposes only.
2. __Exceptions and Limitations.__ For the avoidance of doubt, where Exceptions and Limitations apply to Your use, this Public License does not apply, and You do not need to comply
with its terms and conditions.
3. __Term.__ The term of this Public License is specified in Section 6(a).
4. __Media and formats; technical modifications allowed.__ The Licensor authorizes You to exercise the Licensed Rights in all media and formats whether now known or hereafter
created, and to make technical modifications necessary to do so. The Licensor waives and/or agrees not to assert any right or authority to forbid You from making technical
modifications necessary to exercise the Licensed Rights, including technical modifications necessary to circumvent Effective Technological Measures. For purposes of this Public
License, simply making modifications authorized by this Section 2(a)(4) never produces Adapted Material.
5. __Downstream recipients.__
A. __Offer from the Licensor Licensed Material.__ Every recipient of the Licensed Material automatically receives an offer from the Licensor to exercise the Licensed Rights
under the terms and conditions of this Public License.
B. __No downstream restrictions.__ You may not offer or impose any additional or different terms or conditions on, or apply any Effective Technological Measures to, the Licensed
Material if doing so restricts exercise of the Licensed Rights by any recipient of the Licensed Material.
6. __No endorsement.__ Nothing in this Public License constitutes or may be construed as permission to assert or imply that You are, or that Your use of the Licensed Material is,
connected with, or sponsored, endorsed, or granted official status by, the Licensor or others designated to receive attribution as provided in Section 3(a)(1)(A)(i).
b. ___Other rights.___
1. Moral rights, such as the right of integrity, are not licensed under this Public License, nor are publicity, privacy, and/or other similar personality rights; however, to the
extent possible, the Licensor waives and/or agrees not to assert any such rights held by the Licensor to the limited extent necessary to allow You to exercise the Licensed
Rights, but not otherwise.
2. Patent and trademark rights are not licensed under this Public License.
3. To the extent possible, the Licensor waives any right to collect royalties from You for the exercise of the Licensed Rights, whether directly or through a collecting society
under any voluntary or waivable statutory or compulsory licensing scheme. In all other cases the Licensor expressly reserves any right to collect such royalties, including when
the Licensed Material is used other than for NonCommercial purposes.
### Section 3 License Conditions.
Your exercise of the Licensed Rights is expressly made subject to the following conditions.
a. ___Attribution.___
1. If You Share the Licensed Material (including in modified form), You must:
A. retain the following if it is supplied by the Licensor with the Licensed Material:
i. identification of the creator(s) of the Licensed Material and any others designated to receive attribution, in any reasonable manner requested by the Licensor (including by
pseudonym if designated);
ii. a copyright notice;
iii. a notice that refers to this Public License;
iv. a notice that refers to the disclaimer of warranties;
v. a URI or hyperlink to the Licensed Material to the extent reasonably practicable;
B. indicate if You modified the Licensed Material and retain an indication of any previous modifications; and
C. indicate the Licensed Material is licensed under this Public License, and include the text of, or the URI or hyperlink to, this Public License.
2. You may satisfy the conditions in Section 3(a)(1) in any reasonable manner based on the medium, means, and context in which You Share the Licensed Material. For example, it may
be reasonable to satisfy the conditions by providing a URI or hyperlink to a resource that includes the required information.
3. If requested by the Licensor, You must remove any of the information required by Section 3(a)(1)(A) to the extent reasonably practicable.
4. If You Share Adapted Material You produce, the Adapter's License You apply must not prevent recipients of the Adapted Material from complying with this Public License.
### Section 4 Sui Generis Database Rights.
Where the Licensed Rights include Sui Generis Database Rights that apply to Your use of the Licensed Material:
a. for the avoidance of doubt, Section 2(a)(1) grants You the right to extract, reuse, reproduce, and Share all or a substantial portion of the contents of the database for
NonCommercial purposes only;
b. if You include all or a substantial portion of the database contents in a database in which You have Sui Generis Database Rights, then the database in which You have Sui Generis
Database Rights (but not its individual contents) is Adapted Material; and
c. You must comply with the conditions in Section 3(a) if You Share all or a substantial portion of the contents of the database.
For the avoidance of doubt, this Section 4 supplements and does not replace Your obligations under this Public License where the Licensed Rights include other Copyright and Similar
Rights.
### Section 5 Disclaimer of Warranties and Limitation of Liability.
a. __Unless otherwise separately undertaken by the Licensor, to the extent possible, the Licensor offers the Licensed Material as-is and as-available, and makes no representations
or warranties of any kind concerning the Licensed Material, whether express, implied, statutory, or other. This includes, without limitation, warranties of title, merchantability,
fitness for a particular purpose, non-infringement, absence of latent or other defects, accuracy, or the presence or absence of errors, whether or not known or discoverable. Where
disclaimers of warranties are not allowed in full or in part, this disclaimer may not apply to You.__
b. __To the extent possible, in no event will the Licensor be liable to You on any legal theory (including, without limitation, negligence) or otherwise for any direct, special,
indirect, incidental, consequential, punitive, exemplary, or other losses, costs, expenses, or damages arising out of this Public License or use of the Licensed Material, even if
the Licensor has been advised of the possibility of such losses, costs, expenses, or damages. Where a limitation of liability is not allowed in full or in part, this limitation may
not apply to You.__
c. The disclaimer of warranties and limitation of liability provided above shall be interpreted in a manner that, to the extent possible, most closely approximates an absolute
disclaimer and waiver of all liability.
### Section 6 Term and Termination.
a. This Public License applies for the term of the Copyright and Similar Rights licensed here. However, if You fail to comply with this Public License, then Your rights under this
Public License terminate automatically.
b. Where Your right to use the Licensed Material has terminated under Section 6(a), it reinstates:
1. automatically as of the date the violation is cured, provided it is cured within 30 days of Your discovery of the violation; or
2. upon express reinstatement by the Licensor.
For the avoidance of doubt, this Section 6(b) does not affect any right the Licensor may have to seek remedies for Your violations of this Public License.
c. For the avoidance of doubt, the Licensor may also offer the Licensed Material under separate terms or conditions or stop distributing the Licensed Material at any time; however,
doing so will not terminate this Public License.
d. Sections 1, 5, 6, 7, and 8 survive termination of this Public License.
### Section 7 Other Terms and Conditions.
a. The Licensor shall not be bound by any additional or different terms or conditions communicated by You unless expressly agreed.
b. Any arrangements, understandings, or agreements regarding the Licensed Material not stated herein are separate from and independent of the terms and conditions of this Public
License.
### Section 8 Interpretation.
a. For the avoidance of doubt, this Public License does not, and shall not be interpreted to, reduce, limit, restrict, or impose conditions on any use of the Licensed Material that
could lawfully be made without permission under this Public License.
b. To the extent possible, if any provision of this Public License is deemed unenforceable, it shall be automatically reformed to the minimum extent necessary to make it
enforceable. If the provision cannot be reformed, it shall be severed from this Public License without affecting the enforceability of the remaining terms and conditions.
c. No term or condition of this Public License will be waived and no failure to comply consented to unless expressly agreed to by the Licensor.
d. Nothing in this Public License constitutes or may be interpreted as a limitation upon, or waiver of, any privileges and immunities that apply to the Licensor or You, including
from the legal processes of any jurisdiction or authority.
> Creative Commons is not a party to its public licenses. Notwithstanding, Creative Commons may elect to apply one of its public licenses to material it publishes and in those
> instances will be considered the “Licensor.” Except for the limited purpose of indicating that material is shared under a Creative Commons public license or as otherwise permitted
> by the Creative Commons policies published at [creativecommons.org/policies](http://creativecommons.org/policies), Creative Commons does not authorize the use of the trademark
> “Creative Commons” or any other trademark or logo of Creative Commons without its prior written consent including, without limitation, in connection with any unauthorized
> modifications to any of its public licenses or any other arrangements, understandings, or agreements concerning use of licensed material. For the avoidance of doubt, this paragraph
> does not form part of the public licenses.
>
> Creative Commons may be contacted at creativecommons.org

@ -1,3 +0,0 @@
# Recipe Manager
WebSite for managing game recipes

@ -1,12 +1,10 @@
//region CSS import './bootstrap.js';
import './styles/app.scss'; /*
//endregion * Welcome to your app's main JavaScript file!
//region Bootstrap *
import 'bootstrap'; * This file will be included onto the page via the importmap() Twig function,
//endregion * which should already be in your base.html.twig.
//region jQuery */
import 'jqueryLocal'; // Declare $ as a global variable, accessible in all files import './styles/app.css';
//endregion
//region FontAwesome console.log('This log comes from assets/app.js - welcome to AssetMapper! 🎉');
import 'fontawesome';
//endregion

@ -0,0 +1,5 @@
import { startStimulusApp } from '@symfony/stimulus-bundle';
const app = startStimulusApp();
// register any custom, 3rd party controllers here
// app.register('some_controller_name', SomeImportedController);

@ -1,4 +1,15 @@
{ {
"controllers": {}, "controllers": {
"@symfony/ux-turbo": {
"turbo-core": {
"enabled": true,
"fetch": "eager"
},
"mercure-turbo-stream": {
"enabled": false,
"fetch": "eager"
}
}
},
"entrypoints": [] "entrypoints": []
} }

@ -1,148 +0,0 @@
//region Datatables.net
import 'datatables.net';
import 'datatables.net-dt/css/dataTables.dataTables.min.css';
//endregion
//region Bootstrap 5 styling for Datatables.net
import 'datatables.net-bs5';
import 'datatables.net-bs5/css/dataTables.bootstrap5.min.css';
//endregion
//region Custom style for Datatables.net
import './styles/datatables.scss';
//endregion
import 'jqueryLocal';
$(function () {
$('table.table-datatable').each(function () {
const self = $(this);
//region Options du datatable
let options = {
paging: self.data('sortPaging', false),
pageLength: self.data('sortPerPage', 50),
processing: true,
layout: self.data(
'sortLayout',
{
topStart: null,
topEnd: null,
bottomStart: null,
bottomEnd: 'paging',
},
),
};
//endregion
//region Gestion tri initial
let initialSort = [];
$('> thead > tr > th[data-sort-onLoad]', this).each(function () {
let self = $(this);
initialSort.push(
{
index: self.index(),
priority: self.data('sortOnload'),
direction: self.data('sortOrder', 'asc').toLowerCase(),
},
);
});
initialSort.sort(function (sort1, sort2) {
if (sort1.priority === sort2.priority) {
return sort1.index - sort2.index;
}
return sort1.priority - sort2.priority;
});
if (initialSort.length > 0) {
options.order = [];
initialSort.forEach(function (sortOrder) {
options.order.push([sortOrder.index, sortOrder.direction]);
});
}
//endregion
//region Gestion sens de tri (1er clic ou initial si concerné)
let descSort = [];
$('> thead > tr > th[data-sort-order]', this).each(function () {
const self = $(this);
if (self.data('sortOrder', 'asc').toLowerCase() === 'desc') {
descSort.push(self.index());
}
});
if (descSort.length > 0) {
if (!options.hasOwnProperty('columnDefs')) {
options.columnDefs = [];
}
options.columnDefs.push(
{
targets: descSort,
orderSequence: ['desc', 'asc'],
},
);
}
//endregion
//region Gestion désactivation tri
let disabledSort = [];
$('> thead > tr > th[data-sort]', this).each(function () {
const self = $(this);
if (!self.data('sort', true)) {
disabledSort.push(self.index());
}
});
if (disabledSort.length > 0) {
if (!options.hasOwnProperty('columnDefs')) {
options.columnDefs = [];
}
options.columnDefs.push(
{
targets: disabledSort,
orderable: false,
},
);
}
//endregion
//region Gestion nom des colonnes
const columnsName = $('> thead > tr > th[data-sort-name]', this);
if (columnsName.length > 0) {
if (!options.hasOwnProperty('columnDefs')) {
options.columnDefs = [];
}
columnsName.each(function () {
const self = $(this);
const name = self.data('sortName', '');
if (name !== '') {
options.columnDefs.push(
{
targets: self.index(),
name: name,
},
);
}
});
}
//endregion
//region Gestion de AJAX
const ajaxUrl = self.data('sortAjax', false);
if (ajaxUrl !== false) {
options.serverSide = true;
options.ajax = {
url: ajaxUrl,
type: 'POST',
//createCDATASection: '',
cache: self.data('sortAjaxCache', false),
};
options.columns = [];
columnsName.each(function () {
const self = $(this);
const name = self.data('sortName', '');
if (name !== '') {
options.columns[self.index()] = {
data: name,
};
}
});
}
//endregion
self.DataTable(options);
});
});

@ -1,8 +0,0 @@
import '@fortawesome/fontawesome-svg-core/styles.min.css';
import {library} from '@fortawesome/fontawesome-svg-core';
import {dom} from '@fortawesome/fontawesome-svg-core';
import {fas} from '@fortawesome/free-solid-svg-icons';
library.add(fas);
dom.watch();

@ -1,44 +0,0 @@
//region Import jQuery itself
import $ from 'jquery';
//endregion
import Utils from 'utils';
window.$ = $; // Ensure $ is available everywhere
window.jQuery = $; // Ensure global “jQuery” property available: necessary to use bootstrap event in jQuery.on ?
(function ($) {
//region .data
const jqueryDataOrig = $.fn.data;
/**
* Get a DOM "data" value
*
* @param {string} key The "data" key
* @param {any} defaultValue The default value
*
* @return {any} The "data" value
*/
$.fn.data = function (key, defaultValue = undefined) {
const value = jqueryDataOrig.apply(this, [key]);
if (Utils.isUndefined(value)) {
return defaultValue;
}
return value;
};
//endregion
//region .matchTag
/**
* Check if a jQuery element is one of the tags
*
* @param {string} tag The tag to check
* @param {string} extraTags Extra tags to check
*
* @return {boolean} True if the element is one of the tags
*/
$.fn.matchTag = function (tag, ...extraTags) {
extraTags.push(tag);
extraTags = extraTags.map((tag) => tag.toUpperCase());
return $.inArray(this.prop('tagName').toUpperCase(), extraTags) !== -1;
};
//endregion
})($);

@ -1,72 +0,0 @@
//region Fonctions de base de Bootstrap
@import '../../vendor/twbs/bootstrap/scss/functions';
//endregion
//region Color theme
//$primary : rgb(0, 0, 0);
//$secondary : rgb(102, 102, 102);
//endregion
//region Autres variables Bootstrap
$alert-padding-y : 0.25rem;
$alert-padding-x : 0.25rem;
$alert-margin-bottom : 0.5rem;
//endregion
//region Les autres variables de Boostrap
@import '../../vendor/twbs/bootstrap/scss/variables';
@import '../../vendor/twbs/bootstrap/scss/variables-dark';
//endregion
//region Maps personnalisés
//endregion
//region Reste de la configuration de Bootstrap
@import '../../vendor/twbs/bootstrap/scss/maps';
@import '../../vendor/twbs/bootstrap/scss/mixins';
@import '../../vendor/twbs/bootstrap/scss/utilities';
//endregion
//region Layout & components de Bootstrap
@import '../../vendor/twbs/bootstrap/scss/root';
@import '../../vendor/twbs/bootstrap/scss/reboot';
@import '../../vendor/twbs/bootstrap/scss/type';
@import '../../vendor/twbs/bootstrap/scss/images';
@import '../../vendor/twbs/bootstrap/scss/containers';
@import '../../vendor/twbs/bootstrap/scss/grid';
@import '../../vendor/twbs/bootstrap/scss/tables';
@import '../../vendor/twbs/bootstrap/scss/forms';
@import '../../vendor/twbs/bootstrap/scss/buttons';
@import '../../vendor/twbs/bootstrap/scss/transitions';
@import '../../vendor/twbs/bootstrap/scss/dropdown';
@import '../../vendor/twbs/bootstrap/scss/button-group';
@import '../../vendor/twbs/bootstrap/scss/nav';
@import '../../vendor/twbs/bootstrap/scss/navbar';
@import '../../vendor/twbs/bootstrap/scss/card';
@import '../../vendor/twbs/bootstrap/scss/accordion';
@import '../../vendor/twbs/bootstrap/scss/breadcrumb';
@import '../../vendor/twbs/bootstrap/scss/pagination';
@import '../../vendor/twbs/bootstrap/scss/badge';
@import '../../vendor/twbs/bootstrap/scss/alert';
@import '../../vendor/twbs/bootstrap/scss/progress';
@import '../../vendor/twbs/bootstrap/scss/list-group';
@import '../../vendor/twbs/bootstrap/scss/close';
@import '../../vendor/twbs/bootstrap/scss/toasts';
@import '../../vendor/twbs/bootstrap/scss/modal';
@import '../../vendor/twbs/bootstrap/scss/tooltip';
@import '../../vendor/twbs/bootstrap/scss/popover';
@import '../../vendor/twbs/bootstrap/scss/carousel';
@import '../../vendor/twbs/bootstrap/scss/spinners';
@import '../../vendor/twbs/bootstrap/scss/offcanvas';
@import '../../vendor/twbs/bootstrap/scss/placeholders';
//endregion
//region Helpers de Boostrap
@import '../../vendor/twbs/bootstrap/scss/helpers';
//endregion
//region API de Bootstrap
@import '../../vendor/twbs/bootstrap/scss/utilities/api';
//endregion
//region Classes complémentaires
.text-smallCaps {
font-variant : small-caps;
}
.text-overflow-ellipsis {
text-overflow : '';
}
//endregion

@ -1,26 +0,0 @@
header, footer {
background-color : var(--bs-body-bg);
width : 100%;
margin : 0;
&:not(.overlay-not-fixed) {
position : fixed;
z-index : 10;
}
}
header {
top : 0;
height : 30px;
border-bottom : 1px solid black;
}
footer {
bottom : 0;
}
#div-body {
padding-top : 21px;
padding-bottom : 0;
}
html {
scroll-padding-top : 21px
}

@ -1,6 +0,0 @@
pre.xdebug-var-dump {
position : relative;
background-color : rgb(255, 255, 255);
z-index : 10000;
margin-bottom : 0;
}

@ -0,0 +1,3 @@
body {
background-color: skyblue;
}

@ -1,7 +0,0 @@
@import 'bootstrap';
@import 'xdebug';
@import 'layout';
.required:not(.form-check-label) {
color : var(--bs-red);
}

@ -1,36 +0,0 @@
table.dataTable thead > tr > th.dt-orderable-asc span.dt-column-order::after,
table.dataTable thead > tr > th.dt-orderable-desc span.dt-column-order::after,
table.dataTable thead > tr > th.dt-ordering-asc span.dt-column-order::after,
table.dataTable thead > tr > th.dt-ordering-desc span.dt-column-order::after,
table.dataTable thead > tr > td.dt-orderable-asc span.dt-column-order::after,
table.dataTable thead > tr > td.dt-orderable-desc span.dt-column-order::after,
table.dataTable thead > tr > td.dt-ordering-asc span.dt-column-order::after,
table.dataTable thead > tr > td.dt-ordering-desc span.dt-column-order::after {
margin-top : 3px;
}
table.dataTable thead > tr > th.dt-orderable-asc span.dt-column-order,
table.dataTable thead > tr > th.dt-orderable-desc span.dt-column-order,
table.dataTable thead > tr > th.dt-ordering-asc span.dt-column-order,
table.dataTable thead > tr > th.dt-ordering-desc span.dt-column-order,
table.dataTable thead > tr > td.dt-orderable-asc span.dt-column-order,
table.dataTable thead > tr > td.dt-orderable-desc span.dt-column-order,
table.dataTable thead > tr > td.dt-ordering-asc span.dt-column-order,
table.dataTable thead > tr > td.dt-ordering-desc span.dt-column-order {
position : relative;
left : 10px;
top : none;
bottom : none;
}
div.dt-container .dt-paging .dt-paging-button {
padding : 0;
margin : 0;
}
table.dataTable th.dt-type-numeric,
table.dataTable th.dt-type-date,
table.dataTable td.dt-type-numeric,
table.dataTable td.dt-type-date {
text-align : left;
}

@ -1,145 +0,0 @@
export default class Utils {
/**
* Une variable vaut-elle "undefined" ?
*
* @param {any} variable La variable à tester
*
* @returns {boolean} Vrai si la variable vaut "undefined", sinon Faux
*/
static isUndefined (variable) {
return typeof variable === 'undefined';
}
/**
* Une variable est-elle une chaîne de caractère ?
*
* @param {any} variable La variable à tester
*
* @returns {boolean} Vrai si la variable est uen chaîne de caractères, sinon Faux
*/
static isString (variable) {
return typeof variable === 'string' || variable instanceof String;
}
/**
* Une variable est-elle une chaine de caractère vide ou équivalent (undefined ou null) ?
*
* @param {any} variable La variable à tester
*
* @returns {boolean} Vrai si la variable est une chaine de caractères vide (ou équivalent)
*/
static empty_str (variable) {
return Utils.isUndefined(variable) || variable === null || variable === '';
}
/**
* Vérifie qu'au moins une case à cocher d'une liste de cases à cocher est bien cochée
*
* @param {jQuery} list Une liste de case à cocher
*
* @returns {boolean} Vrai si au moins l'un de case à cocher est cochée.
*/
static checkAtLeastOnChecked (list) {
return list.filter(':checked').length > 0;
}
/**
* Est-ce qu'un objet jQuery possède un attribut et qu'il est différent de Faux
*
* @param {jQuery} objJquery L'objet jQuery
* @param {string} attrName Le nom de l'attribut
*
* @returns {boolean} Vrai si l'attribut existe et est différent de Faux.
*/
static hasAttr (objJquery, attrName) {
let val = objJquery.attr(attrName);
return !Utils.isUndefined(val) && val !== false;
}
/**
* Récupère le formulaire associé à un champ
*
* Tient compte de l'attribut "form" si renseigné.
*
* @param {jQuery} input Le champ pour lequel on veut le formulaire
*
* @returns {jQuery} Le formulaire correspondant
*/
static getFormOfInput (input) {
let form;
if (Utils.hasAttr(input, 'form')) {
form = $('#' + input.attr('form'));
}
else {
form = input.parents('form').first();
}
return form;
}
/**
* Supprime les doublons d'un tableau
*
* @param {any[]} array Le tableau à dédoublonner
*
* @returns {any[]} Le tableau dédoublonné
*/
static array_uniq (array) {
return Array.from(new Set(array));
}
/**
* Met la première lettre d'une chaine de caractères en majuscule
*
* @param {string} string La chaine de caractères
*
* @returns {string} La chaine de caractères avec la première lettre en majuscule
*/
static string_ucFirst (string) {
return string.charAt(0).toUpperCase() + string.slice(1);
}
/**
* Calcule la taille RÉELLE d'un élément jQuery
*
* Prends la plus grande valeur entre la hauteur CSS de l'élément et la hauteur réelle de ses enfants.
*
* Cela permet de "corriger" le problème des conteneurs plus petit que leurs enfants
*
* @param {jQuery} element
*
* @returns {int} La hauteur réelle (en px)
*/
static getElementRealHeight (element) {
if (element.length <= 0) {
return 0;
}
const elementHeight = element.outerHeight(true);
let childrenHeight = 0;
element.children().each(function () {
childrenHeight = Utils.getElementRealHeight($(this));
});
return parseInt(childrenHeight > elementHeight ? childrenHeight : elementHeight, 10);
}
/**
* Ajoute des arguments à une URL
*
* @param {object} arguments Les arguments à ajouter
* @param {string} url L'URL à laquelle ajouter les arguments ; celle actuelle (location.href) si non fournie
*
* @return {string} L'URL de résultat
*/
static addArgumentsToUrl (args, url = undefined) {
if (Utils.isUndefined(url)) {
url = document.location.href;
}
let urlObj = new URL(url);
for (const [argumentName, argumentValue] of Object.entries(args)) {
urlObj.searchParams.set(argumentName, argumentValue);
}
return urlObj.toString();
}
}

@ -25,14 +25,12 @@
"symfony/http-client": "7.2.*", "symfony/http-client": "7.2.*",
"symfony/intl": "7.2.*", "symfony/intl": "7.2.*",
"symfony/mailer": "7.2.*", "symfony/mailer": "7.2.*",
"symfony/messenger": "7.2.*",
"symfony/mime": "7.2.*", "symfony/mime": "7.2.*",
"symfony/monolog-bundle": "^3.0", "symfony/monolog-bundle": "^3.0",
"symfony/notifier": "7.2.*", "symfony/notifier": "7.2.*",
"symfony/process": "7.2.*", "symfony/process": "7.2.*",
"symfony/property-access": "7.2.*", "symfony/property-access": "7.2.*",
"symfony/property-info": "7.2.*", "symfony/property-info": "7.2.*",
"symfony/rate-limiter": "7.2.*",
"symfony/runtime": "7.2.*", "symfony/runtime": "7.2.*",
"symfony/security-bundle": "7.2.*", "symfony/security-bundle": "7.2.*",
"symfony/serializer": "7.2.*", "symfony/serializer": "7.2.*",
@ -44,8 +42,6 @@
"symfony/validator": "7.2.*", "symfony/validator": "7.2.*",
"symfony/web-link": "7.2.*", "symfony/web-link": "7.2.*",
"symfony/yaml": "7.2.*", "symfony/yaml": "7.2.*",
"symfonycasts/sass-bundle": "^0.8.2",
"twbs/bootstrap": "^5.3",
"twig/extra-bundle": "^2.12|^3.0", "twig/extra-bundle": "^2.12|^3.0",
"twig/twig": "^2.12|^3.0" "twig/twig": "^2.12|^3.0"
}, },

8514
composer.lock generated

File diff suppressed because it is too large Load Diff

@ -13,5 +13,4 @@ return [
Symfony\Bundle\SecurityBundle\SecurityBundle::class => ['all' => true], Symfony\Bundle\SecurityBundle\SecurityBundle::class => ['all' => true],
Symfony\Bundle\MonologBundle\MonologBundle::class => ['all' => true], Symfony\Bundle\MonologBundle\MonologBundle::class => ['all' => true],
Symfony\Bundle\MakerBundle\MakerBundle::class => ['dev' => true], Symfony\Bundle\MakerBundle\MakerBundle::class => ['dev' => true],
Symfonycasts\SassBundle\SymfonycastsSassBundle::class => ['all' => true],
]; ];

@ -3,9 +3,6 @@ framework:
# The paths to make available to the asset mapper. # The paths to make available to the asset mapper.
paths: paths:
- assets/ - assets/
excluded_patterns:
- '*/assets/styles/_*.scss'
- '*/assets/styles/**/_*.scss'
missing_import_mode: strict missing_import_mode: strict
when@prod: when@prod:

@ -1,25 +1,12 @@
# see https://symfony.com/doc/current/reference/configuration/framework.html # see https://symfony.com/doc/current/reference/configuration/framework.html
framework: framework:
secret: '%env(APP_SECRET)%' secret: '%env(APP_SECRET)%'
#csrf_protection: true
http_method_override: false
handle_all_throwables: true
# Enables session support. Note that the session will ONLY be started if you read or write from it. # Note that the session will be started ONLY if you read or write from it.
# Remove or comment this section to explicitly disable session support. session: true
session:
handler_id: null
cookie_secure: auto
cookie_samesite: lax
storage_factory_id: session.storage.factory.native
#esi: true #esi: true
#fragments: true #fragments: true
php_errors:
log: true
annotations:
enabled: false
when@test: when@test:
framework: framework:

@ -4,34 +4,14 @@ security:
Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface: 'auto' Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface: 'auto'
# https://symfony.com/doc/current/security.html#loading-the-user-the-user-provider # https://symfony.com/doc/current/security.html#loading-the-user-the-user-provider
providers: providers:
# Used to reload user from session & other features (e.g. switch_user) users_in_memory: { memory: null }
app_user_provider:
entity:
class: App\Entity\User
property: email
firewalls: firewalls:
dev: dev:
pattern: ^/(_(profiler|wdt)|css|images|js)/ pattern: ^/(_(profiler|wdt)|css|images|js)/
security: false security: false
main: main:
lazy: true lazy: true
provider: app_user_provider provider: users_in_memory
login_throttling:
max_attempts: 3 # per minute
form_login:
login_path: user_signIn
check_path: user_signIn
enable_csrf: true
remember_me:
secret: '%kernel.secret%'
lifetime: 604800 # 1 week, in seconds
secure: true
samesite: strict
signature_properties: [ 'password' ]
logout:
path: user_signOut
# where to redirect after logout
# target: app_any_route
# activate different ways to authenticate # activate different ways to authenticate
# https://symfony.com/doc/current/security.html#the-firewall # https://symfony.com/doc/current/security.html#the-firewall

@ -1,7 +1,7 @@
framework: framework:
default_locale: fr default_locale: en
translator: translator:
default_path: '%kernel.project_dir%/translations' default_path: '%kernel.project_dir%/translations'
fallbacks: fallbacks:
- fr - en
providers: providers:

@ -1,6 +1,5 @@
twig: twig:
file_name_pattern: '*.twig' file_name_pattern: '*.twig'
form_themes: [ 'bootstrap_5_horizontal_layout.html.twig' ]
when@test: when@test:
twig: twig:

@ -1,6 +1,5 @@
framework: framework:
validation: validation:
email_validation_mode: html5
# Enables validator auto-mapping support. # Enables validator auto-mapping support.
# For instance, basic validation constraints will be inferred from Doctrine's metadata. # For instance, basic validation constraints will be inferred from Doctrine's metadata.
#auto_mapping: #auto_mapping:

@ -16,54 +16,13 @@ return [
'path' => './assets/app.js', 'path' => './assets/app.js',
'entrypoint' => true, 'entrypoint' => true,
], ],
'datatables' => [ '@hotwired/stimulus' => [
'path' => './assets/datatables.js', 'version' => '3.2.2',
'entrypoint' => true,
],
'jqueryLocal' => [
'path' => './assets/jqueryLocal.js',
],
'utils' => [
'path' => './assets/utils.js',
],
'fontawesome' => [
'path' => './assets/fontawesome.js',
],
'bootstrap' => [
'version' => '5.3.6',
],
'@popperjs/core' => [
'version' => '2.11.8',
],
'jquery' => [
'version' => '3.7.1',
],
'datatables.net' => [
'version' => '2.3.1',
],
'datatables.net-dt/css/dataTables.dataTables.min.css' => [
'version' => '2.3.1',
'type' => 'css',
],
'datatables.net-bs5' => [
'version' => '2.3.1',
],
'datatables.net-bs5/css/dataTables.bootstrap5.min.css' => [
'version' => '2.3.1',
'type' => 'css',
],
'@fortawesome/fontawesome-svg-core' => [
'version' => '6.7.2',
],
'@fortawesome/free-solid-svg-icons' => [
'version' => '6.7.2',
], ],
'@fortawesome/fontawesome-svg-core/styles.min.css' => [ '@symfony/stimulus-bundle' => [
'version' => '6.7.2', 'path' => './vendor/symfony/stimulus-bundle/assets/dist/loader.js',
'type' => 'css',
], ],
'bootstrap/dist/css/bootstrap.min.css' => [ '@hotwired/turbo' => [
'version' => '5.3.6', 'version' => '7.3.0',
'type' => 'css',
], ],
]; ];

@ -1,35 +0,0 @@
<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20250525095556 extends AbstractMigration
{
public function getDescription(): string
{
return '';
}
public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$this->addSql(<<<'SQL'
CREATE TABLE messenger_messages (id BIGINT AUTO_INCREMENT NOT NULL, body LONGTEXT NOT NULL, headers LONGTEXT NOT NULL, queue_name VARCHAR(190) NOT NULL, created_at DATETIME NOT NULL COMMENT '(DC2Type:datetime_immutable)', available_at DATETIME NOT NULL COMMENT '(DC2Type:datetime_immutable)', delivered_at DATETIME DEFAULT NULL COMMENT '(DC2Type:datetime_immutable)', INDEX IDX_75EA56E0FB7336F0 (queue_name), INDEX IDX_75EA56E0E3BD61CE (available_at), INDEX IDX_75EA56E016BA31DB (delivered_at), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB
SQL);
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql(<<<'SQL'
DROP TABLE messenger_messages
SQL);
}
}

@ -1,35 +0,0 @@
<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20250525104942 extends AbstractMigration
{
public function getDescription(): string
{
return '';
}
public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$this->addSql(<<<'SQL'
CREATE TABLE user (id INT AUTO_INCREMENT NOT NULL, email VARCHAR(100) NOT NULL, password VARCHAR(255) NOT NULL, name VARCHAR(100) DEFAULT NULL, roles JSON NOT NULL COMMENT '(DC2Type:json)', UNIQUE INDEX UNIQ_8D93D649E7927C74 (email), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB
SQL);
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql(<<<'SQL'
DROP TABLE user
SQL);
}
}

@ -1,23 +0,0 @@
<?php
namespace App\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Attribute\Route;
/**
* Controllers for "core" pages: home, etc.
*/
class CoreController extends AbstractController {
/**
* Home page
*
* @return Response The response
*/
#[Route('/', name: 'core_main')]
public function main (): Response {
return $this->render('Core/Main.html.twig');
}
}

@ -1,130 +0,0 @@
<?php
namespace App\Controller;
use App\Entity\User;
use App\Form\User\SignUpFormType;
use App\Misc\FlashType;
use App\Repository\UserRepository;
use App\Service\ConnectedUserService;
use App\Service\LoggerService;
use Doctrine\ORM\EntityManagerInterface;
use LogicException;
use Symfony\Bridge\Twig\Mime\TemplatedEmail;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Mailer\Exception\TransportExceptionInterface;
use Symfony\Component\Mime\Address;
use Symfony\Component\PasswordHasher\Hasher\UserPasswordHasherInterface;
use Symfony\Component\Routing\Attribute\Route;
use Symfony\Component\Security\Http\Attribute\IsGranted;
use Symfony\Component\Security\Http\Authentication\AuthenticationUtils;
use Symfony\Contracts\Translation\TranslatorInterface;
use Throwable;
/**
* Controllers for user pages
*/
#[Route('/user')]
class UserController extends AbstractController {
/**
* @var TranslatorInterface The translator service
*/
private readonly TranslatorInterface $translator;
/**
* @var ConnectedUserService The connected user service
*/
private readonly ConnectedUserService $connectedUserService;
/**
* Initialisation
*
* @param TranslatorInterface $translator The translator service
* @param ConnectedUserService $connectedUserService The connected user service
*/
public function __construct (TranslatorInterface $translator, ConnectedUserService $connectedUserService) {
$this->translator = $translator;
$this->connectedUserService = $connectedUserService;
}
/**
* Register a new user
*
* @param Request $request The request
* @param UserPasswordHasherInterface $userPasswordHasher The password hashing service
* @param EntityManagerInterface $entityManager The entity manager
*
* @return Response The response
*
* @throws TransportExceptionInterface
*/
#[Route('/signUp', name: 'user_signUp')]
public function signUp (Request $request, UserPasswordHasherInterface $userPasswordHasher, EntityManagerInterface $entityManager): Response {
if (($response = $this->connectedUserService->checkNotConnected())) {
return $response;
}
$user = new User();
$form = $this->createForm(SignUpFormType::class, $user);
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
//region Encode the plain password
$user->setPassword(
$userPasswordHasher->hashPassword(
$user,
$form->get('newPassword')->getData()
)
);
//endregion
$entityManager->persist($user);
$entityManager->flush();
$this->addFlash(FlashType::SUCCESS, 'Votre compte a bien été créé.');;
return $this->redirectToRoute('user_signIn');
}
return $this->render('User/SignUp.html.twig', [
'signUpForm' => $form->createView(),
]);
}
/**
* Sign in a user
*
* @param AuthenticationUtils $authenticationUtils Security errors from query
*
* @return Response The response
*/
#[Route(path: '/signIn', name: 'user_signIn')]
public function login (AuthenticationUtils $authenticationUtils): Response {
if (($response = $this->connectedUserService->checkNotConnected())) {
return $response;
}
if (($error = $authenticationUtils->getLastAuthenticationError()) !== null) {
$this->addFlash(FlashType::ERROR, $this->translator->trans($error->getMessageKey(), $error->getMessageData(), 'security'));
}
return $this->render(
'User/SignIn.html.twig',
[
'last_username' => $authenticationUtils->getLastUsername(),
]
);
}
/**
* Sign out
*
* <b>NOTE :</b> dummy controller, intercepted by firewall
*
* @return void
*/
#[Route(path: '/signOut', name: 'user_signOut')]
public function logout (): void {
throw new LogicException('This method can be blank - it will be intercepted by the logout key on your firewall.');
}
}

@ -1,45 +0,0 @@
<?php
namespace App\Entity;
use Doctrine\ORM\Mapping as ORM;
use JsonSerializable;
/**
* Implementation for the base implementation of an entity: id, creation and last update date and time
*/
trait TEntityBase {
/**
* @var int|null The internal id
*
* @noinspection PhpPropertyNamingConventionInspection
*/
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
/**
* Les données du trait qui doivent être inclus dans le JSON
*
* @return array Les données du trait qui doivent être inclus dans le JSON
*
* @see JsonSerializable::jsonSerialize()
*
* @noinspection PhpMethodNamingConventionInspection
*/
protected final function TEntityBase__jsonSerialize (): array {
return [
'id' => $this->getId(),
];
}
/**
* The internal id
*
* @return int|null The internal id
*/
public function getId (): ?int {
return $this->id;
}
}

@ -1,173 +0,0 @@
<?php
namespace App\Entity;
use App\Repository\UserRepository;
use DateTimeImmutable;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
use Stringable;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface;
use Symfony\Component\Security\Core\User\UserInterface;
use Symfony\Component\Validator\Constraints as Assert;
/**
* A registered user
*/
#[ORM\Entity(repositoryClass: UserRepository::class)]
#[UniqueEntity(fields: ['email'], message: 'Il existe déjà un compte avec cette adresse mail')]
class User implements UserInterface, PasswordAuthenticatedUserInterface, Stringable {
use TEntityBase;
/**
* @var string The email
*/
#[ORM\Column(length: 100, unique: true)]
#[Assert\NotBlank(message: 'Veuillez saisir un email')]
#[Assert\Email(message: 'Veuillez saisir un email valide')]
private string $email;
/**
* @var string The hashed password
*/
#[ORM\Column(length: 255)]
private string $password;
/**
* @var string|null The name
*/
#[ORM\Column(length: 100, nullable: true)]
private ?string $name = null;
/**
* @var string[] The roles
*/
#[ORM\Column]
private array $roles = [];
/**
* @inheritDoc
*/
public function __toString (): string {
return $this->getName() ?? $this->getEmail();
}
/**
* The email
*
* @return string|null The email
*/
public function getEmail (): ?string {
return $this->email;
}
/**
* Change the email
*
* @param string $email The new email
*
* @return $this
*/
public function setEmail (string $email): self {
$this->email = $email;
return $this;
}
/**
* The hashed password
*
* @return string The hashed password
*
* @see PasswordAuthenticatedUserInterface
*/
public function getPassword (): string {
return $this->password;
}
/**
* Change the hashed password
*
* @param string $password The new hashed password
*
* @return $this
*/
public function setPassword (string $password): self {
$this->password = $password;
return $this;
}
/**
* The name
*
* @return string|null The name
*/
public function getName (): ?string {
return $this->name;
}
/**
* Change the name
*
* @param string|null $name The new name
*
* @return $this
*/
public function setName (?string $name): self {
$this->name = $name;
return $this;
}
/**
* A visual identifier that represents this user
*
* @see UserInterface
*/
public function getUserIdentifier (): string {
return $this->email;
}
/**
* Has a role ?
*
* @param string $role The role
*
* @return bool True if the user has the role, else False
*/
public function hasRole (string $role): bool {
return in_array($role, $this->getRoles());
}
/**
* The roles
*
* @return string[] The roles
*
* @see UserInterface
*/
public function getRoles (): array {
$roles = $this->roles;
// guarantee every user at least has ROLE_USER
$roles[] = 'ROLE_USER';
return array_unique($roles);
}
/**
* Set the roles
*
* @param array $roles The new roles
*
* @return void
*/
public function setRoles (array $roles): void {
$this->roles = $roles;
}
/**
* Removes sensitive data from the user
*
* @see UserInterface
*/
public function eraseCredentials (): void {
}
}

@ -1,84 +0,0 @@
<?php
namespace App\Form\User;
use App\Entity\User;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
use Symfony\Component\Form\Extension\Core\Type\PasswordType;
use Symfony\Component\Form\Extension\Core\Type\RepeatedType;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\Validator\Constraints\IsTrue;
use Symfony\Component\Validator\Constraints\Length;
use Symfony\Component\Validator\Constraints\NotBlank;
/**
* The form for user registration (sign up)
*/
class SignUpFormType extends AbstractType {
/**
* @inheritDoc
*/
public function configureOptions (OptionsResolver $resolver): void {
$resolver->setDefaults(
[
'data_class' => User::class,
]
);
}
/**
* @inheritDoc
*/
public function buildForm (FormBuilderInterface $builder, array $options): void {
$builder
->add('email', null, [
'label' => 'Email',
])
->add('name', null, [
'label' => 'Nom',
])
->add('newPassword', RepeatedType::class, [
'type' => PasswordType::class,
'mapped' => false,
'attr' => ['autocomplete' => 'new-password'],
'invalid_message' => 'Les mots de passe doivent correspondre.',
'constraints' => [
new NotBlank(
[
'message' => 'Le mot de passe est requis.',
]
),
new Length(
[
'min' => 6,
'minMessage' => 'Le mot de passe doit faire au moins {{ limit }} caractères.',
'max' => 4096, // max length allowed by Symfony for security reasons
]
),
],
'first_options' => [
'label' => 'Mot de passe',
],
'second_options' => [
'label' => 'Confirmation du mot de passe',
],
])
->add('agreeTerms', CheckboxType::class, [
'mapped' => false,
'label' => 'J\'accepte les CGU',
'constraints' => [
new IsTrue(
[
'message' => 'Vous devez accepter les CGU.',
]
),
],
])
->add('submit', SubmitType::class, [
'label' => 'S\'enregistrer',
]);
}
}

@ -1,25 +0,0 @@
<?php
namespace App\Misc;
/**
* Common types of flash message
*/
class FlashType {
/**
* Information message
*/
public const INFO = 'info';
/**
* Success message
*/
public const SUCCESS = 'success';
/**
* Warning message
*/
public const WARNING = 'warning';
/**
* Error message
*/
public const ERROR = 'danger';
}

@ -1,53 +0,0 @@
<?php
namespace App\Repository;
use App\Entity\User;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Persistence\ManagerRegistry;
use Symfony\Component\Security\Core\Exception\UnsupportedUserException;
use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface;
use Symfony\Component\Security\Core\User\PasswordUpgraderInterface;
/**
* @extends ServiceEntityRepository<User>
*
* @method User|null find($id, $lockMode = null, $lockVersion = null)
* @method User|null findOneBy(array $criteria, array $orderBy = null)
* @method User[] findAll()
* @method User[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
*/
class UserRepository extends ServiceEntityRepository implements PasswordUpgraderInterface {
public function __construct (ManagerRegistry $registry) {
parent::__construct($registry, User::class);
}
public function save (User $entity, bool $flush = false): void {
$this->getEntityManager()->persist($entity);
if ($flush) {
$this->getEntityManager()->flush();
}
}
public function remove (User $entity, bool $flush = false): void {
$this->getEntityManager()->remove($entity);
if ($flush) {
$this->getEntityManager()->flush();
}
}
/**
* Used to upgrade (rehash) the user's password automatically over time.
*/
public function upgradePassword (PasswordAuthenticatedUserInterface $user, string $newHashedPassword): void {
if (!$user instanceof User) {
throw new UnsupportedUserException(sprintf('Instances of "%s" are not supported.', \get_class($user)));
}
$user->setPassword($newHashedPassword);
$this->save($user, true);
}
}

@ -1,115 +0,0 @@
<?php
namespace App\Service;
use App\Entity\User;
use App\Misc\FlashType;
use Symfony\Bundle\SecurityBundle\Security;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\RequestStack;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\Session\Session;
use Symfony\Component\Routing\RouterInterface;
use Symfony\Component\Security\Core\Exception\AccessDeniedException;
/**
* Service for the connected user
*/
readonly class ConnectedUserService {
/**
* @var Security The security service
*/
public Security $security;
/**
* @var RouterInterface The routing service
*/
private RouterInterface $router;
/**
* @var RequestStack The service for the request
*/
private RequestStack $request;
/**
* Initialization
*
* @param Security $security The security service
* @param RouterInterface $router The routing service
* @param RequestStack $request The service for the request
*/
public function __construct (Security $security, RouterInterface $router, RequestStack $request) {
$this->security = $security;
$this->router = $router;
$this->request = $request;
}
/**
* The connected user
*
* @return User|null The connected user
*/
public function getUser (): ?User {
$user = $this->security->getUser();
if ($user === null) {
return null;
}
if (!$user instanceof User) {
return null;
}
return $user;
}
/**
* Is the requested user the connected one ?
*
* @param User $requestedUser The requested user
*
* @return bool True if the requested user is the connected one, else false
*/
public function isRequestedUser (User $requestedUser): bool {
return $this->getUser()?->getId() !== $requestedUser->getId();
}
/**
* Check the user is NOT connected
*
* @return Response|null The response (warning and redirect) if user is connected, else Null
*/
public function checkNotConnected (): ?Response {
/** @var User|null $user */
$user = $this->getUser();
if ($user === null) {
return null;
}
/** @var Session $session */
$session = $this->request->getSession();
$session->getFlashBag()->add(
FlashType::WARNING,
"Vous êtes déjà connecté, merci de vous <a href=\"{$this->router->generate('user_signOut')}\">déconnecter</a> d'abord"
);
return new RedirectResponse($this->router->generate('core_main'), 302);
}
/**
* Check if the requested user is the connected one or if the last has administration privileges
*
* @param User $requestedUser The requested user
*
* @return void
*
* @throws AccessDeniedException If the access is denied
*/
public function checkRequestedUserAccess (User $requestedUser): void {
if (!$this->isRequestedUser($requestedUser)) {
return;
}
if (!$this->security->isGranted('ROLE_ADMIN')) {
return;
}
$exception = new AccessDeniedException();
$exception->setAttributes(['ROLE_ADMIN']);
$exception->setSubject(null);
throw $exception;
}
}

@ -1,55 +0,0 @@
<?php
namespace App\Service;
use Psr\Log\LoggerInterface;
use Psr\Log\LoggerTrait;
use Psr\Log\LogLevel;
use Stringable;
use Throwable;
/**
* Service for logging
*/
class LoggerService implements LoggerInterface {
use LoggerTrait;
/**
* @var LoggerInterface The logger service base
*/
public readonly LoggerInterface $loggerBase;
/**
* Initialization
*
* @param LoggerInterface $loggerBase The logger service base
*/
public function __construct (LoggerInterface $loggerBase) {
$this->loggerBase = $loggerBase;
}
/**
* @inheritDoc
*/
public function log ($level, string|Stringable $message, array $context = []): void {
$this->loggerBase->log($level, $message, $context);
}
/**
* Log an exception
*
* @param Throwable $exception The exception
* @param array $context The context (automatically add the exception in "throwable")
* @param string $level The log level
*
* @return void
*/
public function exception (Throwable $exception, array $context = [], string $level = LogLevel::ERROR): void {
$context['throwable'] = $exception;
$this->log(
$level,
'Exception [' . get_class($exception) . ']: ' . $exception->getMessage(),
$context
);
}
}

@ -308,9 +308,6 @@
"./config/packages/messenger.yaml" "./config/packages/messenger.yaml"
] ]
}, },
"symfonycasts/sass-bundle": {
"version": "v0.8.2"
},
"twig/extra-bundle": { "twig/extra-bundle": {
"version": "v3.21.0" "version": "v3.21.0"
} }

@ -1,13 +0,0 @@
{% extends '/base.html.twig' %}
{% block title %}Accueil - {{ parent() }}{% endblock %}
{% block mainContent %}
<h1>Recipe Manager</h1>
{% if app.user %}
Bienvenu {{ app.user }}
{% else %}
<p>Bienvenu sur Recipe Manager, le gestionnaire de recette de jeux vidéos.</p>
<p>Merci de vous <a href="{{ path('user_signIn') }}">connecter</a> ou <a href="{{ path('user_signOut') }}">créer un compte</a> pour commencer.</p>
{% endif %}
{% endblock %}

@ -1,33 +0,0 @@
{% extends 'base.html.twig' %}
{% block title %}Connexion - {{ parent() }}{% endblock %}
{% block mainContent %}
<h1>Connexion</h1>
<form method="post">
<div class="mb-3 row">
<label for="email" class="col-form-label col-sm-2">Email</label>
<div class="col-sm-10">
<input type="email" value="{{ last_username }}" name="_username" id="email" class="form-control" autocomplete="email" required autofocus>
</div>
</div>
<div class="mb-3 row">
<label for="password" class="col-form-label col-sm-2">Mot de passe</label>
<div class="col-sm-10">
<input type="password" name="_password" id="password" class="form-control" autocomplete="current-password" required>
</div>
</div>
<div class="mb-3 row">
<div class="col-sm-2"></div>
<div class="col-sm-10">
<div class="form-check">
<input type="checkbox" name="_remember_me" id="remember_me" class="form-check-input">
<label for="remember_me" class="form-check-label">Se souvenir de moi</label>
</div>
</div>
</div>
<input type="hidden" name="_csrf_token" value="{{ csrf_token('authenticate') }}">
<button class="btn btn-lg btn-primary" type="submit">Se connecter</button>
</form>
{% endblock %}

@ -1,8 +0,0 @@
{% extends 'base.html.twig' %}
{% block title %}Création compte - {{ parent() }}{% endblock %}
{% block mainContent %}
<h1>Création compte</h1>
{{ form(signUpForm) }}
{% endblock %}

@ -1,15 +0,0 @@
{% block flashTag %}
{% set flashes = app.flashes %}
{% if flashes|length > 0 %}
<section id="flashes" class="d-flex flex-column mt-3">
{% for flashType, flashMessages in flashes %}
{% for flashMessage in flashMessages %}
<div class="alert alert-{{ flashType }} alert-dismissible fade show" role="{{ flashType }}">
{{ flashMessage|raw }}
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
</div>
{% endfor %}
{% endfor %}
</section>
{% endif %}
{% endblock %}

@ -1,35 +1,17 @@
{% extends "/symfony.html.twig" %} <!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="UTF-8">
<title>{% block title %}Welcome!{% endblock %}</title>
<link rel="icon" href="data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 128 128%22><text y=%221.2em%22 font-size=%2296%22>⚫️</text><text y=%221.3em%22 x=%220.2em%22 font-size=%2276%22 fill=%22%23fff%22>sf</text></svg>">
{% block stylesheets %}
{% endblock %}
{% block title %}Recipe Manager{% endblock %} {% block javascripts %}
{% block importmap %}{{ importmap('app') }}{% endblock %}
{% block headerTag %} {% endblock %}
<header class="pb-2 d-flex flex-column justify-content-start fixed-top"> </head>
{% endblock %} <body data-turbo="false">
{% block headerContent %} {% block body %}{% endblock %}
<div class="d-flex justify-content-between w-100 px-2"> </body>
<!--region Website name--> </html>
<a class="navbar-brand" href="{{ path('core_main') }}">Recipe Manager</a>
<!--endregion-->
<!--region menu-->
<nav class="navbar navbar-expand-lg py-0">
<ul class="navbar-nav">
{% if app.user %}
<!--region User menu-->
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle py-0" id="dropdown-locale" href="#" role="button" data-bs-toggle="dropdown" aria-expanded="false">
{{ app.user }}
</a>
<ul class="dropdown-menu dropdown-menu-end" aria-labelledby="dropdown-locale">
<li><a href="{{ path('user_signOut') }}" class="dropdown-item">Se déconnecter</a></li>
</ul>
</li>
<!--endregion-->
{% else %}
<li class="nav-item"><a href="{{ path('user_signIn') }}" class="nav-link py-0">Se connecter</a></li>
<li class="nav-item"><a href="{{ path('user_signUp') }}" class="nav-link py-0">S'enregistrer</a></li>
{% endif %}
</ul>
</nav>
<!--endregion-->
</div>
{% endblock %}

@ -1,21 +0,0 @@
{% extends "/root.twig" %}
{% block pageContent %}
<!DOCTYPE html>
{% block htmlTag %}
<html lang="{{ app.request.getLocale() }}">
{% endblock %}
{% block headTag %}
<!--suppress HtmlRequiredTitleElement -->
<head>
{% endblock %}
{% block headContent %}{% endblock %}
</head>
{% block bodyTag %}
<body>
{% endblock %}
{% block bodyContent %}{% endblock %}
</body>
</html>
{% endblock %}

@ -1 +0,0 @@
{% block pageContent %}{% endblock %}

@ -1,63 +0,0 @@
{% extends "/html.html.twig" %}
{% block headContent %}
{% block headContentMeta %}
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
{% endblock %}
<title>{% block title %}{% endblock %}</title>
{% block CSS %}{% endblock %}
{% block JS_head %}{% endblock %}
{% endblock %}
{% block bodyTag %}
<body id="page-{{ app.current_route }}" class="m-2">
{% endblock %}
{% block bodyContent %}
{% block headerTag %}
<header>
{% endblock %}
{% block headerContent %}{% endblock %}
</header>
{% block divBodyTag %}
<div id="div-body" class="d-flex flex-row">
{% endblock %}
{% block asideLeft %}{% endblock %}
{% block centerDivBodyTag %}
<div id="div-body-center" class="d-flex flex-column flex-grow-1">
{% endblock %}
{% block sectionTop %}{% endblock %}
{% include '/_flashes.html.twig' %}
{% block sectionBefore %}{% endblock %}
{% block mainTag %}
<main>
{% endblock %}
{% block mainContent %}{% endblock %}
</main>
{% block sectionAfter %}{% endblock %}
</div>
{% block asideRight %}{% endblock %}
</div>
{% block footerTag %}
<footer>
{% endblock %}
{% block footerContent %}{% endblock %}
</footer>
<div class="d-none">
{% block bodyHidden %}{% endblock %}
</div>
{% block JS %}
{% block importmap %}{{ importmap('app') }}{% endblock %}
{% endblock %}
{% endblock %}
Loading…
Cancel
Save