/* (1) Imports ---------------------------------------------------------*/ /* (1) NPM libs */ import Vue from 'vue' /* (2) Vues */ import login_wrapper_vue from '../vue/login_wrapper.vue' /* (3) Data */ require('../data/common'); require('../data/login'); /* (2) Initialisation ---------------------------------------------------------*/ /* (1) Render view */ new Vue({ el: '#main-vue', render: h => h(login_wrapper_vue) }); /* (1) Initialize CAS pop-up mechanism */ window.pop = { closed: false }; window.cas_callback = function(cas_login){ /* (1) Wait 1ms for popup to really be closed */ setTimeout( function(){ if( window.pop.closed ){ /* (2) Stop interval that checks if window closed */ !isNaN(window.popint) && clearInterval(window.popint); /* (3) If no login -> error */ if( cas_login === null ){ gstore.get.login_error_text = 'Erreur de connexion. Veuillez réessayer.'; gstore.get.login_class = 'invalid'; setTimeout(function(){ gstore.get.login_class = 'neutral'; }, 1500); /* (4) If login -> reload page */ }else{ gstore.get.login_error_text = 'Vous êtes connectés. Vous allez être redirigé.'; gstore.get.login_class = 'valid'; setTimeout(function(){ document.location = '/'; }, 1500); } } }, 1); };