diff --git a/GPW.CORE.Api/Controllers/ProjCheckController.cs b/GPW.CORE.Api/Controllers/ProjCheckController.cs index 1264cad..74564eb 100644 --- a/GPW.CORE.Api/Controllers/ProjCheckController.cs +++ b/GPW.CORE.Api/Controllers/ProjCheckController.cs @@ -110,7 +110,14 @@ namespace GPW.CORE.Api.Controllers List emailDestList = emailRaw.Split(",").ToList(); foreach (var dest in emailDestList) { - await _emailSender.SendEmailAsync(dest, subject, message); + try + { + await _emailSender.SendEmailAsync(dest, subject, message); + } + catch (Exception exc) + { + Log.Error($"Eccezione durante invio email:{Environment.NewLine}dest: {dest} | subject {subject}{Environment.NewLine}{exc}"); + } } } diff --git a/GPW.CORE.Api/appsettings.json b/GPW.CORE.Api/appsettings.json index cb01c96..e490544 100644 --- a/GPW.CORE.Api/appsettings.json +++ b/GPW.CORE.Api/appsettings.json @@ -13,11 +13,11 @@ "ExternalProviders": { "MailKit": { "SMTP": { - "Address": "smtp.gmail.com", - "Port": "465", - "Account": "steamwarebot@gmail.com", - "Password": "drmfsls16", - "SenderEmail": "steamwarebot@gmail.com", + "Address": "smtp-mail.outlook.com", + "Port": "587", + "Account": "steamwarebot@outlook.it", + "Password": "siamoInViaNazionale93", + "SenderEmail": "steamwarebot@outlook.it", "SenderName": "Steamware Email BOT" } } diff --git a/GPW.CORE.Data/DataValidator.cs b/GPW.CORE.Data/DataValidator.cs new file mode 100644 index 0000000..6f03fad --- /dev/null +++ b/GPW.CORE.Data/DataValidator.cs @@ -0,0 +1,72 @@ +using GPW.CORE.Data.DbModels; +using System.Security.Cryptography; +using System.Text; + +namespace GPW.CORE.Data +{ + /// + /// Classe validazione valori + /// + public class DataValidator + { + #region Public Constructors + + public DataValidator(DipendentiModel? currRigaDip) + { + rigaDip = currRigaDip; + } + + #endregion Public Constructors + + #region Public Properties + + /// + /// Restituisce HASH del codice impiego = payload utente + /// + /// + public string HashDip + { + get => calcHashDip; + } + + #endregion Public Properties + + #region Private Fields + + private DipendentiModel? rigaDip = null; + + #endregion Private Fields + + #region Private Properties + + /// + /// Calcola HASH del codice impiego = payload utente + /// + /// + private string calcHashDip + { + get + { + string hash = ""; + string buffData = ""; + if (rigaDip != null) + { + buffData = $"{rigaDip.IdxDipendente}|{rigaDip.Cognome}.{rigaDip.Nome}|{rigaDip.Cf}|{rigaDip.DataAssunzione:yyyyMMdd}|{rigaDip.Email}|{rigaDip.Matricola}"; + } + if (!string.IsNullOrEmpty(buffData)) + { + // hashing! + using (var md5 = MD5.Create()) + { + byte[] InputBytes = Encoding.UTF8.GetBytes(buffData); + var byteHash = md5.ComputeHash(InputBytes); + hash = BitConverter.ToString(byteHash).Replace("-", "").ToLowerInvariant(); + } + } + return hash; + } + } + + #endregion Private Properties + } +} \ No newline at end of file diff --git a/GPW.CORE.WRKLOG/Data/MessageService.cs b/GPW.CORE.WRKLOG/Data/MessageService.cs index 6f43cde..adaf7ca 100644 --- a/GPW.CORE.WRKLOG/Data/MessageService.cs +++ b/GPW.CORE.WRKLOG/Data/MessageService.cs @@ -1,4 +1,5 @@ -using GPW.CORE.Data.DbModels; +using GPW.CORE.Data; +using GPW.CORE.Data.DbModels; using System.Security.Cryptography; using System.Text; @@ -48,19 +49,8 @@ namespace GPW.CORE.WRKLOG.Data { get { - string hash = ""; - string answ = ""; - if (_rigaDip != null) - { - answ = $"{_rigaDip.IdxDipendente}|{_rigaDip.Cognome}.{_rigaDip.Nome}|{_rigaDip.Cf}|{_rigaDip.DataAssunzione:yyyyMMdd}|{_rigaDip.Email}|{_rigaDip.Matricola}"; - } - // hashing! - using (var md5 = MD5.Create()) - { - byte[] InputBytes = Encoding.UTF8.GetBytes(answ); - var byteHash = md5.ComputeHash(InputBytes); - hash = BitConverter.ToString(byteHash).Replace("-", "").ToLowerInvariant(); - } + DataValidator cDV = new DataValidator(_rigaDip); + string hash = cDV.HashDip; return hash; } } diff --git a/GPW.CORE.WRKLOG/GPW.CORE.WRKLOG.csproj b/GPW.CORE.WRKLOG/GPW.CORE.WRKLOG.csproj index c44aef1..4062279 100644 --- a/GPW.CORE.WRKLOG/GPW.CORE.WRKLOG.csproj +++ b/GPW.CORE.WRKLOG/GPW.CORE.WRKLOG.csproj @@ -2,7 +2,7 @@ net6.0 - 3.0.2206.0617 + 3.0.2206.0720 enable enable diff --git a/Resources/ChangeLog.html b/Resources/ChangeLog.html index 11da474..07aa8d5 100644 --- a/Resources/ChangeLog.html +++ b/Resources/ChangeLog.html @@ -1,6 +1,6 @@ GPW - Gestione Presenze Web -

Versione: 3.0.2206.0617

+

Versione: 3.0.2206.0720


Note di rilascio: