Update sito admodelling
This commit is contained in:
@@ -10,11 +10,11 @@ body {
|
||||
padding-right: 15px;
|
||||
}
|
||||
/* Set widths on the form inputs since otherwise they're 100% wide */
|
||||
/*input,
|
||||
input,
|
||||
select,
|
||||
textarea {
|
||||
max-width: 280px;
|
||||
}*/
|
||||
}
|
||||
/* Responsive: Portrait tablets and up */
|
||||
@media screen and (min-width: 768px) {
|
||||
.jumbotron {
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="JobsList.aspx.cs" Inherits="WebLCP.JobsList" %>
|
||||
<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">
|
||||
</asp:Content>
|
||||
@@ -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 WebLCP
|
||||
{
|
||||
public partial class JobsList : System.Web.UI.Page
|
||||
{
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// Codice generato da uno strumento.
|
||||
//
|
||||
// Le modifiche a questo file possono causare un comportamento non corretto e verranno perse se
|
||||
// il codice viene rigenerato.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace WebLCP
|
||||
{
|
||||
|
||||
|
||||
public partial class JobsList
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using SteamWare;
|
||||
using System;
|
||||
using System.Configuration;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
|
||||
namespace WebLCP.WUC
|
||||
{
|
||||
@@ -39,8 +35,7 @@ namespace WebLCP.WUC
|
||||
private void setClock()
|
||||
{
|
||||
lblDateTime.Text = DateTime.Now.ToString("ddd dd.MM.yyyy, HH:mm:ss");
|
||||
string userEmail = "test@user.it";
|
||||
lblCurrUser.Text = $"Current user: {userEmail}"; //$"{AppData.DataLayer.man.CodSoggCurrUser} - {AppData.DataLayer.man.CognNomeCurrUser}";
|
||||
lblCurrUser.Text = $"{devicesAuthProxy.stObj.utente} - {devicesAuthProxy.stObj.CognomeNome}";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -12,6 +12,9 @@
|
||||
<li runat="server" class='<%# checkPage("Default") + " nav-item" %>'>
|
||||
<a class="nav-link" href="Default"><i class="fa fa-home" aria-hidden="true"></i> Home</a>
|
||||
</li>
|
||||
<li runat="server" class='<%# checkPage("JobsList") + " nav-item border border-success" %>' visible='<%# userIsAuth %>'>
|
||||
<a class="nav-link" href="JobsList"><i class="fa fa-list" aria-hidden="true"></i> Elenco Jobs processati</a>
|
||||
</li>
|
||||
<li runat="server" class='<%# checkPage("About") + " nav-item" %>'>
|
||||
<a class="nav-link" href="About"><i class="fa fa-info" aria-hidden="true"></i> Informazioni</a>
|
||||
</li>
|
||||
@@ -19,9 +22,14 @@
|
||||
<a class="nav-link" href="Contact"><i class="fa fa-users" aria-hidden="true"></i> Contatti</a>
|
||||
</li>
|
||||
</ul>
|
||||
<div runat="server" id="divSearch" class="form-inline my-2 my-lg-0">
|
||||
<div runat="server" class="form-inline my-2 my-lg-0">
|
||||
<asp:HyperLink runat="server" ID="hlReset" NavigateUrl="~/reset" CssClass="btn btn-danger text-nowrap" OnClick="return confirm('LOG-OUT utente: sicuro di voler procedere?');" visible='<%# userIsAuth %>'><i class="fa fa-sign-out" ></i> EXIT</asp:HyperLink>
|
||||
<asp:HyperLink runat="server" ID="hlLogin" NavigateUrl="~/RegisterUser" CssClass="btn btn-success text-nowrap" visible='<%# !userIsAuth %>'><i class="fa fa-sign-in" ></i> LOGIN</asp:HyperLink>
|
||||
<div runat="server" id="divSearch">
|
||||
<asp:TextBox runat="server" ID="txtSearch" class="form-control mr-sm-2" type="search" placeholder="Search" aria-label="Search" OnTextChanged="txtSearch_TextChanged" />
|
||||
<asp:LinkButton runat="server" ID="lbtSearch" class="btn btn-secondary my-2 my-sm-0" type="submit" OnClick="lbtSearch_Click">Search <i class="fa fa-search" aria-hidden="true"></i></asp:LinkButton>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</nav>
|
||||
@@ -15,6 +15,54 @@ namespace WebLCP.WUC
|
||||
showSearch = false;
|
||||
searchVal = "";
|
||||
ulLinks.DataBind();
|
||||
hlReset.DataBind();
|
||||
hlLogin.DataBind();
|
||||
checkAuth();
|
||||
}
|
||||
}
|
||||
|
||||
private void checkAuth()
|
||||
{
|
||||
string lastPage = Request.Url.LocalPath.Split('/').Last();
|
||||
// se l'utente NON c'è torno a login...
|
||||
if (!devicesAuthProxy.stObj.isAuth)
|
||||
{
|
||||
if (lastPage != "" && lastPage != "login")
|
||||
{
|
||||
Session["nextPage"] = lastPage;
|
||||
}
|
||||
// SE non sono in "safe page"
|
||||
if (memLayer.ML.CRS("_loginPages").ToLower().IndexOf(lastPage.ToLower()) < 0)
|
||||
{
|
||||
Response.Redirect("~/login");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
PagCorrente();
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Indica se user sia autorizzato
|
||||
/// </summary>
|
||||
public bool userIsAuth
|
||||
{
|
||||
get
|
||||
{
|
||||
return devicesAuthProxy.stObj.isAuth;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// salva in variabile pagina il nome della pagina corrente
|
||||
/// </summary>
|
||||
protected void PagCorrente()
|
||||
{
|
||||
string[] uri = Request.Url.LocalPath.Split('/');
|
||||
// salvo pagina corrente
|
||||
devicesAuthProxy.pagCorrente = uri.Last();
|
||||
if (devicesAuthProxy.pagPrecedente == "")
|
||||
{
|
||||
devicesAuthProxy.pagPrecedente = devicesAuthProxy.pagCorrente;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
|
||||
+18
@@ -21,6 +21,24 @@ namespace WebLCP.WUC {
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.HtmlControls.HtmlGenericControl ulLinks;
|
||||
|
||||
/// <summary>
|
||||
/// Controllo hlReset.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Campo generato automaticamente.
|
||||
/// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.HyperLink hlReset;
|
||||
|
||||
/// <summary>
|
||||
/// Controllo hlLogin.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Campo generato automaticamente.
|
||||
/// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.HyperLink hlLogin;
|
||||
|
||||
/// <summary>
|
||||
/// Controllo divSearch.
|
||||
/// </summary>
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="mod_enrollByJumperAuthKey.ascx.cs" Inherits="WebLCP.WUC.mod_enrollByJumperAuthKey" %>
|
||||
<%--è una procedura automatica, niente elementi grafici!--%>
|
||||
@@ -0,0 +1,65 @@
|
||||
using SteamWare;
|
||||
using System;
|
||||
|
||||
namespace WebLCP.WUC
|
||||
{
|
||||
public partial class mod_enrollByJumperAuthKey : System.Web.UI.UserControl
|
||||
{
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
// procedo alla ricerca di dati via sessione x User AuthKey
|
||||
tryAutoEnroll();
|
||||
}
|
||||
/// <summary>
|
||||
/// prova a fare auto enroll
|
||||
/// </summary>
|
||||
public void tryAutoEnroll()
|
||||
{
|
||||
logger.lg.scriviLog("Inizio tryAutoEnroll", tipoLog.STARTUP);
|
||||
// recupero dati da session
|
||||
string UserAuthKey = "";
|
||||
string email = "";
|
||||
string userAgent = "";
|
||||
bool fatto = false;
|
||||
string DeviceName = "";
|
||||
string IPv4 = "";
|
||||
string CodOpr = "";
|
||||
try
|
||||
{
|
||||
UserAuthKey = Request["UserAuthkey"];
|
||||
email = Request["USER_NAME"];
|
||||
userAgent = Request.UserAgent;
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
// se ci sono i dati effettua tentativo di AutoEnroll del device
|
||||
if (email != "" && UserAuthKey != "")
|
||||
{
|
||||
IPv4 = Request.UserHostAddress;
|
||||
//DeviceName = SteamWare.dnsUtils.ReverseLookup(IPv4);
|
||||
//DeviceName = SteamWare.dnsUtils.DetermineCompName(IPv4); // WIN2012R2SAM
|
||||
DeviceName = Request.Browser.Platform; // ::1
|
||||
|
||||
// prova ad usare la chiave DECODIFICATA x autorizzare device
|
||||
fatto = devicesAuthProxy.stObj.enrollDevice(devicesAuthProxy.decodeKey(UserAuthKey), IPv4, DeviceName, userAgent, email);
|
||||
// se NON ce l'ha fatta ed è abilitata l'autenticazione "plain" cerca di eseguire anche quella...
|
||||
if (memLayer.ML.confReadBool("enablePlain") && !fatto)
|
||||
{
|
||||
fatto = devicesAuthProxy.stObj.enrollDevice(UserAuthKey, IPv4, DeviceName, userAgent, email);
|
||||
}
|
||||
if (fatto)
|
||||
{
|
||||
logger.lg.scriviLog("Completato tryAutoEnroll con SUCCESSO, rimando a Login", tipoLog.STARTUP);
|
||||
Response.Redirect("Login");
|
||||
}
|
||||
else
|
||||
{
|
||||
logger.lg.scriviLog("Completato tryAutoEnroll senza riconoscimento valori link, rimando a UserAdmin", tipoLog.STARTUP);
|
||||
Response.Redirect("UserAdmin");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <generato automaticamente>
|
||||
// Codice generato da uno strumento.
|
||||
//
|
||||
// Le modifiche a questo file possono causare un comportamento non corretto e verranno perse se
|
||||
// il codice viene rigenerato.
|
||||
// </generato automaticamente>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace WebLCP.WUC {
|
||||
|
||||
|
||||
public partial class mod_enrollByJumperAuthKey {
|
||||
}
|
||||
}
|
||||
@@ -21,6 +21,8 @@
|
||||
<add key="intUpdatePagina_ms" value="120000" />
|
||||
<add key="appName" value="WLP" />
|
||||
<add key="copyRight" value="Steamware " />
|
||||
<add key="_safePages" value="chLang#jumper#unauthorized#forceUser#login#default#test#UserAdmin#UpdMan#about#contact" />
|
||||
<add key="_loginPages" value="jumper#forceUser#login#UserAdmin#default#registerUser#about#contact" />
|
||||
<!--area logger-->
|
||||
<add key="_logDir" value="~/logs/" />
|
||||
<add key="enableDumpDiag" value="false" />
|
||||
|
||||
@@ -181,8 +181,12 @@
|
||||
<Content Include="fonts\fontawesome-webfont.svg" />
|
||||
<Content Include="Global.asax" />
|
||||
<Content Include="Images\WIP.png" />
|
||||
<Content Include="JobsList.aspx" />
|
||||
<Content Include="jumper.aspx" />
|
||||
<Content Include="login.aspx" />
|
||||
<Content Include="README.txt" />
|
||||
<Content Include="RegisterUser.aspx" />
|
||||
<Content Include="reset.aspx" />
|
||||
<Content Include="Scripts\bootstrap.bundle.js" />
|
||||
<Content Include="Scripts\bootstrap.bundle.min.js" />
|
||||
<Content Include="Scripts\bootstrap.js" />
|
||||
@@ -266,6 +270,7 @@
|
||||
<Content Include="WUC\mod_about.ascx" />
|
||||
<Content Include="WUC\mod_condizioniServizio.ascx" />
|
||||
<Content Include="WUC\mod_contacts.ascx" />
|
||||
<Content Include="WUC\mod_enrollByJumperAuthKey.ascx" />
|
||||
<Content Include="WUC\mod_home.ascx" />
|
||||
<Content Include="WUC\mod_register.ascx" />
|
||||
<Content Include="WUC\mod_sendToken.ascx" />
|
||||
@@ -318,6 +323,27 @@
|
||||
<Compile Include="Global.asax.cs">
|
||||
<DependentUpon>Global.asax</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="JobsList.aspx.cs">
|
||||
<DependentUpon>JobsList.aspx</DependentUpon>
|
||||
<SubType>ASPXCodeBehind</SubType>
|
||||
</Compile>
|
||||
<Compile Include="JobsList.aspx.designer.cs">
|
||||
<DependentUpon>JobsList.aspx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="jumper.aspx.cs">
|
||||
<DependentUpon>jumper.aspx</DependentUpon>
|
||||
<SubType>ASPXCodeBehind</SubType>
|
||||
</Compile>
|
||||
<Compile Include="jumper.aspx.designer.cs">
|
||||
<DependentUpon>jumper.aspx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="login.aspx.cs">
|
||||
<DependentUpon>login.aspx</DependentUpon>
|
||||
<SubType>ASPXCodeBehind</SubType>
|
||||
</Compile>
|
||||
<Compile Include="login.aspx.designer.cs">
|
||||
<DependentUpon>login.aspx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="RegisterUser.aspx.cs">
|
||||
<DependentUpon>RegisterUser.aspx</DependentUpon>
|
||||
@@ -326,6 +352,13 @@
|
||||
<Compile Include="RegisterUser.aspx.designer.cs">
|
||||
<DependentUpon>RegisterUser.aspx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="reset.aspx.cs">
|
||||
<DependentUpon>reset.aspx</DependentUpon>
|
||||
<SubType>ASPXCodeBehind</SubType>
|
||||
</Compile>
|
||||
<Compile Include="reset.aspx.designer.cs">
|
||||
<DependentUpon>reset.aspx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Site.Master.cs">
|
||||
<DependentUpon>Site.Master</DependentUpon>
|
||||
<SubType>ASPXCodeBehind</SubType>
|
||||
@@ -368,6 +401,13 @@
|
||||
<Compile Include="WUC\mod_contacts.ascx.designer.cs">
|
||||
<DependentUpon>mod_contacts.ascx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="WUC\mod_enrollByJumperAuthKey.ascx.cs">
|
||||
<DependentUpon>mod_enrollByJumperAuthKey.ascx</DependentUpon>
|
||||
<SubType>ASPXCodeBehind</SubType>
|
||||
</Compile>
|
||||
<Compile Include="WUC\mod_enrollByJumperAuthKey.ascx.designer.cs">
|
||||
<DependentUpon>mod_enrollByJumperAuthKey.ascx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="WUC\mod_home.ascx.cs">
|
||||
<DependentUpon>mod_home.ascx</DependentUpon>
|
||||
<SubType>ASPXCodeBehind</SubType>
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="jumper.aspx.cs" Inherits="WebLCP.jumper" %>
|
||||
|
||||
<%@ Register Src="~/WUC/mod_enrollByJumperAuthKey.ascx" TagPrefix="uc1" TagName="mod_enrollByJumperAuthKey" %>
|
||||
|
||||
|
||||
<!DOCTYPE html>
|
||||
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head runat="server">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
|
||||
<title></title>
|
||||
</head>
|
||||
<body>
|
||||
<form id="form1" runat="server">
|
||||
<div>
|
||||
<uc1:mod_enrollByJumperAuthKey runat="server" id="mod_enrollByJumperAuthKey" />
|
||||
</div>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
||||
@@ -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 WebLCP
|
||||
{
|
||||
public partial class jumper : System.Web.UI.Page
|
||||
{
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
Generated
+33
@@ -0,0 +1,33 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <generato automaticamente>
|
||||
// Codice generato da uno strumento.
|
||||
//
|
||||
// Le modifiche a questo file possono causare un comportamento non corretto e verranno perse se
|
||||
// il codice viene rigenerato.
|
||||
// </generato automaticamente>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace WebLCP {
|
||||
|
||||
|
||||
public partial class jumper {
|
||||
|
||||
/// <summary>
|
||||
/// Controllo form1.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Campo generato automaticamente.
|
||||
/// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.HtmlControls.HtmlForm form1;
|
||||
|
||||
/// <summary>
|
||||
/// Controllo mod_enrollByJumperAuthKey.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Campo generato automaticamente.
|
||||
/// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
|
||||
/// </remarks>
|
||||
protected global::WebLCP.WUC.mod_enrollByJumperAuthKey mod_enrollByJumperAuthKey;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="login.aspx.cs" Inherits="WebLCP.login" %>
|
||||
|
||||
<!DOCTYPE html>
|
||||
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head runat="server">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
|
||||
<title></title>
|
||||
</head>
|
||||
<body>
|
||||
<form id="form1" runat="server">
|
||||
<div>
|
||||
</div>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,199 @@
|
||||
using SteamWare;
|
||||
using System;
|
||||
using System.Web;
|
||||
using System.Web.UI;
|
||||
|
||||
namespace WebLCP
|
||||
{
|
||||
public partial class login : UserPage
|
||||
{
|
||||
protected string _nextPage
|
||||
{
|
||||
get
|
||||
{
|
||||
string pagina = SteamWare.memLayer.ML.StringSessionObj("nextPage");
|
||||
if (pagina == "")
|
||||
{
|
||||
pagina = "default.aspx";
|
||||
}
|
||||
return pagina;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Elenco pagine "safe" da web.config
|
||||
/// </summary>
|
||||
protected string safePages
|
||||
{
|
||||
get
|
||||
{
|
||||
return memLayer.ML.confReadString("_safePages").ToLower();
|
||||
}
|
||||
}
|
||||
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
logger.lg.scriviLog("Starting login...");
|
||||
if (!Page.IsPostBack)
|
||||
{
|
||||
Page.Title = titolo;// Request.Url.ToString();
|
||||
// se ho cambiato pagina registro...)
|
||||
if (devicesAuthProxy.pagPrecedente.ToLower() != titolo.ToLower())
|
||||
{
|
||||
devicesAuthProxy.pagPrecedente = devicesAuthProxy.pagCorrente;
|
||||
}
|
||||
// salvo pagina corrente
|
||||
devicesAuthProxy.pagCorrente = titolo;
|
||||
}
|
||||
// SOLO se la pagina NON E' "safe"... e NON E' login
|
||||
if (safePages.IndexOf(titolo.ToLower()) < 0 || titolo.ToLower() == "login")
|
||||
{
|
||||
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("JobsList");
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// rimando pagina x registrazione devices
|
||||
Response.Redirect("Default");
|
||||
}
|
||||
}
|
||||
if (devicesAuthProxy.stObj.isAuth)
|
||||
{
|
||||
logger.lg.scriviLog(string.Format("Login completed for user {0}", devicesAuthProxy.stObj.email));
|
||||
Response.Redirect("JobsList");
|
||||
}
|
||||
else
|
||||
{
|
||||
string usrHostAddr = Request.UserHostAddress;
|
||||
string usrAgent = Request.UserAgent;
|
||||
string usrHostName = Request.UserHostName;
|
||||
logger.lg.scriviLog(string.Format("Login NOT completed for request by host: {0} | hostname: {1} | agent: {2}", usrHostAddr, usrHostName, usrAgent));
|
||||
Response.Redirect("Default");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// verifica che la pagina sia tra quelle autorizzate x l'utente
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private bool checkPageIsAuth()
|
||||
{
|
||||
bool allOk = false;
|
||||
bool pageSafe = (memLayer.ML.confReadString("_safePages").ToUpper().IndexOf(titolo.ToUpper()) >= 0);
|
||||
bool pageAuth = devicesAuthProxy.stObj.isPageEnabled(titolo);
|
||||
allOk = (pageSafe || pageAuth);
|
||||
return allOk;
|
||||
}
|
||||
/// <summary>
|
||||
/// verifica presenza utente autorizzato in sessione
|
||||
/// </summary>
|
||||
private bool checkUser()
|
||||
{
|
||||
bool allOk = devicesAuthProxy.stObj.isAuth;
|
||||
// controllo cookie device...
|
||||
allOk = checkAuthCookie();
|
||||
if (!allOk)
|
||||
{
|
||||
ResetUser();
|
||||
}
|
||||
return allOk;
|
||||
}
|
||||
/// <summary>
|
||||
/// Restituisce cognome/nome da sessione...
|
||||
/// </summary>
|
||||
public string CognomeNome
|
||||
{
|
||||
get
|
||||
{
|
||||
string answ = "-";
|
||||
try
|
||||
{
|
||||
answ = SteamWare.devicesAuthProxy.stObj.CognomeNome;
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
return answ;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// verifica la presenza di un cookie VALIDO per autorizzare il device ed avvia utente...
|
||||
/// </summary>
|
||||
private bool checkAuthCookie()
|
||||
{
|
||||
bool answ = false;
|
||||
try
|
||||
{
|
||||
HttpCookie cookie = Request.Cookies[devicesAuthProxy.AuthCookieName];
|
||||
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;
|
||||
}
|
||||
|
||||
private void ResetUser()
|
||||
{
|
||||
devicesAuthProxy.stObj.clearAllUserData();
|
||||
// svuoto cookie...
|
||||
memLayer.ML.setCookieVal(devicesAuthProxy.AuthCookieName, "");
|
||||
memLayer.ML.emptyCookieVal(devicesAuthProxy.AuthCookieName);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Generated
+26
@@ -0,0 +1,26 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// Codice generato da uno strumento.
|
||||
//
|
||||
// Le modifiche a questo file possono causare un comportamento non corretto e verranno perse se
|
||||
// il codice viene rigenerato.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace WebLCP
|
||||
{
|
||||
|
||||
|
||||
public partial class login
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Controllo form1.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Campo generato automaticamente.
|
||||
/// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.HtmlControls.HtmlForm form1;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="reset.aspx.cs" Inherits="WebLCP.reset" %>
|
||||
|
||||
<!DOCTYPE html>
|
||||
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head runat="server">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
|
||||
<title></title>
|
||||
</head>
|
||||
<body>
|
||||
<form id="form1" runat="server">
|
||||
<div>
|
||||
<h2>Reset Utente</h2>
|
||||
Reset dati utente:
|
||||
<ul>
|
||||
<li>sessione</li>
|
||||
<li>cookies</li>
|
||||
</ul>
|
||||
</div>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,33 @@
|
||||
using SteamWare;
|
||||
using System;
|
||||
|
||||
namespace WebLCP
|
||||
{
|
||||
public partial class reset : System.Web.UI.Page
|
||||
{
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
// rimuovo cookie da elenco in REDIS (se c'è...)
|
||||
if (memLayer.ML.CRS("cookieUsed") != "")
|
||||
{
|
||||
string[] elenco = memLayer.ML.CRS("cookieUsed").Split(',');
|
||||
foreach (var item in elenco)
|
||||
{
|
||||
memLayer.ML.emptyCookieVal(item.Trim());
|
||||
}
|
||||
}
|
||||
// rimuovo cookie in via esplicita (altrimenti...)
|
||||
else
|
||||
{
|
||||
memLayer.ML.emptyCookieVal(memLayer.ML.CRS("AuthCookieName"));
|
||||
#if false
|
||||
memLayer.ML.emptyCookieVal("CTrack_CodOpr");
|
||||
memLayer.ML.emptyCookieVal("CTrack_CodPost");
|
||||
#endif
|
||||
}
|
||||
// rimuovo sessione
|
||||
Session.RemoveAll();
|
||||
Response.Redirect("Default");
|
||||
}
|
||||
}
|
||||
}
|
||||
Generated
+24
@@ -0,0 +1,24 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <generato automaticamente>
|
||||
// Codice generato da uno strumento.
|
||||
//
|
||||
// Le modifiche a questo file possono causare un comportamento non corretto e verranno perse se
|
||||
// il codice viene rigenerato.
|
||||
// </generato automaticamente>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace WebLCP {
|
||||
|
||||
|
||||
public partial class reset {
|
||||
|
||||
/// <summary>
|
||||
/// Controllo form1.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Campo generato automaticamente.
|
||||
/// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.HtmlControls.HtmlForm form1;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user