Fix licenza user da SMART (reset CF + user key)
This commit is contained in:
@@ -11,43 +11,8 @@ namespace GPW.WebUserControls
|
||||
{
|
||||
public partial class mod_resetUserAuthKey : System.Web.UI.UserControl
|
||||
{
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
#region Protected Methods
|
||||
|
||||
}
|
||||
/// <summary>
|
||||
/// salvo nuovo device...
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void btnConferma_Click(object sender, EventArgs e)
|
||||
{
|
||||
// controllo se ho i dati...
|
||||
string UserAuthKey = txtUserAuthKey.Text.Trim();
|
||||
string AuthKey = txtAuthKey.Text.Trim();
|
||||
int idxDip = 0;
|
||||
try
|
||||
{
|
||||
idxDip = Convert.ToInt32(ddlIdxDipendente.SelectedValue);
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
// controllo password...
|
||||
if (AuthKey == memLayer.ML.confReadString("authKey"))
|
||||
{
|
||||
// calcolo il secret...
|
||||
string md5UserAuthKey = SteamCrypto.EncryptString(UserAuthKey, "AuthGPW");
|
||||
DataProxy.DP.taDipendenti.stp_Dip_setAuthKey(idxDip, md5UserAuthKey);
|
||||
// mostro esito!
|
||||
lblWarning.Text = string.Format("AuthKey utente {0} aggiornata", idxDip);
|
||||
lblWarning.Visible = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
lblWarning.Text = "Key errata";
|
||||
lblWarning.Visible = true;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// resetto tutto
|
||||
/// </summary>
|
||||
@@ -60,5 +25,54 @@ namespace GPW.WebUserControls
|
||||
txtUserAuthKey.Text = "";
|
||||
lblWarning.Visible = false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// salvo nuovo device...
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void btnConferma_Click(object sender, EventArgs e)
|
||||
{
|
||||
// controllo se ho i dati...
|
||||
string UserAuthKey = txtUserAuthKey.Text.Trim();
|
||||
string AuthKey = txtAuthKey.Text.Trim();
|
||||
int idxDip = 0;
|
||||
bool fatto = false;
|
||||
try
|
||||
{
|
||||
idxDip = Convert.ToInt32(ddlIdxDipendente.SelectedValue);
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
// controllo password...
|
||||
if (AuthKey == memLayer.ML.confReadString("authKey"))
|
||||
{
|
||||
if (idxDip > 0)
|
||||
{
|
||||
var dipRow = DataProxy.DP.getRowDip(idxDip);
|
||||
if (dipRow != null)
|
||||
{
|
||||
// calcolo il secret...
|
||||
string md5UserAuthKey = SteamCrypto.EncryptString(UserAuthKey, "AuthGPW").ToLowerInvariant();
|
||||
DataProxy.DP.taDipendenti.stp_Dip_setAuthKey(idxDip, $"{dipRow.CF}.{md5UserAuthKey}");
|
||||
// mostro esito!
|
||||
lblWarning.Text = string.Format("AuthKey utente {0} aggiornata", idxDip);
|
||||
lblWarning.Visible = true;
|
||||
fatto = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!fatto)
|
||||
{
|
||||
lblWarning.Text = "Key errata";
|
||||
lblWarning.Visible = true;
|
||||
}
|
||||
}
|
||||
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user