diff --git a/C2P/C2P.csproj b/C2P/C2P.csproj
index 78f91ad..3920eb2 100644
--- a/C2P/C2P.csproj
+++ b/C2P/C2P.csproj
@@ -290,6 +290,7 @@
+
@@ -522,6 +523,13 @@
JumboPage.master
+
+ jumper.aspx
+ ASPXCodeBehind
+
+
+ jumper.aspx
+
login.aspx
ASPXCodeBehind
diff --git a/C2P/Default.aspx.cs b/C2P/Default.aspx.cs
index 802333b..203f1f0 100644
--- a/C2P/Default.aspx.cs
+++ b/C2P/Default.aspx.cs
@@ -1,4 +1,5 @@
-using System;
+using SteamWare;
+using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
@@ -11,6 +12,9 @@ namespace C2P
{
protected void Page_Load(object sender, EventArgs e)
{
+ // resetto i dati utente all'accesso alla pagina default...
+ devicesAuthProxy.stObj.clearAllUserData();
+ Response.Redirect("UserAdmin");
}
}
}
\ No newline at end of file
diff --git a/C2P/Web.config b/C2P/Web.config
index ac4ebb1..91dda98 100644
--- a/C2P/Web.config
+++ b/C2P/Web.config
@@ -21,9 +21,15 @@
-
-
-
+
+
+
+
+
+
+
+
+
@@ -69,7 +75,7 @@
-
+
diff --git a/C2P/WebUserControls/mod_enrollByAuthKey.ascx.cs b/C2P/WebUserControls/mod_enrollByAuthKey.ascx.cs
index dfb8e5c..f685a92 100644
--- a/C2P/WebUserControls/mod_enrollByAuthKey.ascx.cs
+++ b/C2P/WebUserControls/mod_enrollByAuthKey.ascx.cs
@@ -29,7 +29,7 @@ namespace C2P.WebUserControls
if (email != "" && email.IndexOf("@") > 0)
{
// ora controllo che l'email SIA nell'elenco delle email degli utenti...
- if (devicesAuthProxy.stObj.checkUserEmail(email))
+ if (devicesAuthProxy.stObj.checkUserEmail(email))
{
// controllo se la authKey è corretta x utente...
if (devicesAuthProxy.stObj.checkUserEmailAK(email, authKey))
diff --git a/C2P/WebUserControls/mod_testata.ascx.cs b/C2P/WebUserControls/mod_testata.ascx.cs
index 8d7f3ba..0198e9f 100644
--- a/C2P/WebUserControls/mod_testata.ascx.cs
+++ b/C2P/WebUserControls/mod_testata.ascx.cs
@@ -40,25 +40,181 @@ namespace C2P.WebUserControls
}
}
///
+ /// titolo pagina
+ ///
+ public string titolo
+ {
+ get
+ {
+ return devicesAuthProxy.getPage(Request.Url);
+ }
+ }
+ ///
/// caricamento pagina
///
///
///
protected void Page_Load(object sender, EventArgs e)
{
- // se l'utente NON c'è torno a login...
- if (!user_std.UtSn.isAuth && currPage.IndexOf("login") < 0)
+ if (true)
{
- Session["nextPage"] = currPage;
- Response.Redirect("login");
+ // altri controlli
+ if (!Page.IsPostBack)
+ {
+ Page.Title = Request.Url.ToString();
+ // se ho cambiato pagina registro...)
+ if (devicesAuthProxy.pagPrecedente != titolo)
+ {
+ devicesAuthProxy.pagPrecedente = devicesAuthProxy.pagCorrente;
+ }
+ // salvo apgina corrente
+ devicesAuthProxy.pagCorrente = titolo; // devicesAuthProxy.getCurrPage(Request.Url);
+ }
+ // SOLO se la pagina NON E' "safe"...
+ if (memLayer.ML.confReadString("PageNoIndex").IndexOf(titolo) < 0)
+ {
+ bool userOk = checkUser();
+ bool pageOk = checkPageIsAuth();
+ // controllo se c'è utente in sessione..
+ if ((userOk))
+ {
+ // ora controllo pagina...
+ if (!pageOk)
+ {
+ if (devicesAuthProxy.stObj.isPageEnabled(devicesAuthProxy.pagPrecedente))
+ {
+ Response.Redirect(devicesAuthProxy.pagPrecedente);
+ }
+ else
+ {
+ Response.Redirect("Default");
+ }
+ }
+ }
+ else
+ {
+ // rimando pagina x registrazione devices
+ Response.Redirect("UserAdmin");
+ }
+ }
}
- if (!Page.IsPostBack)
+ else
{
- imgLogo.Visible = logoVisible;
- PagCorrente();
- memLayer.ML.emptySessionVal("searchVal");
+ // se l'utente NON c'è torno a login...
+ if (!user_std.UtSn.isAuth && currPage.IndexOf("login") < 0)
+ {
+ Session["nextPage"] = currPage;
+ Response.Redirect("login");
+ }
+ if (!Page.IsPostBack)
+ {
+ imgLogo.Visible = logoVisible;
+ PagCorrente();
+ memLayer.ML.emptySessionVal("searchVal");
+ }
}
}
+ ///
+ /// verifica che la pagina sia tra quelle autorizzate x l'utente
+ ///
+ ///
+ private bool checkPageIsAuth()
+ {
+ bool allOk = false;
+ bool pageSafe = (memLayer.ML.confReadString("PageNoIndex").IndexOf(titolo) >= 0);
+ bool pageAuth = devicesAuthProxy.stObj.isPageEnabled(titolo);
+ allOk = (pageSafe || pageAuth);
+ return allOk;
+ }
+ ///
+ /// verifica presenza utente autorizzato in sessione
+ ///
+ private bool checkUser()
+ {
+ bool allOk = devicesAuthProxy.stObj.isAuth;
+ if (!devicesAuthProxy.stObj.isAuth)
+ {
+ // controllo cookie device...
+ allOk = checkAuthCookieC2P();
+ if (!allOk)
+ {
+ ResetUser();
+ }
+ }
+ return allOk;
+ }
+ ///
+ /// verifica la presenza di un cookie VALIDO per autorizzare il device ed avvia utente...
+ ///
+ private bool checkAuthCookieC2P()
+ {
+ bool answ = false;
+ try
+ {
+ HttpCookie cookie = Request.Cookies["AuthDevice"];
+ if (!(cookie == null || cookie.Value == ""))
+ {
+ // ricavo utente da cookie...
+ string userAgent = "";
+ string postazione_IP = "";
+ string devSecret = cookie.Value;
+ DS_Auth.AnagDevicesRow device = null;
+ // cerco il device...ogni dipendente può averne + di 1 registrato a suo nome...
+ string email = "";
+ try
+ {
+ device = devicesAuthProxy.stObj.taAnagDev.getByDeviceSecret(devSecret)[0];
+ email = device.USER_NAME;
+ }
+ 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))
+ {
+ // salvo ultimo "contatto" del device aggiornando descrizione ed IP
+ devicesAuthProxy.stObj.taAnagDev.updateIP(device.IdxDevice, DateTime.Now, postazione_IP, userAgent);
+ }
+ // salvo in sessione utente
+ memLayer.ML.setSessionVal("email", email);
+ // avvio utente...
+ devicesAuthProxy.stObj.startUpUtente(email);
+ // salvo gruppo...
+ if (devicesAuthProxy.stObj.isAuth)
+ {
+ // se tutto ok
+ memLayer.ML.setSessionVal("Gruppo", devicesAuthProxy.stObj.rigaUtente.CodGruppo);
+ answ = true;
+ }
+
+ }
+ }
+ }
+ catch (Exception exc)
+ {
+ logger.lg.scriviLog(string.Format("Errore in checkAuthCookie:{0}{1}", Environment.NewLine, exc), tipoLog.EXCEPTION);
+ }
+ return answ;
+ }
+ ///
+ /// resetta utente
+ ///
+ private void ResetUser()
+ {
+ devicesAuthProxy.stObj.clearAllUserData();
+ // svuoto cookie...
+ memLayer.ML.setCookieVal("AuthDevice", "");
+ memLayer.ML.emptyCookieVal("AuthDevice");
+ }
+ ///
+ /// classe grafica da pagina corrente
+ ///
+ ///
+ ///
public string liClass(string nomeElem)
{
string answ = "";
diff --git a/C2P/bin/C2P.dll b/C2P/bin/C2P.dll
index 6e9a857..22d0a94 100644
Binary files a/C2P/bin/C2P.dll and b/C2P/bin/C2P.dll differ
diff --git a/C2P/bin/C2P_Data.dll b/C2P/bin/C2P_Data.dll
index 755f2ad..fdda73e 100644
Binary files a/C2P/bin/C2P_Data.dll and b/C2P/bin/C2P_Data.dll differ
diff --git a/C2P/bin/SteamWare.dll b/C2P/bin/SteamWare.dll
index de0a07c..ac0555f 100644
Binary files a/C2P/bin/SteamWare.dll and b/C2P/bin/SteamWare.dll differ
diff --git a/C2P/jumper.aspx b/C2P/jumper.aspx
new file mode 100644
index 0000000..cd5552e
--- /dev/null
+++ b/C2P/jumper.aspx
@@ -0,0 +1,20 @@
+<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="jumper.aspx.cs" Inherits="C2P.jumper" %>
+
+<%@ Register src="WebUserControls/mod_enrollByJumperAuthKey.ascx" tagname="mod_enrollByJumperAuthKey" tagprefix="uc1" %>
+
+
+
+
+
+
+
+
+
+
+
diff --git a/C2P/jumper.aspx.cs b/C2P/jumper.aspx.cs
new file mode 100644
index 0000000..0bdb2ab
--- /dev/null
+++ b/C2P/jumper.aspx.cs
@@ -0,0 +1,17 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Web;
+using System.Web.UI;
+using System.Web.UI.WebControls;
+
+namespace C2P
+{
+ public partial class jumper : System.Web.UI.Page
+ {
+ protected void Page_Load(object sender, EventArgs e)
+ {
+
+ }
+ }
+}
\ No newline at end of file
diff --git a/C2P/jumper.aspx.designer.cs b/C2P/jumper.aspx.designer.cs
new file mode 100644
index 0000000..badbc40
--- /dev/null
+++ b/C2P/jumper.aspx.designer.cs
@@ -0,0 +1,33 @@
+//------------------------------------------------------------------------------
+//
+// This code was generated by a tool.
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+//
+//------------------------------------------------------------------------------
+
+namespace C2P {
+
+
+ public partial class jumper {
+
+ ///
+ /// form1 control.
+ ///
+ ///
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ ///
+ protected global::System.Web.UI.HtmlControls.HtmlForm form1;
+
+ ///
+ /// mod_enrollByJumperAuthKey1 control.
+ ///
+ ///
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ ///
+ protected global::C2P.WebUserControls.mod_enrollByJumperAuthKey mod_enrollByJumperAuthKey1;
+ }
+}
diff --git a/C2P_Report/bin/C2P_Data.dll b/C2P_Report/bin/C2P_Data.dll
index 755f2ad..fdda73e 100644
Binary files a/C2P_Report/bin/C2P_Data.dll and b/C2P_Report/bin/C2P_Data.dll differ
diff --git a/C2P_Report/bin/C2P_Report.dll b/C2P_Report/bin/C2P_Report.dll
index 2c52f93..37629c7 100644
Binary files a/C2P_Report/bin/C2P_Report.dll and b/C2P_Report/bin/C2P_Report.dll differ
diff --git a/C2P_Report/bin/SteamWare.dll b/C2P_Report/bin/SteamWare.dll
index de0a07c..ac0555f 100644
Binary files a/C2P_Report/bin/SteamWare.dll and b/C2P_Report/bin/SteamWare.dll differ