From aae30162f0a1a23ce3fe6192f4fcc75c547cd8ed Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Mon, 15 Nov 2021 17:03:41 +0100 Subject: [PATCH] Fix licenza user da SMART (reset CF + user key) --- ...gnTimeResolveAssemblyReferencesInput.cache | Bin 58749 -> 58167 bytes GPW_Data/licenzeGPW.cs | 102 ++++++++++-------- .../WebUserControls/mod_enrollByAuthKey.ascx | 2 +- .../mod_enrollByAuthKey.ascx.designer.cs | 68 ++++++------ .../WebUserControls/mod_resetUserAuthKey.ascx | 2 +- .../mod_resetUserAuthKey.ascx.cs | 86 ++++++++------- .../mod_resetUserAuthKey.ascx.designer.cs | 92 ++++++++-------- .../WebUserControls/mod_sendAuthToEmail.ascx | 2 +- .../mod_sendAuthToEmail.ascx.designer.cs | 60 ++++++----- 9 files changed, 223 insertions(+), 191 deletions(-) diff --git a/GPW_Barcode/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache b/GPW_Barcode/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache index 1867bc1443412f6c7c7e8e6a41a5e25630e09de2..b78a9a7dce429d0856b26588f95a77af23cf3549 100644 GIT binary patch delta 3059 zcma)8TS!z<6m4`YbDD?en&}AB3<%Lj526TypfdXCBfKhPkwb!_(TL?p)Q2^ey=-Po zcTG-HzI!?8sN*9u@sW+>WEe#ciX!|8zY6;(qQ^bgv^zIuAAk4Vd!4oSUT2;Ab1bqa z5P5N%Vk7X%mF<@4Q{=KDWz)XYqQbnQ>;mJC1D0GXl)924)~y4DbEp4(*{TTeHxo$= z%Fi0e8MJD}Ii-@=krW=adUS$H5c_cJv!f{m`sbLhm$ayql9F8LG4!P6d$))cw`DE_!A$Jz+ zb`b($VQIz>mj*JLLW(?BnvpfrqF2>A>2PW2n42RvkdsPK9_HnRg%;~-I%tD1=heP?9VcE5hFw!DvDh*Ct*ON+wUm6%|Do}aw@U~V1DYb-DgvC)fX;wVB%E-{b z={hb{YCIU~mr18eu?+QE7^~NjG8AurgN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s_!_I^#sF(XL@|VC?pF`;9AI%oV`Z8zbqW{T#r_P zML*5zWvWC<)vcFvoM_HBU;v+5#=mqQ&s!{${C47UCO6}yK=M|-jAv5 zWns5B0HVgUf(yiup)qa_l%zmNeREH6irij?EQjK^bYJ=7uI^a{lPKz3cGU zEtN|izl`^eLY`yq)@Ve9<|l<$Zhle&H>V7uA`IF%9U}TWGN^w#Ok^L00+SQc?Wg2d TU4=ak)yOgR^b^nbnFQTme=Vu+ diff --git a/GPW_Data/licenzeGPW.cs b/GPW_Data/licenzeGPW.cs index e0c8e25..298e9f0 100644 --- a/GPW_Data/licenzeGPW.cs +++ b/GPW_Data/licenzeGPW.cs @@ -39,6 +39,51 @@ namespace GPW_data #region Private Properties + /// + /// Info applicativo corrente (da cache con eventuale recupero online...) + /// + private static LiManObj.ApplicativoDTO InfoApplicativo + { + get + { + LiManObj.ApplicativoDTO answ = new LiManObj.ApplicativoDTO(); + // cerco da cache + string rawData = memLayer.ML.getRSV(rkeyLicInfo); + // se no ci fosse --> refresh online! + if (string.IsNullOrEmpty(rawData)) + { + var fatto = RefreshAppInfo().Result; + if (fatto) + { + rawData = memLayer.ML.getRSV(rkeyLicInfo); + } + } + if (!string.IsNullOrEmpty(rawData)) + { + try + { + // verifico se ho 1 risultato o molti...se inizia per "[" è molti + if (rawData.StartsWith("[")) + { + // POTREBBE darmi + di 1 risultato, prendo + recente... + List infoList = JsonConvert.DeserializeObject>(rawData); + if (infoList != null) + { + answ = infoList.OrderByDescending(x => x.Scadenza).FirstOrDefault(); + } + } + else + { + answ = JsonConvert.DeserializeObject(rawData); + } + } + catch + { } + } + return answ; + } + } + /// /// Durata cache statica locale dati licenza, random circa 1 h /// @@ -51,6 +96,8 @@ namespace GPW_data } } + private static LiManObj.ApplicativoDTO myInfoApplicativo { get; set; } + #endregion Private Properties #region Public Properties @@ -134,7 +181,7 @@ namespace GPW_data /// private static int _attivazioniOnline() { - return InfoApplicativo().NumLicenzeAttive; + return InfoApplicativo.NumLicenzeAttive; } /// @@ -270,7 +317,7 @@ namespace GPW_data /// private static int _licenzeOnline() { - return InfoApplicativo().NumLicenze; + return InfoApplicativo.NumLicenze; } /// @@ -423,48 +470,6 @@ namespace GPW_data return answ; } - /// - /// Info applicativo corrente (da cache con eventuale recupero online...) - /// - private static LiManObj.ApplicativoDTO InfoApplicativo() - { - LiManObj.ApplicativoDTO answ = new LiManObj.ApplicativoDTO(); - // cerco da cache - string rawData = memLayer.ML.getRSV(rkeyLicInfo); - // se no ci fosse --> refresh online! - if (string.IsNullOrEmpty(rawData)) - { - var fatto = RefreshAppInfo().Result; - if (fatto) - { - rawData = memLayer.ML.getRSV(rkeyLicInfo); - } - } - if (!string.IsNullOrEmpty(rawData)) - { - try - { - // verifico se ho 1 risultato o molti...se inizia per "[" è molti - if (rawData.StartsWith("[")) - { - // POTREBBE darmi + di 1 risultato, prendo + recente... - List infoList = JsonConvert.DeserializeObject>(rawData); - if (infoList != null) - { - answ = infoList.OrderByDescending(x => x.Scadenza).FirstOrDefault(); - } - } - else - { - answ = JsonConvert.DeserializeObject(rawData); - } - } - catch - { } - } - return answ; - } - private static void tryCheckPayloadOnline(ref bool answ, ref string currPayload) { try @@ -478,7 +483,14 @@ namespace GPW_data memLayer.ML.setRSV(rkeyPayload, currPayload, LicCacheTTL); } // confronto payload calc con quello della licenza - answ = InfoApplicativo().Payload == currPayload; + var currInfo = InfoApplicativo; + answ = (InfoApplicativo.Payload == currPayload); + // se fallisce --> resetto payload calcolato + if (!answ) + { + memLayer.ML.setRSV(rkeyAppInfo, "", 1); + memLayer.ML.setRSV(rkeyPayload, "", 1); + } } catch { } diff --git a/GPW_Smart/WebUserControls/mod_enrollByAuthKey.ascx b/GPW_Smart/WebUserControls/mod_enrollByAuthKey.ascx index 02cd403..e1b5251 100644 --- a/GPW_Smart/WebUserControls/mod_enrollByAuthKey.ascx +++ b/GPW_Smart/WebUserControls/mod_enrollByAuthKey.ascx @@ -8,7 +8,7 @@ - + diff --git a/GPW_Smart/WebUserControls/mod_enrollByAuthKey.ascx.designer.cs b/GPW_Smart/WebUserControls/mod_enrollByAuthKey.ascx.designer.cs index ce91b74..72f24e2 100644 --- a/GPW_Smart/WebUserControls/mod_enrollByAuthKey.ascx.designer.cs +++ b/GPW_Smart/WebUserControls/mod_enrollByAuthKey.ascx.designer.cs @@ -1,68 +1,70 @@ //------------------------------------------------------------------------------ -// -// Codice generato da uno strumento. +// +// This code was generated by a tool. // -// Le modifiche a questo file possono causare un comportamento non corretto e verranno perse se -// il codice viene rigenerato. -// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// //------------------------------------------------------------------------------ -namespace GPW.WebUserControls { - - - public partial class mod_enrollByAuthKey { - +namespace GPW.WebUserControls +{ + + + public partial class mod_enrollByAuthKey + { + /// - /// Controllo ddlIdxDipendente. + /// ddlIdxDipendente control. /// /// - /// Campo generato automaticamente. - /// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind. + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.DropDownList ddlIdxDipendente; - + /// - /// Controllo odsDipendenti. + /// odsDipendenti control. /// /// - /// Campo generato automaticamente. - /// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind. + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.ObjectDataSource odsDipendenti; - + /// - /// Controllo txtUserAuthKey. + /// txtUserAuthKey control. /// /// - /// Campo generato automaticamente. - /// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind. + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.TextBox txtUserAuthKey; - + /// - /// Controllo lblWarning. + /// lblWarning control. /// /// - /// Campo generato automaticamente. - /// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind. + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.Label lblWarning; - + /// - /// Controllo btnConferma. + /// btnConferma control. /// /// - /// Campo generato automaticamente. - /// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind. + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.Button btnConferma; - + /// - /// Controllo btnAnnulla. + /// btnAnnulla control. /// /// - /// Campo generato automaticamente. - /// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind. + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.Button btnAnnulla; } diff --git a/GPW_Smart/WebUserControls/mod_resetUserAuthKey.ascx b/GPW_Smart/WebUserControls/mod_resetUserAuthKey.ascx index 02ace44..5c79303 100644 --- a/GPW_Smart/WebUserControls/mod_resetUserAuthKey.ascx +++ b/GPW_Smart/WebUserControls/mod_resetUserAuthKey.ascx @@ -11,7 +11,7 @@ - + diff --git a/GPW_Smart/WebUserControls/mod_resetUserAuthKey.ascx.cs b/GPW_Smart/WebUserControls/mod_resetUserAuthKey.ascx.cs index 84f26c5..7e0de42 100644 --- a/GPW_Smart/WebUserControls/mod_resetUserAuthKey.ascx.cs +++ b/GPW_Smart/WebUserControls/mod_resetUserAuthKey.ascx.cs @@ -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 - } - /// - /// salvo nuovo device... - /// - /// - /// - 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; - } - } /// /// resetto tutto /// @@ -60,5 +25,54 @@ namespace GPW.WebUserControls txtUserAuthKey.Text = ""; lblWarning.Visible = false; } + + /// + /// salvo nuovo device... + /// + /// + /// + 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 } } \ No newline at end of file diff --git a/GPW_Smart/WebUserControls/mod_resetUserAuthKey.ascx.designer.cs b/GPW_Smart/WebUserControls/mod_resetUserAuthKey.ascx.designer.cs index 214c5e7..72ab316 100644 --- a/GPW_Smart/WebUserControls/mod_resetUserAuthKey.ascx.designer.cs +++ b/GPW_Smart/WebUserControls/mod_resetUserAuthKey.ascx.designer.cs @@ -1,95 +1,97 @@ //------------------------------------------------------------------------------ -// -// Codice generato da uno strumento. +// +// This code was generated by a tool. // -// Le modifiche a questo file possono causare un comportamento non corretto e verranno perse se -// il codice viene rigenerato. -// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// //------------------------------------------------------------------------------ -namespace GPW.WebUserControls { - - - public partial class mod_resetUserAuthKey { - +namespace GPW.WebUserControls +{ + + + public partial class mod_resetUserAuthKey + { + /// - /// Controllo ddlIdxDipendente. + /// ddlIdxDipendente control. /// /// - /// Campo generato automaticamente. - /// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind. + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.DropDownList ddlIdxDipendente; - + /// - /// Controllo odsDipendenti. + /// odsDipendenti control. /// /// - /// Campo generato automaticamente. - /// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind. + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.ObjectDataSource odsDipendenti; - + /// - /// Controllo txtUserAuthKey. + /// txtUserAuthKey control. /// /// - /// Campo generato automaticamente. - /// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind. + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.TextBox txtUserAuthKey; - + /// - /// Controllo rfvUserAuthKey. + /// rfvUserAuthKey control. /// /// - /// Campo generato automaticamente. - /// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind. + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.RequiredFieldValidator rfvUserAuthKey; - + /// - /// Controllo txtAuthKey. + /// txtAuthKey control. /// /// - /// Campo generato automaticamente. - /// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind. + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.TextBox txtAuthKey; - + /// - /// Controllo rfvAuthKey. + /// rfvAuthKey control. /// /// - /// Campo generato automaticamente. - /// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind. + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.RequiredFieldValidator rfvAuthKey; - + /// - /// Controllo lblWarning. + /// lblWarning control. /// /// - /// Campo generato automaticamente. - /// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind. + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.Label lblWarning; - + /// - /// Controllo lbtConferma. + /// lbtConferma control. /// /// - /// Campo generato automaticamente. - /// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind. + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.LinkButton lbtConferma; - + /// - /// Controllo lbtAnnulla. + /// lbtAnnulla control. /// /// - /// Campo generato automaticamente. - /// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind. + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.LinkButton lbtAnnulla; } diff --git a/GPW_Smart/WebUserControls/mod_sendAuthToEmail.ascx b/GPW_Smart/WebUserControls/mod_sendAuthToEmail.ascx index 04e7835..1c5e2a2 100644 --- a/GPW_Smart/WebUserControls/mod_sendAuthToEmail.ascx +++ b/GPW_Smart/WebUserControls/mod_sendAuthToEmail.ascx @@ -8,7 +8,7 @@ - + diff --git a/GPW_Smart/WebUserControls/mod_sendAuthToEmail.ascx.designer.cs b/GPW_Smart/WebUserControls/mod_sendAuthToEmail.ascx.designer.cs index 3a36b4a..e439d3c 100644 --- a/GPW_Smart/WebUserControls/mod_sendAuthToEmail.ascx.designer.cs +++ b/GPW_Smart/WebUserControls/mod_sendAuthToEmail.ascx.designer.cs @@ -1,59 +1,61 @@ //------------------------------------------------------------------------------ -// -// Codice generato da uno strumento. +// +// This code was generated by a tool. // -// Le modifiche a questo file possono causare un comportamento non corretto e verranno perse se -// il codice viene rigenerato. -// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// //------------------------------------------------------------------------------ -namespace GPW.WebUserControls { - - - public partial class mod_sendAuthToEmail { - +namespace GPW.WebUserControls +{ + + + public partial class mod_sendAuthToEmail + { + /// - /// Controllo ddlIdxDipendente. + /// ddlIdxDipendente control. /// /// - /// Campo generato automaticamente. - /// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind. + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.DropDownList ddlIdxDipendente; - + /// - /// Controllo odsDipendenti. + /// odsDipendenti control. /// /// - /// Campo generato automaticamente. - /// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind. + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.ObjectDataSource odsDipendenti; - + /// - /// Controllo lblWarning. + /// lblWarning control. /// /// - /// Campo generato automaticamente. - /// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind. + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.Label lblWarning; - + /// - /// Controllo lbtSendEmail. + /// lbtSendEmail control. /// /// - /// Campo generato automaticamente. - /// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind. + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.LinkButton lbtSendEmail; - + /// - /// Controllo lbtAnnulla. + /// lbtAnnulla control. /// /// - /// Campo generato automaticamente. - /// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind. + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.LinkButton lbtAnnulla; }