[module.cas] fix1 [webpack.page.login] fix [webpack.data.login] fix

This commit is contained in:
xdrm-brackets 2018-03-19 18:27:33 +01:00
parent 39635cb5fa
commit 959df5cfde
3 changed files with 20 additions and 5 deletions

View File

@ -48,7 +48,7 @@ class casController{
/* (0) Global DOWNLOAD data /* (0) Global DOWNLOAD data
---------------------------------------------------------*/ ---------------------------------------------------------*/
$headers = ['Content-Type' => 'text/html; charset=UTF-8' ]; $headers = ['Content-Type' => 'text/html; charset=UTF-8' ];
$body_start = "Veuillez patienter...<br>Vous allez être redirigés<script type='text/javascript'>window.opener.cas_callback("; $body_start = "Veuillez patienter...<br>Vous allez être redirigés<script type='text/javascript'>( typeof window.opener.cas_callback === 'function' ) && window.opener.cas_callback(";
$body_end = ");window.close();</script>"; $body_end = ");window.close();</script>";

View File

@ -1,11 +1,25 @@
gstore.add('popup_opened', false);
gstore.add('popup_click', function(){ gstore.add('popup_click', function(){
/* (1) Open popup */ /* (1) Do nothing if already opened */
if( gstore.get.popup_opened )
return;
/* (2) Store that popup is opened */
gstore.get.popup_opened = true;
/* (3) Open popup */
window.pop = window.open('https://sso.univ-pau.fr/cas/login?service='+window.api.target+'cas', '_blank', 'location=no,height=1024,width=1024,scrollbars=yes,status=no'); window.pop = window.open('https://sso.univ-pau.fr/cas/login?service='+window.api.target+'cas', '_blank', 'location=no,height=1024,width=1024,scrollbars=yes,status=no');
/* (2) If popup closed -> abort */ /* (4) Clear interval (optional) */
!isNaN(window.popint) && clearInterval(window.popint);
/* (5) Check if popup closed -> abort */
window.popint = setInterval(function(){ window.pop.closed && window.cas_callback(null); }, 500); window.popint = setInterval(function(){ window.pop.closed && window.cas_callback(null); }, 500);
}); });
gstore.add('login_class', 'neutral'); gstore.add('login_class', 'neutral');

View File

@ -32,11 +32,11 @@ window.cas_callback = function(cas_login){
setTimeout( function(){ if( window.pop.closed ){ setTimeout( function(){ if( window.pop.closed ){
/* (2) Stop interval that checks if window closed */ /* (2) Stop interval that checks if window closed */
clearInterval(window.popint); !isNaN(window.popint) && clearInterval(window.popint);
/* (3) If no login -> error */ /* (3) If no login -> error */
if( cas_login === null ){ if( cas_login === null ){
gstore.get.login_error_text = 'Erreur de connexion. Veuillez réessayer.'; gstore.get.login_error_text = 'Erreur de connexion. Veuillez réessayer.';
gstore.get.login_class = 'invalid'; gstore.get.login_class = 'invalid';
@ -47,6 +47,7 @@ window.cas_callback = function(cas_login){
gstore.get.login_error_text = 'Vous êtes connectés. Vous allez être redirigé.'; gstore.get.login_error_text = 'Vous êtes connectés. Vous allez être redirigé.';
gstore.get.login_class = 'valid'; gstore.get.login_class = 'valid';
setTimeout(function(){ document.location = '/'; }, 1500); setTimeout(function(){ document.location = '/'; }, 1500);
} }