diff --git a/Jenkinsfile b/Jenkinsfile index 4be31c9..606c9df 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -7,7 +7,7 @@ pipeline { steps { /* calcolo numero versione... diverso x branch MASTER/DEVELOP */ script { - withEnv(['NEXT_BUILD_NUMBER=733']) { + withEnv(['NEXT_BUILD_NUMBER=734']) { // env.versionNumber = VersionNumber(versionNumberString : '4.0.${BUILD_DATE_FORMATTED, "yyMM"}.${BUILDS_ALL_TIME}', projectStartDate : '2006-01-01', skipFailedBuilds: true) env.versionNumber = VersionNumber(versionNumberString : '4.0.${BUILD_DATE_FORMATTED, "yyMM"}.${BUILDS_ALL_TIME}', projectStartDate : '2006-01-01', skipFailedBuilds: true, overrideBuildsAllTime: '${NEXT_BUILD_NUMBER}') env.versionNumberBeta = VersionNumber(versionNumberString : '4.0.${BUILD_DATE_FORMATTED, "yyMM"}-beta.${BUILDS_ALL_TIME}', projectStartDate : '2006-01-01', skipFailedBuilds: true, overrideBuildsAllTime: '${NEXT_BUILD_NUMBER}') diff --git a/SteamWareLib/devicesAuthProxy.cs b/SteamWareLib/devicesAuthProxy.cs index de61612..dcc79e4 100644 --- a/SteamWareLib/devicesAuthProxy.cs +++ b/SteamWareLib/devicesAuthProxy.cs @@ -403,6 +403,63 @@ namespace SteamWare return builder.ToString(); } + /// + /// verifica la presenza di un cookie VALIDO per autorizzare il device e se lo trova avvia utente IN SESSIONE... + /// + public bool checkAuthCookie() + { + bool answ = false; + try + { + HttpCookie cookie = HttpContext.Current.Request.Cookies[AuthCookieName]; + if (!(cookie == null || cookie.Value == "")) + { + // ricavo utente da cookie... + string userAgent = ""; + string postazione_IP = ""; + string devSecret = cookie.Value; + DS_Auth.AnagDevicesRow device = null; + // cerco il device...ogni dipendente può averne + di 1 registrato a suo nome... + string email = ""; + try + { + device = taAnagDev.getByDeviceSecret(devSecret)[0]; + email = device.USER_NAME; + } + catch + { } + if (email != "") + { + // aggiorno descrizione (user agent) ed IP... + userAgent = HttpContext.Current.Request.UserAgent; + postazione_IP = HttpContext.Current.Request.UserHostAddress; + // controllo IP e DeviceDescription x eventuale update + if ((device.lastIPv4 != postazione_IP) || (device.Description != userAgent)) + { + // salvo ultimo "contatto" del device aggiornando descrizione ed IP + taAnagDev.updateIP(device.IdxDevice, DateTime.Now, postazione_IP, userAgent); + } + // salvo in sessione utente + memLayer.ML.setSessionVal("email", email); + // avvio utente... + startUpUtente(email); + // salvo gruppo... + if (isAuth) + { + // se tutto ok + memLayer.ML.setSessionVal("Gruppo", rigaUtente.CodGruppo); + answ = true; + } + } + } + } + catch (Exception exc) + { + logger.lg.scriviLog(string.Format("Errore in checkAuthCookie:{0}{1}", Environment.NewLine, exc), tipoLog.EXCEPTION); + } + return answ; + } + #endregion #region area utente @@ -997,6 +1054,7 @@ namespace SteamWare memLayer.ML.setSessionVal("mappaSito", value); } } + #endregion #region gestione pagina