FIx visualizzazione utente...

This commit is contained in:
Samuele E. Locatelli
2015-10-29 16:57:36 +01:00
parent 836c9b3e6a
commit 84c1e17898
15 changed files with 119 additions and 34 deletions
+3 -2
View File
@@ -43,14 +43,15 @@ namespace CMS_SC_Data
/// Fornisce un oggetto OpAuth popolato da email calcolando il resto + lettura default da web.config
/// </summary>
/// <param name="email"></param>
/// <param name="CognomeNome"></param>
/// <returns></returns>
public static OpAuth startOpAuth(string email)
public static OpAuth startOpAuth(string email, string CognomeNome)
{
OpAuth answ = new OpAuth();
if (email != "")
{
answ.email = email;
answ.CognomeNome = "Test - completare"; // utils.obj.getOperatoreByCod(email);
answ.CognomeNome = CognomeNome;
}
currAuth = answ;
return answ;
Binary file not shown.
Binary file not shown.
+8 -1
View File
@@ -1430,12 +1430,19 @@
</member>
<member name="M:SteamWare.devicesAuthProxy.numAuth(System.String,System.String)">
<summary>
Restitusice il numero di attivazioni rimaste x utente dato email e key
Restituisce il numero di attivazioni rimaste x utente dato email e key
</summary>
<param name="UserAuthKey"></param>
<param name="email"></param>
<returns></returns>
</member>
<member name="M:SteamWare.devicesAuthProxy.numAuth(System.String)">
<summary>
Restituisce il numero di attivazioni rimaste x utente dato email
</summary>
<param name="email"></param>
<returns></returns>
</member>
<member name="M:SteamWare.devicesAuthProxy.clearAllUserData">
<summary>
cancella da session l'utente
Binary file not shown.
+17 -11
View File
@@ -111,12 +111,15 @@ namespace CMS_SC
get
{
int answ = -1;
try
if (ddlDossier.SelectedValue != "")
{
answ = Convert.ToInt32(ddlDossier.SelectedValue);
try
{
answ = Convert.ToInt32(ddlDossier.SelectedValue);
}
catch
{ }
}
catch
{ }
return answ;
}
}
@@ -253,14 +256,17 @@ namespace CMS_SC
get
{
bool answ = false;
try
if (ddlDossier.SelectedValue != "")
{
int idxDossier = Convert.ToInt32(ddlDossier.SelectedValue);
answ = DtProxy.man.taMis.getNum2Ins(idxDossier, ddlSelScheda.SelectedValue, ddlFase.SelectedValue).Rows.Count > 0;
}
catch (Exception exc)
{
logger.lg.scriviLog(string.Format("{0}", exc));
try
{
int idxDossier = Convert.ToInt32(ddlDossier.SelectedValue);
answ = DtProxy.man.taMis.getNum2Ins(idxDossier, ddlSelScheda.SelectedValue, ddlFase.SelectedValue).Rows.Count > 0;
}
catch (Exception exc)
{
logger.lg.scriviLog(string.Format("{0}", exc));
}
}
return answ;
}
+1 -1
View File
@@ -42,7 +42,7 @@
<add key="PageNoIndex" value="UserAdmin#Test" />
<!--gestione auth collaudatori "username-only"-->
<add key="enableOpAuth" value="true" />
<add key="authUserBaseTimeout" value="60" />
<add key="defMinScadUserBase" value="60" />
<add key="defRemAuth" value="9999" />
<add key="defMinScad" value="60" />
@@ -17,32 +17,27 @@ namespace CMS_SC.WebUserControls
/// <param name="e"></param>
protected void btnEnrollByAK_Click(object sender, EventArgs e)
{
// leggo cognome / nome x controllare email cms nome.cognome@cms.it ...
string cognome = txtCognome.Text.Trim().ToLower();
string nome = txtNome.Text.Trim().ToLower();
string email = string.Format("{0}.{1}@cms.it", nome, cognome);
if (email != "")
{
// ora controllo che l'email SIA nell'elenco delle email degli utenti...
if (devicesAuthProxy.stObj.checkUserEmail(email))
{
#if false
// controllo se l'utente è "base" e quindi posso fare auth "semplificata"...
if (devicesAuthProxy.stObj.checkUserEmailAK(email, authKey))
// controllo se l'utente è "base" --> NumAuth = 0 e quindi posso fare auth "semplificata"...
if (devicesAuthProxy.stObj.numAuth(email)==0)
{
// rimando al jumper...
Response.Redirect(string.Format("jumper?UserAuthkey={0}&USER_NAME={1}", authKey, email));
// salvo i dati MINIMI per auth utente (in sessione) SENZA cookie...
setupUserBase();
Response.Redirect("Collaudi");
}
else
{
lblOutMsg.Text = traduci("ErrorEAK01");// "Attenzione! auth key NON valida, prego contattare amministratore!";
lblOutMsg.Text = traduci("ErrorEAK04");// "Attenzione: profilo utente non corretto per accesso Collaudatore";
lblOutMsg.Visible = true;
}
#endif
}
else
{
lblOutMsg.Text = traduci("ErrorEAK02");//"Attenzione! email non trovata, prego contattare amministratore!";
lblOutMsg.Text = traduci("ErrorEAK05");// "Attenzione! email non trovata, prego contattare amministratore!";
lblOutMsg.Visible = true;
}
}
@@ -52,5 +47,38 @@ namespace CMS_SC.WebUserControls
lblOutMsg.Visible = true;
}
}
/// <summary>
/// email da cognome/nome inseriti
/// </summary>
protected string email
{
get
{
string answ = "";
// leggo cognome / nome x controllare email cms nome.cognome@cms.it ...
string cognome = txtCognome.Text.Trim().ToLower();
string nome = txtNome.Text.Trim().ToLower();
if (cognome != "" && nome != "")
{
try
{
answ = string.Format("{0}.{1}@cms.it", nome, cognome);
}
catch
{ }
}
return answ;
}
}
/// <summary>
/// setup cookie e dati vari x utente base (solo collaudo)
/// </summary>
private void setupUserBase()
{
// crea un valore cookie usando cookieStdSalt
string cookieVal = devicesAuthProxy.encodeKey(email);
// salvo il cookie nel browser x 2 anni
memLayer.ML.setCookieVal(devicesAuthProxy.AuthCookieName, cookieVal, DateTime.Now.AddMinutes(memLayer.ML.CRI("defMinScadUserBase")));
}
}
}
+1 -1
View File
@@ -78,7 +78,7 @@
<li id="liUpdateVoc"><a href="UpdateVoc"><%: traduci("UpdateVoc") %></a></li>
</ul>
</li>
<li>
<li class="bg-info">
<asp:HyperLink runat="server" ID="hlUser" ToolTip='<%# usrAuthToolTip %>'>
<i class="fa fa-user fa-lg <%: usrAuthCss %>"></i>
<span><asp:Label runat="server" ID="lblMatr" Text='<%# usrAuthText %>' /></span>
+40 -4
View File
@@ -73,6 +73,8 @@ namespace CMS_SC.WebUserControls
imgLogo.Visible = logoVisible;
//PagCorrente(); // tolto 2015.02.24
memLayer.ML.emptySessionVal("searchVal");
// fix componenti
hlUser.DataBind();
}
// SOLO se la pagina NON E' "safe"...
if (memLayer.ML.confReadString("PageNoIndex").IndexOf(titolo) < 0)
@@ -169,21 +171,55 @@ namespace CMS_SC.WebUserControls
{
logger.lg.scriviLog(string.Format("{0}", exc), tipoLog.EXCEPTION);
}
// cerco se si tratti PER CASO di un cookie di auth "base" per utenti base...
if (email == "")
{
try
{
email = devicesAuthProxy.decodeKey(cookie.Value);
// cerco SE email sia valida...
if (devicesAuthProxy.stObj.checkUserEmail(email))
{
// se l'utente è "base" procedo...
if (devicesAuthProxy.stObj.numAuth(email) != 0)
{
email = "";
}
}
else
{
email = "";
}
}
catch
{ }
}
if (email != "")
{
// aggiorno descrizione (user agent) ed IP...
userAgent = Request.UserAgent;
postazione_IP = Request.UserHostAddress;
// controllo IP e DeviceDescription x eventuale update
if ((device.lastIPv4 != postazione_IP) || (device.Description != userAgent))
if (device != null)
{
// salvo ultimo "contatto" del device aggiornando descrizione ed IP
devicesAuthProxy.stObj.taAnagDev.updateIP(device.IdxDevice, DateTime.Now, postazione_IP, userAgent);
if (((device.lastIPv4 != postazione_IP) || (device.Description != userAgent)))
{
try
{
// salvo ultimo "contatto" del device aggiornando descrizione ed IP
devicesAuthProxy.stObj.taAnagDev.updateIP(device.IdxDevice, DateTime.Now, postazione_IP, userAgent);
}
catch
{ }
}
}
// salvo in sessione utente
memLayer.ML.setSessionVal("email", email);
// avvio utente...
devicesAuthProxy.stObj.startUpUtente(email);
// salvo dati di AUTH OP (x visualizzazione in testata...)
OpAuth.startOpAuth(email, devicesAuthProxy.stObj.CognomeNome);
// salvo gruppo...
if (devicesAuthProxy.stObj.isAuth)
{
@@ -315,7 +351,7 @@ namespace CMS_SC.WebUserControls
{
get
{
return OpAuth.isAuth;
return OpAuth.isAuth || devicesAuthProxy.stObj.isAuth;
}
}
/// <summary>
Binary file not shown.
Binary file not shown.
+1 -1
View File
@@ -42,7 +42,7 @@
<add key="PageNoIndex" value="UserAdmin#Test" />
<!--gestione auth collaudatori "username-only"-->
<add key="enableOpAuth" value="true" />
<add key="authUserBaseTimeout" value="60" />
<add key="defMinScadUserBase" value="60" />
<add key="defRemAuth" value="9999" />
<add key="defMinScad" value="60" />
Binary file not shown.
+8 -1
View File
@@ -1430,12 +1430,19 @@
</member>
<member name="M:SteamWare.devicesAuthProxy.numAuth(System.String,System.String)">
<summary>
Restitusice il numero di attivazioni rimaste x utente dato email e key
Restituisce il numero di attivazioni rimaste x utente dato email e key
</summary>
<param name="UserAuthKey"></param>
<param name="email"></param>
<returns></returns>
</member>
<member name="M:SteamWare.devicesAuthProxy.numAuth(System.String)">
<summary>
Restituisce il numero di attivazioni rimaste x utente dato email
</summary>
<param name="email"></param>
<returns></returns>
</member>
<member name="M:SteamWare.devicesAuthProxy.clearAllUserData">
<summary>
cancella da session l'utente