From f20d833552cf5c12ad78d38d91129c5e53cb1f8a Mon Sep 17 00:00:00 2001 From: =?utf8?q?Rapha=C3=ABl=20Gertz?= Date: Thu, 12 Aug 2021 17:09:27 +0200 Subject: [PATCH 01/16] Cleanup todo --- Controller/AbstractController.php | 28 ---------------------------- 1 file changed, 28 deletions(-) diff --git a/Controller/AbstractController.php b/Controller/AbstractController.php index f8a0b99..87ed1b9 100644 --- a/Controller/AbstractController.php +++ b/Controller/AbstractController.php @@ -10,15 +10,12 @@ use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Routing\Generator\UrlGeneratorInterface; use Rapsys\AirBundle\Entity\Slot; - use Rapsys\UserBundle\Utils\Slugger; /** * * Provides common features needed in controllers. * - * @todo: pass request_stack, router, slugger_util, path_package as constructor argument ? - * * {@inheritdoc} */ abstract class AbstractController extends BaseAbstractController { @@ -553,29 +550,4 @@ abstract class AbstractController extends BaseAbstractController { //Call parent method return $this->baseRender($view, $parameters, $response); } - - /** - * TODO: define this function to limit subscribed services ??? - * XXX: see vendor/symfony/framework-bundle/Controller/AbstractController.php - * - public static function getSubscribedServices() { - //TODO: add asset.package ? - return [ - 'router' => '?'.RouterInterface::class, - 'request_stack' => '?'.RequestStack::class, - 'http_kernel' => '?'.HttpKernelInterface::class, - 'serializer' => '?'.SerializerInterface::class, - 'session' => '?'.SessionInterface::class, - 'security.authorization_checker' => '?'.AuthorizationCheckerInterface::class, - 'templating' => '?'.EngineInterface::class, - 'twig' => '?'.Environment::class, - 'doctrine' => '?'.ManagerRegistry::class, - 'form.factory' => '?'.FormFactoryInterface::class, - 'security.token_storage' => '?'.TokenStorageInterface::class, - 'security.csrf.token_manager' => '?'.CsrfTokenManagerInterface::class, - 'parameter_bag' => '?'.ContainerBagInterface::class, - 'message_bus' => '?'.MessageBusInterface::class, - 'messenger.default_bus' => '?'.MessageBusInterface::class, - ]; - }*/ } -- 2.41.1 From 8f757e868d17f50a93f02bfbcdfc7125686514f9 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Rapha=C3=ABl=20Gertz?= Date: Thu, 12 Aug 2021 17:09:59 +0200 Subject: [PATCH 02/16] Change start time Cleanup --- Controller/ApplicationController.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Controller/ApplicationController.php b/Controller/ApplicationController.php index a6091cd..deab095 100644 --- a/Controller/ApplicationController.php +++ b/Controller/ApplicationController.php @@ -132,8 +132,8 @@ class ApplicationController extends DefaultController { $session->setLength(new \DateTime('03:00:00')); //Check if evening } elseif ($slot == 'Evening') { - //Set begin at 19h - $session->setBegin(new \DateTime('19:30:00')); + //Set begin at 20h30 + $session->setBegin(new \DateTime('20:30:00')); //Check if next day is premium if ($premium) { @@ -417,7 +417,7 @@ class ApplicationController extends DefaultController { //Generate url return $this->redirectToRoute($name, $route); //No route matched - } catch(MethodNotAllowedException|ResourceNotFoundException $e) { + } catch (MethodNotAllowedException|ResourceNotFoundException $e) { //Unset referer to fallback to default route unset($referer); } -- 2.41.1 From cca1e1f30e713018035c6960761476320ae9b397 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Rapha=C3=ABl=20Gertz?= Date: Thu, 12 Aug 2021 17:11:53 +0200 Subject: [PATCH 03/16] Add todo --- Controller/CalendarController.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Controller/CalendarController.php b/Controller/CalendarController.php index 45cf8b7..7b61e9e 100644 --- a/Controller/CalendarController.php +++ b/Controller/CalendarController.php @@ -135,7 +135,10 @@ class CalendarController extends DefaultController { /** * List all sessions for the organizer * - * @desc Display all sessions for the user with an application or login form + * Display all sessions for the user with an application or login form + * + * @todo Fetch all google calendar and let user select one + * @todo Then save the calendar fucking id in database ??? with token infos !!! * * @param Request $request The request instance * -- 2.41.1 From 15acb004e92efe2dd0bf8ff00a716595b536d6f2 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Rapha=C3=ABl=20Gertz?= Date: Thu, 12 Aug 2021 17:12:23 +0200 Subject: [PATCH 04/16] Cleanup locale Fix facebook texts merging --- Controller/SessionController.php | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/Controller/SessionController.php b/Controller/SessionController.php index 5a48d99..3ba3a88 100644 --- a/Controller/SessionController.php +++ b/Controller/SessionController.php @@ -43,8 +43,11 @@ class SessionController extends DefaultController { //Get doctrine $doctrine = $this->getDoctrine(); + //Set locale + $locale = $request->getLocale(); + //Fetch session - $session = $doctrine->getRepository(Session::class)->fetchOneById($id, $request->getLocale()); + $session = $doctrine->getRepository(Session::class)->fetchOneById($id, $locale); //Check if if ( @@ -107,16 +110,13 @@ class SessionController extends DefaultController { $this->context['page']['section'] = $this->translator->trans($session['l_title']); //Set localization date formater - $intlDate = new \IntlDateFormatter($this->locale, \IntlDateFormatter::TRADITIONAL, \IntlDateFormatter::NONE); + $intlDate = new \IntlDateFormatter($locale, \IntlDateFormatter::TRADITIONAL, \IntlDateFormatter::NONE); //Set localization time formater - $intlTime = new \IntlDateFormatter($this->locale, \IntlDateFormatter::NONE, \IntlDateFormatter::SHORT); + $intlTime = new \IntlDateFormatter($locale, \IntlDateFormatter::NONE, \IntlDateFormatter::SHORT); //Set facebook image - $this->facebookImage = [ - //XXX: was facebook///..jpeg - //XXX: format facebook..jpeg - #'destination' => 'facebook/session/view/'.$id.'.'.$locale.'.jpeg', + $this->context['facebook'] += [ 'texts' => [ $session['au_pseudonym'] => [ 'font' => 'irishgrover', @@ -603,8 +603,11 @@ class SessionController extends DefaultController { //Fetch doctrine $doctrine = $this->getDoctrine(); + //Set locale + $locale = $request->getLocale(); + //Fetch session - if (empty($session = $doctrine->getRepository(Session::class)->fetchOneById($id, $this->locale))) { + if (empty($session = $doctrine->getRepository(Session::class)->fetchOneById($id, $locale))) { throw $this->createNotFoundException($this->translator->trans('Unable to find session: %id%', ['%id%' => $id])); } @@ -643,7 +646,7 @@ class SessionController extends DefaultController { } //Set localization date formater - $intl = new \IntlDateFormatter($this->locale, \IntlDateFormatter::GREGORIAN, \IntlDateFormatter::SHORT); + $intl = new \IntlDateFormatter($locale, \IntlDateFormatter::GREGORIAN, \IntlDateFormatter::SHORT); //Set section $this->context['page']['section'] = $this->translator->trans($session['l_title']); @@ -658,16 +661,13 @@ class SessionController extends DefaultController { ]; //Set localization date formater - $intlDate = new \IntlDateFormatter($this->locale, \IntlDateFormatter::TRADITIONAL, \IntlDateFormatter::NONE); + $intlDate = new \IntlDateFormatter($locale, \IntlDateFormatter::TRADITIONAL, \IntlDateFormatter::NONE); //Set localization time formater - $intlTime = new \IntlDateFormatter($this->locale, \IntlDateFormatter::NONE, \IntlDateFormatter::SHORT); + $intlTime = new \IntlDateFormatter($locale, \IntlDateFormatter::NONE, \IntlDateFormatter::SHORT); //Set facebook image - $this->facebookImage = [ - //XXX: was facebook///..jpeg - //XXX: format facebook..jpeg - #'destination' => 'facebook/session/view/'.$id.'.'.$this->locale.'.jpeg', + $this->context['facebook'] = [ 'texts' => [ $session['au_pseudonym'] => [ 'font' => 'irishgrover', @@ -683,7 +683,7 @@ class SessionController extends DefaultController { ] ], 'updated' => $session['updated']->format('U') - ]; + ]+$this->context['facebook']; //With granted session if (!empty($session['au_id'])) { -- 2.41.1 From 482ab71a0645608ec3f2e1d05b4b2dc436d9a9ad Mon Sep 17 00:00:00 2001 From: =?utf8?q?Rapha=C3=ABl=20Gertz?= Date: Thu, 12 Aug 2021 17:13:15 +0200 Subject: [PATCH 05/16] Strict types --- Form/RegisterType.php | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/Form/RegisterType.php b/Form/RegisterType.php index 56e0add..b41944a 100644 --- a/Form/RegisterType.php +++ b/Form/RegisterType.php @@ -1,4 +1,13 @@ - + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ namespace Rapsys\AirBundle\Form; @@ -12,7 +21,7 @@ class RegisterType extends \Rapsys\UserBundle\Form\RegisterType { /** * {@inheritdoc} */ - public function buildForm(FormBuilderInterface $builder, array $options) { + public function buildForm(FormBuilderInterface $builder, array $options): FormBuilderInterface { //Call parent build form $form = parent::buildForm($builder, $options); @@ -28,7 +37,7 @@ class RegisterType extends \Rapsys\UserBundle\Form\RegisterType { /** * {@inheritdoc} */ - public function configureOptions(OptionsResolver $resolver) { + public function configureOptions(OptionsResolver $resolver): void { //Call parent configure options parent::configureOptions($resolver); @@ -43,7 +52,7 @@ class RegisterType extends \Rapsys\UserBundle\Form\RegisterType { /** * {@inheritdoc} */ - public function getName() { + public function getName(): string { return 'rapsys_air_register'; } } -- 2.41.1 From 954585d49a916db40767254d7af9ae2d35c819bc Mon Sep 17 00:00:00 2001 From: =?utf8?q?Rapha=C3=ABl=20Gertz?= Date: Thu, 12 Aug 2021 17:13:37 +0200 Subject: [PATCH 06/16] Moved to Handler --- Security/LogoutSuccessHandler.php | 116 ------------------------------ 1 file changed, 116 deletions(-) delete mode 100644 Security/LogoutSuccessHandler.php diff --git a/Security/LogoutSuccessHandler.php b/Security/LogoutSuccessHandler.php deleted file mode 100644 index c6ca529..0000000 --- a/Security/LogoutSuccessHandler.php +++ /dev/null @@ -1,116 +0,0 @@ -router = $router; - } - - /** - * {@inheritdoc} - */ - public function onLogoutSuccess(Request $request) { - //Retrieve logout route - $logout = $request->get('_route'); - - //Extract and process referer - if ($referer = $request->headers->get('referer')) { - //Create referer request instance - $req = Request::create($referer); - - //Get referer path - $path = $req->getPathInfo(); - - //Get referer query string - $query = $req->getQueryString(); - - //Remove script name - $path = str_replace($request->getScriptName(), '', $path); - - //Try with referer path - try { - //Retrieve route matching path - $route = $this->router->match($path); - - //Verify that it differ from current one - if (($name = $route['_route']) == $logout) { - throw new ResourceNotFoundException('Identical referer and logout route'); - } - - //Remove route and controller from route defaults - unset($route['_route'], $route['_controller'], $route['_canonical_route']); - - //Generate url - $url = $this->router->generate($name, $route); - //No route matched - } catch(ResourceNotFoundException $e) { - //Unset referer to fallback to default route - unset($referer); - } - } - - //Referer empty or unusable - if (empty($referer)) { - //Try with / path - try { - //Retrieve route matching / - $route = $this->router->match('/'); - - //Verify that it differ from current one - if (($name = $route['_route']) == $logout) { - throw new ResourceNotFoundException('Identical referer and logout route'); - } - - //Remove route and controller from route defaults - unset($route['_route'], $route['_controller'], $route['_canonical_route']); - - //Generate url - $url = $this->router->generate($name, $route); - //Get first route from route collection if / path was not matched - } catch(ResourceNotFoundException $e) { - //Fetch all routes - //XXX: this method regenerate the Routing cache making apps very slow - //XXX: see https://github.com/symfony/symfony-docs/issues/6710 - //XXX: it should be fine to call it without referer and a / route - foreach($this->router->getRouteCollection() as $name => $route) { - //Return on first public route excluding logout one - if (!empty($name) && $name[0] != '_' && $name != $logout) { - break; - } - } - - //Bail out if no route found - if (!isset($name) || !isset($route)) { - throw new \RuntimeException('Unable to retrieve default route'); - } - - //Retrieve route defaults - $defaults = $route->getDefaults(); - - //Remove route and controller from route defaults - unset($defaults['_route'], $defaults['_controller'], $defaults['_canonical_route']); - - //Generate url - $url = $this->router->generate($name, $defaults); - } - } - - //Return redirect response - return new RedirectResponse($url, 302); - } -} -- 2.41.1 From ad11acebb6aaa5b7b04f965a30f39ef06dc0812a Mon Sep 17 00:00:00 2001 From: =?utf8?q?Rapha=C3=ABl=20Gertz?= Date: Thu, 12 Aug 2021 17:14:57 +0200 Subject: [PATCH 07/16] Add strict type Add getAlias static function --- RapsysAirBundle.php | 43 ++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 40 insertions(+), 3 deletions(-) diff --git a/RapsysAirBundle.php b/RapsysAirBundle.php index 06f1b37..46a770d 100644 --- a/RapsysAirBundle.php +++ b/RapsysAirBundle.php @@ -1,9 +1,46 @@ - + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ namespace Rapsys\AirBundle; +use Symfony\Component\DependencyInjection\Container; use Symfony\Component\HttpKernel\Bundle\Bundle; -class RapsysAirBundle extends Bundle -{ +class RapsysAirBundle extends Bundle{ + /** + * Return bundle alias + * + * @return string The bundle alias + */ + public static function getAlias(): string { + //With namespace + if ($npos = strrpos(static::class, '\\')) { + //Set name pos + $npos++; + //Without namespace + } else { + $npos = 0; + } + + //With trailing bundle + if (substr(static::class, -strlen('Bundle'), strlen('Bundle')) === 'Bundle') { + //Set bundle pos + $bpos = strlen(static::class) - $npos - strlen('Bundle'); + //Without bundle + } else { + //Set bundle pos + $bpos = strlen(static::class) - $npos; + } + + //Return underscored lowercase bundle alias + return Container::underscore(substr(static::class, $npos, $bpos)); + } } -- 2.41.1 From b77332a75f8c0a44b2066280059112fdb68afa47 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Rapha=C3=ABl=20Gertz?= Date: Thu, 12 Aug 2021 17:18:44 +0200 Subject: [PATCH 08/16] Display all user for admin and only organizers for others Switch to new civility_class naming Cleanup --- Controller/UserController.php | 42 ++++++++++++++++++++--------------- 1 file changed, 24 insertions(+), 18 deletions(-) diff --git a/Controller/UserController.php b/Controller/UserController.php index 963f538..7d38c02 100644 --- a/Controller/UserController.php +++ b/Controller/UserController.php @@ -28,11 +28,21 @@ class UserController extends DefaultController { //Fetch doctrine $doctrine = $this->getDoctrine(); - //Set section - $section = $this->translator->trans('Libre Air users'); + //With admin role + if ($this->isGranted('ROLE_ADMIN')) { + //Set section + $section = $this->translator->trans('Libre Air users'); - //Set description - $this->context['description'] = $this->translator->trans('Libre Air user list'); + //Set description + $this->context['description'] = $this->translator->trans('Libre Air user list'); + //Without admin role + } else { + //Set section + $section = $this->translator->trans('Libre Air organizers'); + + //Set description + $this->context['description'] = $this->translator->trans('Libre Air organizers list'); + } //Set keywords $this->context['keywords'] = [ @@ -60,10 +70,14 @@ class UserController extends DefaultController { ) ); + //With admin role + if ($this->isGranted('ROLE_ADMIN')) { + //Display all users + $this->context['groups'] = $users; //Without admin role - if (!$this->isGranted('ROLE_ADMIN')) { - //Remove users - unset($users[$this->translator->trans('User')]); + } else { + //Only display senior organizers + $this->context['users'] = $users[$this->translator->trans('Senior')]; } //Fetch locations @@ -71,7 +85,7 @@ class UserController extends DefaultController { $locations = $doctrine->getRepository(Location::class)->findTranslatedSortedByPeriod($this->translator, $period); //Render the view - return $this->render('@RapsysAir/user/index.html.twig', ['title' => $title, 'section' => $section, 'users' => $users, 'locations' => $locations]+$this->context); + return $this->render('@RapsysAir/user/index.html.twig', ['title' => $title, 'section' => $section, 'locations' => $locations]+$this->context); } /** @@ -150,7 +164,7 @@ class UserController extends DefaultController { //Set the form attribute 'attr' => [ 'class' => 'col' ], //Set civility class - 'class_civility' => Civility::class, + 'civility_class' => Civility::class, //Disable mail 'mail' => $this->isGranted('ROLE_ADMIN'), //Disable password @@ -279,23 +293,15 @@ class UserController extends DefaultController { } //Create SnippetType form - #$form = $this->createForm('Rapsys\AirBundle\Form\SnippetType', $snippet, [ $form = $this->container->get('form.factory')->createNamed('snipped_'.$request->getLocale().'_'.$locationId, 'Rapsys\AirBundle\Form\SnippetType', $snippet, [ //Set the action - //TODO: voir si on peut pas faire sauter ça ici 'action' => !empty($snippet->getId()) ? $this->generateUrl('rapsys_air_snippet_edit', ['id' => $snippet->getId()]) : $this->generateUrl('rapsys_air_snippet_add', ['location' => $locationId]), - #'action' => $this->generateUrl('rapsys_air_snippet_add'), //Set the form attribute - 'attr' => [], - //Set csrf_token_id - //TODO: would maybe need a signature field - //'csrf_token_id' => $request->getLocale().'_'.$id.'_'.$locationId + 'attr' => [] ]); - #return $this->container->get('form.factory')->create($type, $data, $options); - #public function createNamed($name, $type = 'Symfony\Component\Form\Extension\Core\Type\FormType', $data = null, array $options = []); //Add form to context $this->context['forms']['snippets'][$locationId] = $form->createView(); -- 2.41.1 From 24792d68ecf00e41fe2af7d70145a946aa9dc82c Mon Sep 17 00:00:00 2001 From: =?utf8?q?Rapha=C3=ABl=20Gertz?= Date: Thu, 12 Aug 2021 17:21:38 +0200 Subject: [PATCH 09/16] Fix findUserGroupedByTranslatedGroup to list all users in each group --- Repository/UserRepository.php | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/Repository/UserRepository.php b/Repository/UserRepository.php index e7ff076..985b3b2 100644 --- a/Repository/UserRepository.php +++ b/Repository/UserRepository.php @@ -151,17 +151,11 @@ class UserRepository extends \Doctrine\ORM\EntityRepository { //Set the request $req = <<addScalarResult('id', 'id', 'integer') + ->addScalarResult('mail', 'mail', 'string') ->addScalarResult('pseudonym', 'pseudonym', 'string') ->addScalarResult('g_id', 'g_id', 'integer') - ->addScalarResult('g_title', 'g_title', 'string') - ->addIndexByScalar('id'); + ->addScalarResult('g_title', 'g_title', 'string'); //Fetch result $res = $em @@ -191,7 +185,7 @@ SQL; //Process result foreach($res as $data) { //Get translated group - $group = $translator->trans($data['g_title']?:'User'); + $group = $translator->trans($data['g_title']); //Init group subarray if (!isset($ret[$group])) { @@ -199,7 +193,10 @@ SQL; } //Set data - $ret[$group][$data['id']] = $data['pseudonym']; + $ret[$group][$data['id']] = [ + 'mail' => $data['mail'], + 'pseudonym' => $data['pseudonym'] + ]; } //Send result -- 2.41.1 From 69be160e37ee908eabc52d5f7ca2294651b252eb Mon Sep 17 00:00:00 2001 From: =?utf8?q?Rapha=C3=ABl=20Gertz?= Date: Thu, 12 Aug 2021 17:23:04 +0200 Subject: [PATCH 10/16] Update translations --- Resources/translations/messages.en_gb.yaml | 10 +++++++--- Resources/translations/messages.fr_fr.yaml | 10 +++++++--- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/Resources/translations/messages.en_gb.yaml b/Resources/translations/messages.en_gb.yaml index e0addef..d984126 100644 --- a/Resources/translations/messages.en_gb.yaml +++ b/Resources/translations/messages.en_gb.yaml @@ -8,6 +8,7 @@ 'Absence the first hour in cancellation case': 'Absence the first hour in cancellation case' 'Abstract': 'Abstract' 'Access denied': 'Access denied' +'Account %mail% do not exists': 'Account %mail% do not exists' 'Account %mail% already exists': 'Account %mail% already exists' 'Account %mail% created but unable to contact': 'Account %mail% created but unable to contact' 'Account %mail% password updated': 'Account %mail% password updated' @@ -196,7 +197,8 @@ 'Missing in action': 'Missing in action' 'Missing talcum powder': 'Missing talcum powder' 'Mister': 'Mister' -'Modify': 'Modify' +'Modify account': 'Modify account' +'Modify password': 'Modify password' 'Monday': 'Monday' 'Monde garden': 'Monde garden' 'Monde': 'Monde' @@ -318,7 +320,7 @@ 'Thursday': 'Thursday' 'Tino-Rossi garden': 'Tino-Rossi garden' 'Title': 'Title' -'To change your password login with your mail %mail% and any password then follow the procedure': 'To change your password login with your mail %mail% and any password then follow the procedure' +'To change your password relogin with your mail %mail% and any password then follow the procedure': 'To change your password relogin with your mail %mail% and any password then follow the procedure' 'To change your password login with your mail and any password then follow the procedure': 'To change your password login with your mail and any password then follow the procedure' 'To create your account you must follow this link: %confirm_url%': 'To create your account you can follow this link: %confirm_url%' 'To create your account you must follow this link:': 'To create your account you can follow this link:' @@ -332,6 +334,7 @@ 'Tuesday': 'Tuesday' 'Unable to access this page without role %role%!': 'Unable to access this page without role %role%!' 'Unable to access user: %id%': 'Unable to access user: %id%' +'Unable to access user: %mail%': 'Unable to access user: %mail%' 'Unable to find account %mail%': 'Unable to find account %mail%' 'Unable to find account': 'Unable to find account' 'Unable to find user: %id%': 'Unable to find user: %id%' @@ -359,6 +362,7 @@ 'Who': 'Who' 'Your abstract': 'Your abstract' 'Your account has been created': 'Your account has been created' +'Your account has been disabled': 'Your account has been disabled' 'Your account password has been changed, to recover your account you can follow this link: %recover_url%': 'Your account password has been changed, to recover your account you can follow this link: %recover_url%' 'Your account password has been changed, to recover your account you can follow this link:': 'Your account password has been changed, to recover your account you can follow this link:' 'Your address': 'Your address' @@ -399,7 +403,7 @@ 'Your surname': 'Your surname' 'Your title': 'Your title' 'Your user': 'Your user' -'Your verification mail has been sent, to create your account you must follow the confirmation link inside': 'Your verification mail has been sent, to create your account you must follow the confirmation link inside' +'Your verification mail has been sent, to activate your account you must follow the confirmation link inside': 'Your verification mail has been sent, to activate your account you must follow the confirmation link inside' 'Your website': 'Your website' 'Your zipcode': 'Your zipcode' 'Zipcode': 'Zipcode' diff --git a/Resources/translations/messages.fr_fr.yaml b/Resources/translations/messages.fr_fr.yaml index 11d993a..3d19fe2 100644 --- a/Resources/translations/messages.fr_fr.yaml +++ b/Resources/translations/messages.fr_fr.yaml @@ -8,6 +8,7 @@ 'Absence the first hour in cancellation case': 'Absence la première heure en cas d''annulation' 'Abstract': 'Résumé' 'Access denied': 'Accès refusé' +'Account %mail% do not exists': 'Compte %mail% n''existe pas' 'Account %mail% already exists': 'Compte %mail% déjà existant' 'Account %mail% created but unable to contact': 'Compte %mail% créé mais impossible à contacter' 'Account %mail% password updated': 'Mot de passe du compte %mail% mis à jour' @@ -201,7 +202,8 @@ 'Missing in action': 'Porté disparu' 'Missing talcum powder': 'Talc manquant' 'Mister': 'Monsieur' -'Modify': 'Modifier' +'Modify account': 'Modifier le compte' +'Modify password': 'Modifier le mot de passe' 'Monday': 'Lundi' 'Monde garden': 'Jardin du Monde' 'Monde': 'Monde' @@ -329,7 +331,7 @@ 'Thursday': 'Jeudi' 'Tino-Rossi garden': 'Jardin Tino-Rossi' 'Title': 'Titre' -'To change your password login with your mail %mail% and any password then follow the procedure': 'Pour changer votre mot de passe connectez-vous avec votre courriel %mail% et n''importe quel mot de passe puis suivez la procédure' +'To change your password relogin with your mail %mail% and any password then follow the procedure': 'Pour changer votre mot de passe reconnectez-vous avec votre courriel %mail% et n''importe quel mot de passe puis suivez la procédure' 'To change your password login with your mail and any password then follow the procedure': 'Pour changer votre mot de passe connectez-vous avec votre courriel et n''importe quel mot de passe puis suivez la procédure' 'To create your account you must follow this link: %confirm_url%': 'Pour créer votre compte vous devez suivre ce lien : %confirm_url%' 'To create your account you must follow this link:': 'Pour créer votre compte vous devez suivre ce lien :' @@ -343,6 +345,7 @@ 'Tuesday': 'Mardi' 'Unable to access this page without role %role%!': 'Impossible d''accéder à cette page sans rôle %role% !' 'Unable to access user: %id%': 'Impossible d''accéder à l''utilisateur : %id%' +'Unable to access user: %mail%': 'Impossible d''accéder à l''utilisateur : %mail%' 'Unable to find account %mail%': 'Impossible de trouver le compte %mail%' 'Unable to find account': 'Impossible de trouver le compte' 'Unable to find user: %id%': 'Impossible de trouver l''utilisateur : %id%' @@ -370,6 +373,7 @@ 'Who': 'Qui' 'Your abstract': 'Votre résumé' 'Your account has been created': 'Votre compte a été créé' +'Your account has been disabled': 'Votre compte a été désactivé' 'Your account password has been changed, to recover your account you can follow this link: %recover_url%': 'Votre mot de passe a été changé, pour récupérer votre compte vous pouvez suivre ce lien : %recover_url%' 'Your account password has been changed, to recover your account you can follow this link:': 'Votre mot de passe a été changé, pour récupérer votre compte vous pouvez suivre ce lien :' 'Your address': 'Votre adresse' @@ -411,7 +415,7 @@ 'Your surname': 'Votre nom' 'Your title': 'Votre titre' 'Your user': 'Votre utilisateur' -'Your verification mail has been sent, to create your account you must follow the confirmation link inside': 'Votre courriel de vérification a été envoyé, pour créer votre compte vous devez suivre le lien de confirmation à l''intérieur' +'Your verification mail has been sent, to activate your account you must follow the confirmation link inside': 'Votre courriel de vérification a été envoyé, pour activer votre compte vous devez suivre le lien de confirmation à l''intérieur' 'Your zipcode': 'Votre code postal' 'Zipcode': 'Code postal' 'about': 'à propos' -- 2.41.1 From 5302eeb6beec026d010232f5fba6585d7573dead Mon Sep 17 00:00:00 2001 From: =?utf8?q?Rapha=C3=ABl=20Gertz?= Date: Thu, 12 Aug 2021 17:23:31 +0200 Subject: [PATCH 11/16] Update routes to match rapsys_user one --- Resources/config/routes/rapsys_air.yaml | 30 ++++++++++++++++--------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/Resources/config/routes/rapsys_air.yaml b/Resources/config/routes/rapsys_air.yaml index 675376e..e148bfb 100644 --- a/Resources/config/routes/rapsys_air.yaml +++ b/Resources/config/routes/rapsys_air.yaml @@ -155,29 +155,35 @@ rapsys_air_user_view: rapsys_user_confirm: path: - en_gb: '/en/confirm/{mail}/{extra}/{hash}' - fr_fr: '/confirmer/{mail}/{extra}/{hash}' + en_gb: '/en/confirm/{hash}/{mail}' + fr_fr: '/confirmer/{hash}/{mail}' controller: Rapsys\UserBundle\Controller\DefaultController::confirm requirements: mail: '[a-zA-Z0-9=_-]+' - extra: '[a-zA-Z0-9=_-]+' hash: '[a-zA-Z0-9=_-]+' methods: GET|POST rapsys_user_edit: path: - en_gb: '/en/user/{mail}' - fr_fr: '/utilisateur/{mail}' + en_gb: '/en/user/{hash}/{mail}' + fr_fr: '/utilisateur/{hash}/{mail}' controller: Rapsys\UserBundle\Controller\DefaultController::edit requirements: mail: '[a-zA-Z0-9=_-]+' + hash: '[a-zA-Z0-9=_-]+' methods: GET|POST rapsys_user_login: path: - en_gb: '/en/login' - fr_fr: '/connecter' + en_gb: '/en/login/{hash}/{mail}' + fr_fr: '/connecter/{hash}/{mail}' controller: Rapsys\UserBundle\Controller\DefaultController::login + defaults: + mail: ~ + hash: ~ + requirements: + mail: '[a-zA-Z0-9=_-]+' + hash: '[a-zA-Z0-9=_-]+' methods: GET|POST rapsys_user_logout: @@ -188,8 +194,8 @@ rapsys_user_logout: rapsys_user_recover: path: - en_gb: '/en/recover/{mail}/{pass}/{hash}' - fr_fr: '/recuperer/{mail}/{pass}/{hash}' + en_gb: '/en/recover/{hash}/{pass}/{mail}' + fr_fr: '/recuperer/{hash}/{pass}/{mail}' controller: Rapsys\UserBundle\Controller\DefaultController::recover defaults: mail: ~ @@ -203,13 +209,15 @@ rapsys_user_recover: rapsys_user_register: path: - en_gb: '/en/register/{field}/{hash}' - fr_fr: '/enregistrer/{field}/{hash}' + en_gb: '/en/register/{hash}/{field}/{mail}' + fr_fr: '/enregistrer/{hash}/{field}/{mail}' controller: Rapsys\UserBundle\Controller\DefaultController::register defaults: + mail: ~ field: ~ hash: ~ requirements: + mail: '[a-zA-Z0-9=_-]+' field: '[a-zA-Z0-9=_-]+' hash: '[a-zA-Z0-9=_-]+' methods: GET|POST -- 2.41.1 From e89600a4dab2eec40db4ef4eff8a772aff473798 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Rapha=C3=ABl=20Gertz?= Date: Thu, 12 Aug 2021 17:24:21 +0200 Subject: [PATCH 12/16] Fix form header.message margin Add three class --- Resources/public/css/screen.css | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/Resources/public/css/screen.css b/Resources/public/css/screen.css index 6515930..24248d5 100644 --- a/Resources/public/css/screen.css +++ b/Resources/public/css/screen.css @@ -234,6 +234,10 @@ form button { } form .message { + margin: 0 0 .5rem 0; +} + +form div .message { margin: .25rem 0 0 0; } @@ -605,6 +609,10 @@ form .message { grid-template-columns: repeat(4, 1fr); } +.three { + grid-template-columns: repeat(3, 1fr); +} + .two { grid-template-columns: repeat(2, 1fr); } @@ -829,11 +837,11 @@ form .message { margin-bottom: 0; } - .four { + .four, + .three { grid-template-columns: repeat(2, 1fr); } - /*#dashboard .seventh:nth-child(n) { width: calc(100% / 2 - .1rem); } @@ -862,10 +870,10 @@ form .message { grid-column: auto; } - .four { + .four, + .three { grid-template-columns: repeat(1, 1fr); } - } @media ( max-width: 260px ) { -- 2.41.1 From d7fe844cb0d4ab318a08160fccf6ad71e9aa0350 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Rapha=C3=ABl=20Gertz?= Date: Thu, 12 Aug 2021 17:24:50 +0200 Subject: [PATCH 13/16] Update facebook image --- Resources/public/png/facebook.png | Bin 15036572 -> 15036572 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/Resources/public/png/facebook.png b/Resources/public/png/facebook.png index 137ee3ceb54d6f91aea42e1b5d1c42386d938b48..e896631decdb8a17b6ea72bcbb3f4c868bc65685 100644 GIT binary patch delta 546 zcmZY0(_)qZ007X%W!u(TeOtBa&scWLu4UJ<>tuV?vTfV8?KkKF>b{F}d6K@b4Nv-K zreu;!A*EDO3ztS(>7JopsSwH{JEnQ!l;s(N{n5`Ws-NK?WOQs9}a1VWd$;8)K{l<)9~wR~e(-=vVbMW!RAf*!^1qPz_MRqZQx5u_nC34;0QhSF delta 546 zcmZY0(_$3>007Ws+qPTXd&BBxE!)(Hylkh!0O~OBM zl1VOwlu}78jkMB9FN2IS$t;VkvdJ!ooN~!6kG%59uYiIIDXfU1iYcyyl1eG9jIzop zuY!sqRZ>|%P)HS3Ra0G*8fprwrM5cis;9mN8fv7mCZaXfOmi)?)Jkh@wAD^~9dy)5 zXI*sFO?N%?)Jt!D^wm#)0}K>nkimu+YM9|h7-^Kz#u#gy@g|5h(Ik^iG1WBF%`np} zv&ETXu6dYmfrS=XY>B0oS#E`uR#|P0wbqHZ-Ub_Ove_01w%TU99d_Dfw>|dSXTJju zI^?h;jymSJ6HYqiv_xl|mE@fBF1YBD%dWWUn(J=3>6Y8>xa*$#9(d@H$DVlVnde@3 z>6O>scT9-~rIrR6&w0{AE{P|q~ -- 2.41.1 From 3b6350016d0f1e08ab12a9006ddb13b9da715136 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Rapha=C3=ABl=20Gertz?= Date: Thu, 12 Aug 2021 17:28:31 +0200 Subject: [PATCH 14/16] Remove recover_mail stuff Add password title and password to translated keys Add doc Set logout target route Remove LogoutSuccessHandler success handled moved to rapsys_user Add remember me feature Add missing framework.secret to get kernel.secret Rename namespace of AccessDeniedHandler to Handler --- Resources/config/packages/rapsys_air.yaml | 50 +++++++++++------------ 1 file changed, 24 insertions(+), 26 deletions(-) diff --git a/Resources/config/packages/rapsys_air.yaml b/Resources/config/packages/rapsys_air.yaml index 283651f..76da2bd 100644 --- a/Resources/config/packages/rapsys_air.yaml +++ b/Resources/config/packages/rapsys_air.yaml @@ -17,7 +17,7 @@ rapsys_user: index: name: 'rapsys_air' #Translate replacement - translate: [ 'title', 'site.title', 'copy.by', 'copy.long', 'copy.short', 'copy.title' ] + translate: [ 'title', 'password', 'site.title', 'copy.by', 'copy.long', 'copy.short', 'copy.title' ] #Languages replacement languages: en_gb: 'English' @@ -46,10 +46,11 @@ rapsys_user: route: index: 'site.url' view: - form: 'Rapsys\AirBundle\Form\RegisterType' - name: '@RapsysAir/form/register.html.twig' + edit: 'Rapsys\AirBundle\Form\RegisterType' + name: '@RapsysAir/form/edit.html.twig' context: - title: 'Modify' + title: 'Modify account' + password: 'Modify password' #Login replacement login: route: @@ -72,20 +73,6 @@ rapsys_user: html: '@RapsysAir/mail/recover.html.twig' text: '@RapsysAir/mail/recover.text.twig' context: - #Recover mail replacement - #recover_mail: - # route: - # index: 'site.url' - # recover_mail: 'recover_url' - # view: - # name: '@RapsysAir/form/recover_mail.html.twig' - # context: - # title: 'Mail recover' - # mail: - # subject: 'Welcome back %%recipient_name%% to %%site.title%%' - # html: '@RapsysAir/mail/recover_mail.html.twig' - # text: '@RapsysAir/mail/recover_mail.text.twig' - # context: #Register replacement register: route: @@ -156,21 +143,34 @@ security: #XXX: https://symfony.com/doc/current/security/form_login_setup.html #TODO: https://symfony.com/doc/current/security/guard_authentication.html form_login: + #Redirect to referer if different from login route use_referer: true + #Login path login_path: rapsys_user_login + #Check path check_path: rapsys_user_login + #Username parameter username_parameter: 'login[mail]' + #Password parameter password_parameter: 'login[password]' #Set logout route logout: + #Logout route path: rapsys_user_logout - #XXX: see https://symfony.com/doc/current/security.html#logging-out - success_handler: Rapsys\AirBundle\Security\LogoutSuccessHandler - #target: / + #Logout default target + target: rapsys_air #Set custom access denied handler - access_denied_handler: Rapsys\AirBundle\Security\AccessDeniedHandler + access_denied_handler: Rapsys\AirBundle\Handler\AccessDeniedHandler + + #Remember me + #XXX: see https://symfony.com/doc/current/security/remember_me.html + remember_me: + #Use APP_SECRET + secret: '%kernel.secret%' + #Always remember me + always_remember_me: true #Set role hierarchy role_hierarchy: @@ -191,6 +191,7 @@ framework: cookie_secure: 'auto' cookie_samesite: 'lax' disallow_search_engine_index: false + secret: '%env(APP_SECRET)%' #framework: # error_controller: Rapsys\AirBundle\Controller\ErrorController::show # @@ -288,11 +289,8 @@ services: arguments: [ '@router', '%rapsys_air.locales%' ] tags: [ 'kernel.event_subscriber' ] #Register access denied handler - Rapsys\AirBundle\Security\AccessDeniedHandler: + Rapsys\AirBundle\Handler\AccessDeniedHandler: arguments: [ '@service_container', '@twig', '@router', '@request_stack', '@translator' ] - #Register logout success handler - Rapsys\AirBundle\Security\LogoutSuccessHandler: - arguments: [ '@router' ] #Register air fixtures Rapsys\AirBundle\DataFixtures\AirFixtures: tags: [ 'doctrine.fixture.orm' ] -- 2.41.1 From b94e984c3d4b6a6d10c216607596cc57d091c934 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Rapha=C3=ABl=20Gertz?= Date: Thu, 12 Aug 2021 17:32:14 +0200 Subject: [PATCH 15/16] Use locale if set --- Resources/views/base.html.twig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Resources/views/base.html.twig b/Resources/views/base.html.twig index dba0e86..debdb4b 100644 --- a/Resources/views/base.html.twig +++ b/Resources/views/base.html.twig @@ -1,6 +1,6 @@ - - + + {% block metas %}{% endblock %} {% block title %}Welcome!{% endblock %} {% block stylesheets %}{% endblock %} -- 2.41.1 From c3fe94a42c4e2035368b753a6aeb266a04560ea6 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Rapha=C3=ABl=20Gertz?= Date: Thu, 12 Aug 2021 17:33:02 +0200 Subject: [PATCH 16/16] Fix canonical hreflang to use locale Switch to new facebook metas Switch to rapsys_user edit form Fix alternates hreflang format --- Resources/views/body.html.twig | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/Resources/views/body.html.twig b/Resources/views/body.html.twig index 6fea7b4..73aa677 100644 --- a/Resources/views/body.html.twig +++ b/Resources/views/body.html.twig @@ -36,24 +36,21 @@ {% endstylesheet %} {% endstopwatch %} {% if canonical is defined and canonical %} - + {% endif %} {% if alternates is defined and alternates %} {% for lang, alternate in alternates %} {% endfor %} {% endif %} - {% if ogps is defined and ogps %} - {% for property, content in ogps %} - - {% endfor %} - {% for property, contents in facebooks %} + {% if facebook['metas'] is defined and facebook['metas'] %} + {% for property, contents in facebook['metas'] %} {% if contents is iterable %} {% for content in contents %} - + {% endfor %} {% else %} - + {% endif %} {% endfor %} {% endif %} @@ -84,7 +81,7 @@
  • {% trans %}Organizer regulation{% endtrans %}
  • {% endif %} {% if is_granted('IS_AUTHENTICATED_REMEMBERED') %} -
  • {% trans %}My account{% endtrans %}
  • +
  • {% trans %}My account{% endtrans %}
  • {% trans %}Logout{% endtrans %}
  • {% else %}
  • {% trans %}Login{% endtrans %}
  • @@ -142,12 +139,12 @@ {% if langs|length > 1 %} {% else %} {% set lang = langs|first %} - {{ alternates[lang].translated }} + {{ alternates[lang].translated }} {% endif %} {% else %}   -- 2.41.1