71 lines
2.2 KiB
C#
71 lines
2.2 KiB
C#
using SteamWare;
|
|
using System;
|
|
|
|
namespace MoonProTablet.WebUserControls
|
|
{
|
|
public partial class mod_enrollByJumperAuthKey : BaseUserControl
|
|
{
|
|
#region Protected Methods
|
|
|
|
/// <summary>
|
|
/// Caricamento pagina
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
// procedo alla ricerca di dati via sessione x User AuthKey
|
|
tryAutoEnroll();
|
|
}
|
|
|
|
#endregion Protected Methods
|
|
|
|
#region Public Methods
|
|
|
|
/// <summary>
|
|
/// prova a fare auto enroll
|
|
/// </summary>
|
|
public void tryAutoEnroll()
|
|
{
|
|
// recupero dati da session
|
|
string UserAuthKey = "";
|
|
int MatrOpr = 0;
|
|
string userAgent = "";
|
|
bool fatto = false;
|
|
string DeviceName = "";
|
|
string IPv4 = "";
|
|
string generOpr = "";
|
|
try
|
|
{
|
|
UserAuthKey = memLayer.ML.StringSessionObj("UserAuthKey");
|
|
MatrOpr = DataLayerObj.MatrOpr;
|
|
userAgent = Request.UserAgent;
|
|
generOpr = controllerMapo.getCognomeNomeDaMatr(MatrOpr);
|
|
}
|
|
catch
|
|
{ }
|
|
// se ci sono i dati effettua tentativo di AutoEnroll del device
|
|
if (MatrOpr >= 0 && UserAuthKey != "")
|
|
{
|
|
DeviceName = Request.UserHostName;
|
|
IPv4 = Request.UserHostName;
|
|
memLayer.ML.emptyCookieVal(memLayer.ML.CRS("cookieName"));
|
|
fatto = DataLayerObj.enrollDevice(UserAuthKey, IPv4, DeviceName, userAgent, MatrOpr);
|
|
if (fatto)
|
|
{
|
|
try
|
|
{
|
|
// registro login
|
|
DataLayerObj.taDiarioDich.insertQuery("UserLogin", "", DateTime.Now, MatrOpr, $"Login: {generOpr}");
|
|
}
|
|
catch
|
|
{ }
|
|
// vado ad home
|
|
Response.Redirect(memLayer.ML.CRS("mainPage"));
|
|
}
|
|
}
|
|
}
|
|
|
|
#endregion Public Methods
|
|
}
|
|
} |