Spostato metodo x checkCookie + login utente in steamwarelibs

This commit is contained in:
Samuele E. Locatelli
2020-03-17 10:31:19 +01:00
parent f9d2218333
commit b8736bd1c6
2 changed files with 59 additions and 1 deletions
Vendored
+1 -1
View File
@@ -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}')
+58
View File
@@ -403,6 +403,63 @@ namespace SteamWare
return builder.ToString();
}
/// <summary>
/// verifica la presenza di un cookie VALIDO per autorizzare il device e se lo trova avvia utente IN SESSIONE...
/// </summary>
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