redirect sur group d'invitation (ref #231)
This commit is contained in:
parent
ff7183ef5b
commit
0805750c33
|
@ -212,7 +212,7 @@ class RegistrationController extends Controller
|
|||
// Sur erreur
|
||||
$this->getErrorForm(null,$form,$request,$data,"submit",$idstatut);
|
||||
|
||||
// Sur validation(z)
|
||||
// Sur validation
|
||||
if ($form->get('submit')->isClicked() && $form->isValid()) {
|
||||
|
||||
$data = $form->getData();
|
||||
|
@ -342,6 +342,8 @@ class RegistrationController extends Controller
|
|||
// A voir retour sur un écran d'info indiquant si validation par admion ou s'il doit matter ses email
|
||||
$this->get('session')->set('registrationinfo', $info);
|
||||
$this->get('session')->set('registrationmode', "info");
|
||||
$this->get('session')->set('registrationredirectto', null);
|
||||
|
||||
return $this->redirectToRoute('cadoles_core_registration_info');
|
||||
}
|
||||
else {
|
||||
|
@ -360,12 +362,16 @@ class RegistrationController extends Controller
|
|||
{
|
||||
$info = $this->get('session')->get('registrationinfo');
|
||||
$mode = $this->get('session')->get('registrationmode');
|
||||
$redirectto = $this->get('session')->get('registrationredirectto');
|
||||
|
||||
|
||||
return $this->render($this->labelentity.':info.html.twig', [
|
||||
'useheader' => true,
|
||||
'usemenu' => false,
|
||||
'usesidebar' => false,
|
||||
'info' => $info,
|
||||
'mode' => $mode
|
||||
'mode' => $mode,
|
||||
'redirectto' => $redirectto,
|
||||
]);
|
||||
}
|
||||
|
||||
|
@ -467,6 +473,7 @@ class RegistrationController extends Controller
|
|||
{
|
||||
$moderegistration = $this->getParameter('moderegistration');
|
||||
$masteridentity = $this->getParameter('masteridentity');
|
||||
|
||||
if($moderegistration=="none"||$masteridentity!="SQL")
|
||||
throw $this->createNotFoundException('Permission denied');
|
||||
|
||||
|
@ -488,7 +495,8 @@ class RegistrationController extends Controller
|
|||
$mode="danger";
|
||||
|
||||
$this->get('session')->set('registrationinfo', $info);
|
||||
$this->get('session')->set('registrationmode', $mode);
|
||||
$this->get('session')->set('registrationmode', $mode);
|
||||
$this->get('session')->set('registrationredirectto', null);
|
||||
}
|
||||
else {
|
||||
$url=$this->getUrlLogin();
|
||||
|
@ -539,10 +547,17 @@ class RegistrationController extends Controller
|
|||
|
||||
// Si invitation à un groupe : on le rattache directement à ce groupe
|
||||
$groupid=$data[0]->getGroupid();
|
||||
|
||||
$userid=$user->getId();
|
||||
if($groupid) {
|
||||
$group=$em->getRepository("CadolesCoreBundle:Group")->find($groupid);
|
||||
if($group) {
|
||||
$idpage =$group->getPages()->first()->getId();
|
||||
$url = $this->generateUrl('cadoles_core_redirect', ["route"=>"cadoles_core_home","id"=>$idpage], UrlGeneratorInterface::ABSOLUTE_URL);
|
||||
$info="<p>Votre compte est à présent activé</p><p>Vous allez être redirigé vers la mire de connexion puis vers votre groupe de travail</p><p><a href='".$url."'>Connexion</a>";
|
||||
$this->get('session')->set('registrationinfo', $info);
|
||||
$this->get('session')->set('registrationredirectto', $url);
|
||||
|
||||
$key = Uuid::uuid4();
|
||||
$usergroup=new UserGroup();
|
||||
$user=$em->getRepository("CadolesCoreBundle:User")->find($userid);
|
||||
|
@ -688,6 +703,7 @@ class RegistrationController extends Controller
|
|||
$mode="info";
|
||||
$this->get('session')->set('registrationinfo', $info);
|
||||
$this->get('session')->set('registrationmode', $mode);
|
||||
$this->get('session')->set('registrationredirectto', null);
|
||||
return $this->redirectToRoute('cadoles_core_registration_info');
|
||||
}
|
||||
|
||||
|
@ -724,6 +740,7 @@ class RegistrationController extends Controller
|
|||
$mode="danger";
|
||||
$this->get('session')->set('registrationinfo', $info);
|
||||
$this->get('session')->set('registrationmode', $mode);
|
||||
$this->get('session')->set('registrationredirectto', null);
|
||||
return $this->redirectToRoute('cadoles_core_registration_info');
|
||||
}
|
||||
else {
|
||||
|
@ -783,6 +800,7 @@ class RegistrationController extends Controller
|
|||
$mode="success";
|
||||
$this->get('session')->set('registrationinfo', $info);
|
||||
$this->get('session')->set('registrationmode', $mode);
|
||||
$this->get('session')->set('registrationredirectto', null);
|
||||
return $this->redirectToRoute('cadoles_core_registration_info');
|
||||
}
|
||||
|
||||
|
|
|
@ -18,7 +18,9 @@
|
|||
$(document).ready(function() {
|
||||
// Redirection vers la mire d'authentification
|
||||
setTimeout(function(){
|
||||
{% if mode_auth == "SAML" %}
|
||||
{% if redirectto is defined and redirectto is not null %}
|
||||
window.location.href="{{ redirectto }}";
|
||||
{% elseif mode_auth == "SAML" %}
|
||||
window.location.href="{{ path("lightsaml_sp.login") }}";
|
||||
{% elseif mode_auth == "CAS" %}
|
||||
window.location.href="{{ path("cas_sp.login") }}";
|
||||
|
@ -32,6 +34,5 @@
|
|||
}, 6000);
|
||||
});
|
||||
{% endif %}
|
||||
|
||||
{% endblock %}
|
||||
|
||||
|
|
Loading…
Reference in New Issue