using AppData; using SteamWare; using System; namespace C_TRACK.WebUserControls { public partial class mod_enrollByJumperAuthKey : System.Web.UI.UserControl { protected void Page_Load(object sender, EventArgs e) { // procedo alla ricerca di dati via sessione x User AuthKey tryAutoEnroll(); } /// /// prova a fare auto enroll /// public void tryAutoEnroll() { logger.lg.scriviLog("Inizio tryAutoEnroll", tipoLog.STARTUP); // recupero dati da session string UserAuthKey = ""; string email = ""; string userAgent = ""; bool fatto = false; string DeviceName = ""; string IPv4 = ""; string CodOpr = ""; try { UserAuthKey = Request["UserAuthkey"]; email = Request["USER_NAME"]; // salvo OPR (se c'è in link di auth...) CodOpr = Request["CodOpr"]; mUtils.CodOpr = CodOpr; userAgent = Request.UserAgent; } catch { } // se ci sono i dati effettua tentativo di AutoEnroll del device if (email != "" && UserAuthKey != "") { IPv4 = Request.UserHostAddress; //DeviceName = SteamWare.dnsUtils.ReverseLookup(IPv4); //DeviceName = SteamWare.dnsUtils.DetermineCompName(IPv4); // WIN2012R2SAM DeviceName = Request.Browser.Platform; // ::1 // prova ad usare la chiave DECODIFICATA x autorizzare device fatto = devicesAuthProxy.stObj.enrollDevice(devicesAuthProxy.decodeKey(UserAuthKey), IPv4, DeviceName, userAgent, email); // se NON ce l'ha fatta ed è abilitata l'autenticazione "plain" cerca di eseguire anche quella... if (memLayer.ML.confReadBool("enablePlain") && !fatto) { fatto = devicesAuthProxy.stObj.enrollDevice(UserAuthKey, IPv4, DeviceName, userAgent, email); } if (fatto) { logger.lg.scriviLog("Completato tryAutoEnroll con SUCCESSO, rimando a Login", tipoLog.STARTUP); Response.Redirect("Login"); } else { logger.lg.scriviLog("Completato tryAutoEnroll senza riconoscimento valori link, rimando a UserAdmin", tipoLog.STARTUP); Response.Redirect("UserAdmin"); } } } } }