Skip to content
Snippets Groups Projects
Commit c2e76d83 authored by Sebastien Curt's avatar Sebastien Curt
Browse files

Add page mail sent on post registration

parent c9b538e8
No related branches found
No related tags found
1 merge request!8Tuleap 40 register
This commit is part of merge request !8. Comments created here will be created in the context of that merge request.
web_profiler: web_profiler:
toolbar: true toolbar: true
intercept_redirects: false intercept_redirects: true
framework: framework:
profiler: { only_exceptions: false } profiler: { only_exceptions: false }
...@@ -11,6 +11,7 @@ framework: ...@@ -11,6 +11,7 @@ framework:
cookie_secure: auto cookie_secure: auto
cookie_samesite: lax cookie_samesite: lax
storage_factory_id: session.storage.factory.native storage_factory_id: session.storage.factory.native
enabled: true
#esi: true #esi: true
#fragments: true #fragments: true
......
twig: twig:
default_path: '%kernel.project_dir%/templates' default_path: '%kernel.project_dir%/templates'
form_themes: ['bootstrap_5_layout.html.twig']
when@test: when@test:
twig: twig:
......
...@@ -10,6 +10,7 @@ use Doctrine\ORM\EntityManagerInterface; ...@@ -10,6 +10,7 @@ use Doctrine\ORM\EntityManagerInterface;
use Symfony\Bridge\Twig\Mime\TemplatedEmail; use Symfony\Bridge\Twig\Mime\TemplatedEmail;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\RequestStack;
use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Mime\Address; use Symfony\Component\Mime\Address;
use Symfony\Component\PasswordHasher\Hasher\UserPasswordHasherInterface; use Symfony\Component\PasswordHasher\Hasher\UserPasswordHasherInterface;
...@@ -19,10 +20,12 @@ use SymfonyCasts\Bundle\VerifyEmail\Exception\VerifyEmailExceptionInterface; ...@@ -19,10 +20,12 @@ use SymfonyCasts\Bundle\VerifyEmail\Exception\VerifyEmailExceptionInterface;
class RegistrationController extends AbstractController class RegistrationController extends AbstractController
{ {
private EmailVerifier $emailVerifier; private EmailVerifier $emailVerifier;
private RequestStack $requestStack;
public function __construct(EmailVerifier $emailVerifier) public function __construct(EmailVerifier $emailVerifier, RequestStack $requestStack)
{ {
$this->emailVerifier = $emailVerifier; $this->emailVerifier = $emailVerifier;
$this->requestStack = $requestStack;
} }
/** /**
...@@ -57,9 +60,13 @@ class RegistrationController extends AbstractController ...@@ -57,9 +60,13 @@ class RegistrationController extends AbstractController
->subject('Please Confirm your Email') ->subject('Please Confirm your Email')
->htmlTemplate('registration/confirmation_email.html.twig') ->htmlTemplate('registration/confirmation_email.html.twig')
); );
// do anything else you need here, like send an email
return $this->redirectToRoute('_profiler_home'); // do anything else you need here, like send an email
// return $this->redirectToRoute('app_login');
$this->requestStack->getSession()->set('userid', $user->getId());
return $this->redirectToRoute('app_register_mail_sent');
// $message = 'An email has been sent to '. $user->getEmail() .'. It contains an activation link you must click to activate your account.';
// $this->addFlash('success', $message);
} }
return $this->render('registration/register.html.twig', [ return $this->render('registration/register.html.twig', [
...@@ -98,4 +105,16 @@ class RegistrationController extends AbstractController ...@@ -98,4 +105,16 @@ class RegistrationController extends AbstractController
return $this->redirectToRoute('app_register'); return $this->redirectToRoute('app_register');
} }
/**
* @Route("/register_mail_sent", name="app_register_mail_sent")
*/
public function mailSentMessage(UserRepository $userRepository){
$userid = $this->requestStack->getSession()->get('userid');
$user = $userRepository->find($userid);
return $this->render('registration/register_mail_sent.html.twig', [
'user' => $user,
]);
}
} }
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>{% block title %}MemoRekall{% endblock %}</title>
{# Run `composer require symfony/webpack-encore-bundle`
and uncomment the following Encore helpers to start using Symfony UX #}
{% block stylesheets %}
{{ encore_entry_link_tags('app') }}
{% endblock %}
{% block javascripts %}
{{ encore_entry_script_tags('app') }}
{% endblock %}
</head>
<body class="container">
<div class="d-flex flex-row justify-content-center mb-5">
<div class="d-flex flex-column">
<a href="/my_capsules"><img id="header-memorekall-logo" class="memorekall-logo" src="{{ asset('build/images/MemoRekall.png') }}"></a>
<div class="d-flex flex-row justify-content-center">
<a href="/login" class="btn btn-primary m-2 px-4 py-3" >LOG IN</a>
<a href="/register" class="btn btn-primary m-2 px-4 py-3" >SIGN IN</a>
</div>
</div>
</div>
{% block body %}{% endblock %}
</body>
</html>
\ No newline at end of file
{% extends 'base.html.twig' %} {% extends 'registration.base.html.twig' %}
{% block title %}Register{% endblock %} {% block title %}Register{% endblock %}
{% block body %} {% block body %}
<div class="container d-flex flex-column justify-content-center"> <div class="d-flex flex-column justify-content-center">
{% for flashError in app.flashes('verify_email_error') %} {% for flashError in app.flashes('verify_email_error') %}
<div class="alert alert-danger" role="alert">{{ flashError }}</div> <div class="alert alert-danger col-6 mx-auto my-5 h1" role="alert">{{ flashError }}</div>
{% endfor %} {% endfor %}
{% for flashError in app.flashes('success') %} {% for flashMessage in app.flashes('success') %}
<div class="alert alert-danger" role="alert">{{ flashError }}</div> <div class="alert alert-warning col-6 mx-auto my-5 h1" role="alert" >{{ flashMessage }}</div>
{% endfor %} {% endfor %}
<div> <div>
</div> </div>
{{ form_start(registrationForm, {'attr': {'class': 'd-flex flex-column justify-content-center'}}) }} {{ form_start(registrationForm, {'attr': {'class': 'd-flex flex-column justify-content-center'}}) }}
{{ form_errors(registrationForm) }}
{{ form_row(registrationForm.firstName) }} {{ form_row(registrationForm.firstName) }}
{{ form_row(registrationForm.lastName) }} {{ form_row(registrationForm.lastName) }}
{{ form_row(registrationForm.email) }} {{ form_row(registrationForm.email) }}
......
{% extends 'registration.base.html.twig' %}
{% block title %}Mail registration sent{% endblock %}
{% block body %}
<div class="container d-flex flex-row justify-content-center">
<div class="col-6">
<p class="alert">An email has been sent to {{ user.getEmail() }} . It contains an activation link you must click to activate your account</p>
</div>
</div>
{% endblock %}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment