inclusa gestioen diritti utente (senza VERA conf) x gestioen visibilità note quote in quote det...
eliminati componenti login "legacy"
This commit is contained in:
Samuele E. Locatelli
2014-07-18 15:04:22 +02:00
parent 2306f6c7c5
commit 5da0acefb4
32 changed files with 558 additions and 643 deletions
-47
View File
@@ -1,47 +0,0 @@
<%@ Page Title="Log in" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="Login.aspx.cs" Inherits="C2P.Account.Login" %>
<%@ Register Src="~/Account/OpenAuthProviders.ascx" TagPrefix="uc" TagName="OpenAuthProviders" %>
<asp:Content runat="server" ID="BodyContent" ContentPlaceHolderID="MainContent">
<hgroup class="title">
<h1><%: Title %>.</h1>
</hgroup>
<section id="loginForm">
<h2>Use a local account to log in.</h2>
<asp:Login runat="server" ViewStateMode="Disabled" RenderOuterTable="false">
<LayoutTemplate>
<p class="validation-summary-errors">
<asp:Literal runat="server" ID="FailureText" />
</p>
<fieldset>
<legend>Log in Form</legend>
<ol>
<li>
<asp:Label runat="server" AssociatedControlID="UserName">User name</asp:Label>
<asp:TextBox runat="server" ID="UserName" />
<asp:RequiredFieldValidator runat="server" ControlToValidate="UserName" CssClass="field-validation-error" ErrorMessage="The user name field is required." />
</li>
<li>
<asp:Label runat="server" AssociatedControlID="Password">Password</asp:Label>
<asp:TextBox runat="server" ID="Password" TextMode="Password" />
<asp:RequiredFieldValidator runat="server" ControlToValidate="Password" CssClass="field-validation-error" ErrorMessage="The password field is required." />
</li>
<li>
<asp:CheckBox runat="server" ID="RememberMe" />
<asp:Label runat="server" AssociatedControlID="RememberMe" CssClass="checkbox">Remember me?</asp:Label>
</li>
</ol>
<asp:Button runat="server" CommandName="Login" Text="Log in" />
</fieldset>
</LayoutTemplate>
</asp:Login>
<p>
<asp:HyperLink runat="server" ID="RegisterHyperLink" ViewStateMode="Disabled">Register</asp:HyperLink>
if you don't have an account.
</p>
</section>
<section id="socialLoginForm">
<h2>Use another service to log in.</h2>
<uc:OpenAuthProviders runat="server" ID="OpenAuthLogin" />
</section>
</asp:Content>
-24
View File
@@ -1,24 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace C2P.Account
{
public partial class Login : Page
{
protected void Page_Load(object sender, EventArgs e)
{
RegisterHyperLink.NavigateUrl = "Register";
OpenAuthLogin.ReturnUrl = Request.QueryString["ReturnUrl"];
var returnUrl = HttpUtility.UrlEncode(Request.QueryString["ReturnUrl"]);
if (!String.IsNullOrEmpty(returnUrl))
{
RegisterHyperLink.NavigateUrl += "?ReturnUrl=" + returnUrl;
}
}
}
}
-35
View File
@@ -1,35 +0,0 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace C2P.Account
{
public partial class Login
{
/// <summary>
/// RegisterHyperLink control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.HyperLink RegisterHyperLink;
/// <summary>
/// OpenAuthLogin control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::C2P.Account.OpenAuthProviders OpenAuthLogin;
}
}
-126
View File
@@ -1,126 +0,0 @@
<%@ Page Title="Manage Account" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="Manage.aspx.cs" Inherits="C2P.Account.Manage" %>
<%@ Register Src="~/Account/OpenAuthProviders.ascx" TagPrefix="uc" TagName="OpenAuthProviders" %>
<asp:Content ContentPlaceHolderID="MainContent" runat="server">
<hgroup class="title">
<h1><%: Title %>.</h1>
</hgroup>
<section id="passwordForm">
<asp:PlaceHolder runat="server" ID="successMessage" Visible="false" ViewStateMode="Disabled">
<p class="message-success"><%: SuccessMessage %></p>
</asp:PlaceHolder>
<p>You're logged in as <strong><%: User.Identity.Name %></strong>.</p>
<asp:PlaceHolder runat="server" ID="setPassword" Visible="false">
<p>
You do not have a local password for this site. Add a local
password so you can log in without an external login.
</p>
<fieldset>
<legend>Set Password Form</legend>
<ol>
<li>
<asp:Label runat="server" AssociatedControlID="password">Password</asp:Label>
<asp:TextBox runat="server" ID="password" TextMode="Password" />
<asp:RequiredFieldValidator runat="server" ControlToValidate="password"
CssClass="field-validation-error" ErrorMessage="The password field is required."
Display="Dynamic" ValidationGroup="SetPassword" />
<asp:ModelErrorMessage runat="server" ModelStateKey="NewPassword" AssociatedControlID="password"
CssClass="field-validation-error" SetFocusOnError="true" />
</li>
<li>
<asp:Label runat="server" AssociatedControlID="confirmPassword">Confirm password</asp:Label>
<asp:TextBox runat="server" ID="confirmPassword" TextMode="Password" />
<asp:RequiredFieldValidator runat="server" ControlToValidate="confirmPassword"
CssClass="field-validation-error" Display="Dynamic" ErrorMessage="The confirm password field is required."
ValidationGroup="SetPassword" />
<asp:CompareValidator runat="server" ControlToCompare="Password" ControlToValidate="confirmPassword"
CssClass="field-validation-error" Display="Dynamic" ErrorMessage="The password and confirmation password do not match."
ValidationGroup="SetPassword" />
</li>
</ol>
<asp:Button runat="server" Text="Set Password" ValidationGroup="SetPassword" OnClick="setPassword_Click" />
</fieldset>
</asp:PlaceHolder>
<asp:PlaceHolder runat="server" ID="changePassword" Visible="false">
<h3>Change password</h3>
<asp:ChangePassword runat="server" CancelDestinationPageUrl="~/" ViewStateMode="Disabled" RenderOuterTable="false" SuccessPageUrl="Manage?m=ChangePwdSuccess">
<ChangePasswordTemplate>
<p class="validation-summary-errors">
<asp:Literal runat="server" ID="FailureText" />
</p>
<fieldset class="changePassword">
<legend>Change password details</legend>
<ol>
<li>
<asp:Label runat="server" ID="CurrentPasswordLabel" AssociatedControlID="CurrentPassword">Current password</asp:Label>
<asp:TextBox runat="server" ID="CurrentPassword" CssClass="passwordEntry" TextMode="Password" />
<asp:RequiredFieldValidator runat="server" ControlToValidate="CurrentPassword"
CssClass="field-validation-error" ErrorMessage="The current password field is required."
ValidationGroup="ChangePassword" />
</li>
<li>
<asp:Label runat="server" ID="NewPasswordLabel" AssociatedControlID="NewPassword">New password</asp:Label>
<asp:TextBox runat="server" ID="NewPassword" CssClass="passwordEntry" TextMode="Password" />
<asp:RequiredFieldValidator runat="server" ControlToValidate="NewPassword"
CssClass="field-validation-error" ErrorMessage="The new password is required."
ValidationGroup="ChangePassword" />
</li>
<li>
<asp:Label runat="server" ID="ConfirmNewPasswordLabel" AssociatedControlID="ConfirmNewPassword">Confirm new password</asp:Label>
<asp:TextBox runat="server" ID="ConfirmNewPassword" CssClass="passwordEntry" TextMode="Password" />
<asp:RequiredFieldValidator runat="server" ControlToValidate="ConfirmNewPassword"
CssClass="field-validation-error" Display="Dynamic" ErrorMessage="Confirm new password is required."
ValidationGroup="ChangePassword" />
<asp:CompareValidator runat="server" ControlToCompare="NewPassword" ControlToValidate="ConfirmNewPassword"
CssClass="field-validation-error" Display="Dynamic" ErrorMessage="The new password and confirmation password do not match."
ValidationGroup="ChangePassword" />
</li>
</ol>
<asp:Button runat="server" CommandName="ChangePassword" Text="Change password" ValidationGroup="ChangePassword" />
</fieldset>
</ChangePasswordTemplate>
</asp:ChangePassword>
</asp:PlaceHolder>
</section>
<section id="externalLoginsForm">
<asp:ListView runat="server"
ItemType="Microsoft.AspNet.Membership.OpenAuth.OpenAuthAccountData"
SelectMethod="GetExternalLogins" DeleteMethod="RemoveExternalLogin" DataKeyNames="ProviderName,ProviderUserId">
<LayoutTemplate>
<h3>Registered external logins</h3>
<table>
<thead><tr><th>Service</th><th>User Name</th><th>Last Used</th><th>&nbsp;</th></tr></thead>
<tbody>
<tr runat="server" id="itemPlaceholder"></tr>
</tbody>
</table>
</LayoutTemplate>
<ItemTemplate>
<tr>
<td><%#: Item.ProviderDisplayName %></td>
<td><%#: Item.ProviderUserName %></td>
<td><%#: ConvertToDisplayDateTime(Item.LastUsedUtc) %></td>
<td>
<asp:Button runat="server" Text="Remove" CommandName="Delete" CausesValidation="false"
ToolTip='<%# "Remove this " + Item.ProviderDisplayName + " login from your account" %>'
Visible="<%# CanRemoveExternalLogins %>" />
</td>
</tr>
</ItemTemplate>
</asp:ListView>
<h3>Add an external login</h3>
<uc:OpenAuthProviders runat="server" ReturnUrl="~/Account/Manage" />
</section>
</asp:Content>
-95
View File
@@ -1,95 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.AspNet.Membership.OpenAuth;
namespace C2P.Account
{
public partial class Manage : System.Web.UI.Page
{
protected string SuccessMessage
{
get;
private set;
}
protected bool CanRemoveExternalLogins
{
get;
private set;
}
protected void Page_Load()
{
if (!IsPostBack)
{
// Determine the sections to render
var hasLocalPassword = OpenAuth.HasLocalPassword(User.Identity.Name);
setPassword.Visible = !hasLocalPassword;
changePassword.Visible = hasLocalPassword;
CanRemoveExternalLogins = hasLocalPassword;
// Render success message
var message = Request.QueryString["m"];
if (message != null)
{
// Strip the query string from action
Form.Action = ResolveUrl("~/Account/Manage");
SuccessMessage =
message == "ChangePwdSuccess" ? "Your password has been changed."
: message == "SetPwdSuccess" ? "Your password has been set."
: message == "RemoveLoginSuccess" ? "The external login was removed."
: String.Empty;
successMessage.Visible = !String.IsNullOrEmpty(SuccessMessage);
}
}
}
protected void setPassword_Click(object sender, EventArgs e)
{
if (IsValid)
{
var result = OpenAuth.AddLocalPassword(User.Identity.Name, password.Text);
if (result.IsSuccessful)
{
Response.Redirect("~/Account/Manage?m=SetPwdSuccess");
}
else
{
ModelState.AddModelError("NewPassword", result.ErrorMessage);
}
}
}
public IEnumerable<OpenAuthAccountData> GetExternalLogins()
{
var accounts = OpenAuth.GetAccountsForUser(User.Identity.Name);
CanRemoveExternalLogins = CanRemoveExternalLogins || accounts.Count() > 1;
return accounts;
}
public void RemoveExternalLogin(string providerName, string providerUserId)
{
var m = OpenAuth.DeleteAccount(User.Identity.Name, providerName, providerUserId)
? "?m=RemoveLoginSuccess"
: String.Empty;
Response.Redirect("~/Account/Manage" + m);
}
protected static string ConvertToDisplayDateTime(DateTime? utcDateTime)
{
// You can change this method to convert the UTC date time into the desired display
// offset and format. Here we're converting it to the server timezone and formatting
// as a short date and a long time string, using the current thread culture.
return utcDateTime.HasValue ? utcDateTime.Value.ToLocalTime().ToString("G") : "[never]";
}
}
}
-66
View File
@@ -1,66 +0,0 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace C2P.Account
{
public partial class Manage
{
/// <summary>
/// successMessage control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.PlaceHolder successMessage;
/// <summary>
/// setPassword control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.PlaceHolder setPassword;
/// <summary>
/// password control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.TextBox password;
/// <summary>
/// confirmPassword control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.TextBox confirmPassword;
/// <summary>
/// changePassword control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.PlaceHolder changePassword;
}
}
-21
View File
@@ -1,21 +0,0 @@
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="OpenAuthProviders.ascx.cs" Inherits="C2P.Account.OpenAuthProviders" %>
<fieldset class="open-auth-providers">
<legend>Log in using another service</legend>
<asp:ListView runat="server" ID="providerDetails" ItemType="Microsoft.AspNet.Membership.OpenAuth.ProviderDetails"
SelectMethod="GetProviderNames" ViewStateMode="Disabled">
<ItemTemplate>
<button type="submit" name="provider" value="<%#: Item.ProviderName %>"
title="Log in using your <%#: Item.ProviderDisplayName %> account.">
<%#: Item.ProviderDisplayName %>
</button>
</ItemTemplate>
<EmptyDataTemplate>
<div class="message-info">
<p>There are no external authentication services configured. See <a href="http://go.microsoft.com/fwlink/?LinkId=252803">this article</a> for details on setting up this ASP.NET application to support logging in via external services.</p>
</div>
</EmptyDataTemplate>
</asp:ListView>
</fieldset>
-43
View File
@@ -1,43 +0,0 @@
using System;
using System.Collections.Generic;
using System.Web;
using Microsoft.AspNet.Membership.OpenAuth;
namespace C2P.Account
{
public partial class OpenAuthProviders : System.Web.UI.UserControl
{
protected void Page_Load(object sender, EventArgs e)
{
if (IsPostBack)
{
var provider = Request.Form["provider"];
if (provider == null)
{
return;
}
var redirectUrl = "~/Account/RegisterExternalLogin";
if (!String.IsNullOrEmpty(ReturnUrl))
{
var resolvedReturnUrl = ResolveUrl(ReturnUrl);
redirectUrl += "?ReturnUrl=" + HttpUtility.UrlEncode(resolvedReturnUrl);
}
OpenAuth.RequestAuthentication(provider, redirectUrl);
}
}
public string ReturnUrl { get; set; }
public IEnumerable<ProviderDetails> GetProviderNames()
{
return OpenAuth.AuthenticationClients.GetAll();
}
}
}
-27
View File
@@ -1,27 +0,0 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace C2P.Account
{
public partial class OpenAuthProviders
{
/// <summary>
/// providerDetails control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.ListView providerDetails;
}
}
-62
View File
@@ -1,62 +0,0 @@
<%@ Page Title="Register" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="Register.aspx.cs" Inherits="C2P.Account.Register" %>
<asp:Content runat="server" ID="BodyContent" ContentPlaceHolderID="MainContent">
<hgroup class="title">
<h1><%: Title %>.</h1>
<h2>Use the form below to create a new account.</h2>
</hgroup>
<asp:CreateUserWizard runat="server" ID="RegisterUser" ViewStateMode="Disabled" OnCreatedUser="RegisterUser_CreatedUser">
<LayoutTemplate>
<asp:PlaceHolder runat="server" ID="wizardStepPlaceholder" />
<asp:PlaceHolder runat="server" ID="navigationPlaceholder" />
</LayoutTemplate>
<WizardSteps>
<asp:CreateUserWizardStep runat="server" ID="RegisterUserWizardStep">
<ContentTemplate>
<p class="message-info">
Passwords are required to be a minimum of <%: Membership.MinRequiredPasswordLength %> characters in length.
</p>
<p class="validation-summary-errors">
<asp:Literal runat="server" ID="ErrorMessage" />
</p>
<fieldset>
<legend>Registration Form</legend>
<ol>
<li>
<asp:Label runat="server" AssociatedControlID="UserName">User name</asp:Label>
<asp:TextBox runat="server" ID="UserName" />
<asp:RequiredFieldValidator runat="server" ControlToValidate="UserName"
CssClass="field-validation-error" ErrorMessage="The user name field is required." />
</li>
<li>
<asp:Label runat="server" AssociatedControlID="Email">Email address</asp:Label>
<asp:TextBox runat="server" ID="Email" TextMode="Email" />
<asp:RequiredFieldValidator runat="server" ControlToValidate="Email"
CssClass="field-validation-error" ErrorMessage="The email address field is required." />
</li>
<li>
<asp:Label runat="server" AssociatedControlID="Password">Password</asp:Label>
<asp:TextBox runat="server" ID="Password" TextMode="Password" />
<asp:RequiredFieldValidator runat="server" ControlToValidate="Password"
CssClass="field-validation-error" ErrorMessage="The password field is required." />
</li>
<li>
<asp:Label runat="server" AssociatedControlID="ConfirmPassword">Confirm password</asp:Label>
<asp:TextBox runat="server" ID="ConfirmPassword" TextMode="Password" />
<asp:RequiredFieldValidator runat="server" ControlToValidate="ConfirmPassword"
CssClass="field-validation-error" Display="Dynamic" ErrorMessage="The confirm password field is required." />
<asp:CompareValidator runat="server" ControlToCompare="Password" ControlToValidate="ConfirmPassword"
CssClass="field-validation-error" Display="Dynamic" ErrorMessage="The password and confirmation password do not match." />
</li>
</ol>
<asp:Button runat="server" CommandName="MoveNext" Text="Register" />
</fieldset>
</ContentTemplate>
<CustomNavigationTemplate />
</asp:CreateUserWizardStep>
</WizardSteps>
</asp:CreateUserWizard>
</asp:Content>
-31
View File
@@ -1,31 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using Microsoft.AspNet.Membership.OpenAuth;
namespace C2P.Account
{
public partial class Register : Page
{
protected void Page_Load(object sender, EventArgs e)
{
RegisterUser.ContinueDestinationPageUrl = Request.QueryString["ReturnUrl"];
}
protected void RegisterUser_CreatedUser(object sender, EventArgs e)
{
FormsAuthentication.SetAuthCookie(RegisterUser.UserName, createPersistentCookie: false);
string continueUrl = RegisterUser.ContinueDestinationPageUrl;
if (!OpenAuth.IsLocalUrl(continueUrl))
{
continueUrl = "~/";
}
Response.Redirect(continueUrl);
}
}
}
-35
View File
@@ -1,35 +0,0 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace C2P.Account
{
public partial class Register
{
/// <summary>
/// RegisterUser control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.CreateUserWizard RegisterUser;
/// <summary>
/// RegisterUserWizardStep control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.CreateUserWizardStep RegisterUserWizardStep;
}
}
-12
View File
@@ -1,12 +0,0 @@
<?xml version="1.0"?>
<configuration>
<location path="Manage.aspx">
<system.web>
<authorization>
<deny users="?"/>
</authorization>
</system.web>
</location>
</configuration>
+18 -3
View File
@@ -16,8 +16,8 @@
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<UseIISExpress>true</UseIISExpress>
<IISExpressSSLPort />
<IISExpressAnonymousAuthentication />
<IISExpressWindowsAuthentication />
<IISExpressAnonymousAuthentication>disabled</IISExpressAnonymousAuthentication>
<IISExpressWindowsAuthentication>enabled</IISExpressWindowsAuthentication>
<IISExpressUseClassicPipelineMode />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
@@ -260,6 +260,7 @@
<Content Include="Images\view_m.png" />
<Content Include="Images\view_s.png" />
<Content Include="Images\WorkInProgress.jpg" />
<Content Include="login.aspx" />
<Content Include="MarginReport.aspx" />
<Content Include="NewProductOffer.aspx" />
<Content Include="OffersArchive.aspx" />
@@ -326,6 +327,7 @@
<Content Include="WebUserControls\mod_displayHor.ascx" />
<Content Include="WebUserControls\mod_fileUploader.ascx" />
<Content Include="WebUserControls\mod_lemmiVocab.ascx" />
<Content Include="WebUserControls\mod_login.ascx" />
<Content Include="WebUserControls\mod_MaRepActData.ascx" />
<Content Include="WebUserControls\mod_MaRepNewData.ascx" />
<Content Include="WebUserControls\mod_marginReport.ascx" />
@@ -468,6 +470,13 @@
<Compile Include="JumboPage.master.designer.cs">
<DependentUpon>JumboPage.master</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="MarginReport.aspx.cs">
<DependentUpon>MarginReport.aspx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
@@ -625,6 +634,13 @@
<Compile Include="WebUserControls\mod_lemmiVocab.ascx.designer.cs">
<DependentUpon>mod_lemmiVocab.ascx</DependentUpon>
</Compile>
<Compile Include="WebUserControls\mod_login.ascx.cs">
<DependentUpon>mod_login.ascx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="WebUserControls\mod_login.ascx.designer.cs">
<DependentUpon>mod_login.ascx</DependentUpon>
</Compile>
<Compile Include="WebUserControls\mod_MaRepActData.ascx.cs">
<DependentUpon>mod_MaRepActData.ascx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
@@ -823,7 +839,6 @@
</Compile>
</ItemGroup>
<ItemGroup>
<Folder Include="Account\" />
<Folder Include="App_Data\" />
<Folder Include="Images\loaders\" />
</ItemGroup>
-5
View File
@@ -96,11 +96,6 @@ namespace C2P.Services
{
//suggerimenti.Add(riga.label);
suggerimenti.Add(string.Format("{0}#{1}#{2}", riga.Lingua, riga.Lemma, riga.Traduzione));
if (suggerimenti.Count == memLayer.ML.confReadInt("maxNumSuggest"))
{
suggerimenti.Add("...more#");
return suggerimenti.ToArray();
}
}
return suggerimenti.ToArray();
}
+5 -1
View File
@@ -18,6 +18,8 @@
<add key="appName" value="C2P" />
<add key="money" value="€" />
<add key="weight" value="kg" />
<!--area auth-->
<add key="authSenzaDominio" value="true" />
<!--area suggerimenti-->
<add key ="maxNumSuggest" value="50" />
<!--area logger-->
@@ -45,6 +47,8 @@
<add key="MarginOffers" value="0.5cm" />
<!--stringhe connessione-->
<add key="C2PConnectionString" value="Data Source=10.74.82.217\SQL2008R2;Initial Catalog=Proxima_C2P;Persist Security Info=True;User ID=sa;Password=keyhammer" />
<add key="PermessiConnectionString" value="Data Source=10.74.82.217\sql2008r2;Initial Catalog=Proxima_C2P;Persist Security Info=True;User ID=sa;Password=keyhammer" />
<add key="UtenteCdcConnectionString" value="Data Source=10.74.82.217\sql2008r2;Initial Catalog=Proxima_C2P;Persist Security Info=True;User ID=sa;Password=keyhammer" />
<add key="VocabolarioConnectionString" value="Data Source=10.74.82.217\SQL2008R2;Initial Catalog=Proxima_C2P;Persist Security Info=True;User ID=sa;Password=keyhammer" />
</appSettings>
<connectionStrings>
@@ -75,7 +79,7 @@
</controls>
</pages>
<authentication mode="Forms">
<forms loginUrl="~/Account/Login" timeout="2880" defaultUrl="~/" />
<forms loginUrl="~/Login" timeout="2880" defaultUrl="~/" />
</authentication>
<httpModules>
<add name="ErrorLog" type="Elmah.ErrorLogModule, Elmah" />
+6 -6
View File
@@ -18,7 +18,7 @@
</div>
<div class="row bottomLine">
<div class="col-xs-6 text-left">
<uc1:mod_displayHor ID="mod_displayHor7" runat="server" etichetta='<%# traduci("Charge") %>' valore='<%# Eval("Charge", "{0:P1}") %>' />
<uc1:mod_displayHor ID="mod_displayHor7" runat="server" etichetta='<%# traduci("Charge") %>' valore='<%# Eval("Charge", "{0:P1}") %>' Visible='<%# userIsAdmin %>' />
</div>
<div class="col-xs-6 text-right">
</div>
@@ -40,14 +40,14 @@
</div>
<div class="row bottomLine">
<div class="col-xs-6 text-left">
<uc1:mod_displayHor ID="mod_displayHor13" runat="server" etichetta='<%# traduci("FCShield") %>' valore='<%# Eval("FCShield", "{0:P1}") %>' />
<uc1:mod_displayHor ID="mod_displayHor13" runat="server" etichetta='<%# traduci("FCShield") %>' valore='<%# Eval("FCShield", "{0:P1}") %>' Visible='<%# userIsAdmin %>' />
</div>
<div class="col-xs-6 text-right">
</div>
</div>
<div class="row">
<div class="col-xs-6 text-left">
<uc1:mod_displayHor ID="mod_displayHor14" runat="server" etichetta='<%# traduci("PckSur") %>' valore='<%# Eval("PckSur", "{0:C3}") %>' />
<uc1:mod_displayHor ID="mod_displayHor14" runat="server" etichetta='<%# traduci("PckSur") %>' valore='<%# Eval("PckSur", "{0:C3}") %>' Visible='<%# userIsAdmin %>' />
</div>
<div class="col-xs-6 text-right">
</div>
@@ -64,7 +64,7 @@
</div>
<div class="row bottomLine">
<div class="col-xs-6 text-left">
<uc1:mod_displayHor ID="mod_displayHor7" runat="server" etichetta='<%# traduci("Charge") %>' valore='<%# Eval("Charge", "{0:P1}") %>' />
<uc1:mod_displayHor ID="mod_displayHor7" runat="server" etichetta='<%# traduci("Charge") %>' valore='<%# Eval("Charge", "{0:P1}") %>' Visible='<%# userIsAdmin %>' />
</div>
<div class="col-xs-6 text-right">
</div>
@@ -93,14 +93,14 @@
</div>
<div class="row bottomLine">
<div class="col-xs-6 text-left">
<uc1:mod_displayHor ID="mod_displayHor13" runat="server" etichetta='<%# traduci("FCShield") %>' valore='<%# Eval("FCShield", "{0:P1}") %>' />
<uc1:mod_displayHor ID="mod_displayHor13" runat="server" etichetta='<%# traduci("FCShield") %>' valore='<%# Eval("FCShield", "{0:P1}") %>' Visible='<%# userIsAdmin %>' />
</div>
<div class="col-xs-6 text-right">
</div>
</div>
<div class="row">
<div class="col-xs-6 text-left">
<uc1:mod_displayHor ID="mod_displayHor14" runat="server" etichetta='<%# traduci("PckSur") %>' valore='<%# Eval("PckSur", "{0:C3}") %>' />
<uc1:mod_displayHor ID="mod_displayHor14" runat="server" etichetta='<%# traduci("PckSur") %>' valore='<%# Eval("PckSur", "{0:C3}") %>' Visible='<%# userIsAdmin %>' />
</div>
<div class="col-xs-6 text-right">
</div>
+11
View File
@@ -81,5 +81,16 @@ namespace C2P.WebUserControls
{
frmView.DataBind();
}
/// <summary>
/// verifica se utente sia admin altrimenti non vede dati...
/// </summary>
public bool userIsAdmin
{
get
{
bool answ = SteamWare.user_std.UtSn.userHasRight("SuperUser");
return answ;
}
}
}
}
+54
View File
@@ -0,0 +1,54 @@
<%@ Control Language="C#" AutoEventWireup="true" Inherits="mod_login" Codebehind="mod_login.ascx.cs" %>
<asp:Panel ID="pnlForceUser" runat="server">
<table width="100%">
<tr>
<td colspan="2" class="chPwdTitle">
<asp:Label runat="server" ID="lblTitolo" />
</td>
</tr>
</table>
<table class="smallTable">
<tr>
<td>
<asp:Label CssClass="chPwdTxt" runat="server" ID="lblPwd" />
</td>
<td>
<asp:TextBox runat="server" ID="authKey" TextMode="Password" Width="210px"></asp:TextBox>
</td>
</tr>
<tr>
<td>
<asp:Label CssClass="chPwdTxt" runat="server" ID="lblDominio" />
</td>
<td>
<asp:TextBox runat="server" ID="dominio" Width="210px"></asp:TextBox>
</td>
</tr>
<tr>
<td>
<asp:Label CssClass="chPwdTxt" runat="server" ID="lblUser" />
</td>
<td>
<asp:TextBox runat="server" ID="user" Width="210px"></asp:TextBox>
</td>
</tr>
<tr>
<td colspan="2">
<asp:Button Width="100%" runat="server" ID="btnOk" CommandName="ok" CommandArgument="ok"
OnClick="btnOk_Click"></asp:Button>
</td>
</tr>
</table>
</asp:Panel>
<table class="smallTable">
<tr>
<td colspan="2">
<asp:Label CssClass="chPwdTxt" ID="lblMessage" runat="server" />
</td>
</tr>
<tr>
<td colspan="2" align="center">
<asp:HyperLink ID="HypLinkSSO" runat="server" NavigateUrl="~/login.aspx" Text="Single-Sign-On Login"></asp:HyperLink>
</td>
</tr>
</table>
+243
View File
@@ -0,0 +1,243 @@
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using SteamWare;
using C2P_Data;
/// <summary>
/// classe gestione login e forzatura login
/// </summary>
public partial class mod_login : ApplicationUserControl
{
#region area protected/private
#region area proprietà
private SteamWare.loginMode _isForceUser = SteamWare.loginMode.normale;
#endregion
#region area metodi
/// <summary>
/// imposta la modalità di login tra normale / forceUser
/// </summary>
private void setLoginMode()
{
if (_isForceUser == SteamWare.loginMode.forceUser)
{
pnlForceUser.Visible = true;
}
else
{
pnlForceUser.Visible = false;
}
}
protected override void traduciObj()
{
lblPwd.Text = user_std.UtSn.Traduci("lblPwd");
lblUser.Text = user_std.UtSn.Traduci("lblUser");
lblDominio.Text = user_std.UtSn.Traduci("lblDominio");
lblTitolo.Text = user_std.UtSn.Traduci("ForzaUtente");
btnOk.Text = user_std.UtSn.Traduci("btnCommit");
}
/// <summary>
/// prova a verificare se l'utente sia ok x AD credentials
/// </summary>
private void AdLogin()
{
lblMessage.Text = traduci("UserNotAuth");
if (Page.User.Identity.IsAuthenticated)
{
//recupera user windows se c'è...
string ad_name = Page.User.Identity.Name;
string delimStr = "\\";
char[] delimiter = delimStr.ToCharArray();
string[] dom_user = ad_name.Split(delimiter, 2);
// passo al controllo di verifica ADuserOk...
user_std _utente = new user_std();
if (_utente.ADuserOk(dom_user[0], dom_user[1]))
{
bool fatto = _utente.startUpUtente(dom_user[0], dom_user[1]);
if (fatto)
{
string postazione_IP = Request.UserHostName;
httpLog(string.Format("L'utente {0} ({1}) ha effettuato il login correttamente dall'IP {2}", _utente.CognomeNome, _utente.userNameAD, postazione_IP), SteamWare.tipoLog.INFO);
if (Login_ok != null)
{
Login_ok(this, new EventArgs());
}
}
else
{
lblMessage.Text = String.Format("{0}<br>There are some problems instatiating user: {1}/{2}", user_std.UtSn.Traduci("AccessFail"), dom_user[0], dom_user[1]);
httpLog(String.Format("Accesso fallito, problemi ad istanziare l'utente {0}/{1}", dom_user[0], dom_user[1]), SteamWare.tipoLog.ERROR);
if (Login_Error != null)
{
Login_Error(this, new EventArgs());
}
}
}
else
{
if (memLayer.ML.confReadBool("autoEnrollEnabled"))
{
// rimando al modulo di auto enroll...
Response.Redirect("autoEnroll.aspx");
}
else
{
lblMessage.Text = String.Format("{0}<br>user not allowed: {1}/{2}", user_std.UtSn.Traduci("AccessFail"), dom_user[0], dom_user[1]);
httpLog(String.Format("Utente non autorizzato: {0}/{1}", dom_user[0], dom_user[1]), SteamWare.tipoLog.WARNING);
if (Login_Error != null)
{
Login_Error(this, new EventArgs());
}
}
}
}
else
{
lblMessage.Text = user_std.UtSn.Traduci("AccessFail") + user_std.UtSn.Traduci("UsrNotAuth");
httpLog(String.Format("Accesso fallito, utente non autenticato"), SteamWare.tipoLog.WARNING);
if (Login_Error != null)
{
Login_Error(this, new EventArgs());
}
}
}
/// <summary>
/// effettua verifiche e se concesso permette di forzare l'accesso utente
/// </summary>
private void ForceUserIdentity()
{
if (Page.User.Identity.IsAuthenticated)
{
bool _allowForceUser = false;
try
{
_allowForceUser = SteamWare.memLayer.ML.confReadBool("_allowForceUser");
}
catch
{
_allowForceUser = false;
}
if (_allowForceUser)
{
if (authKey.Text == "triplete") // verifica passphrase...
{
user_std _utente = new user_std();
user_std.UtSn.isForcedUser = true;
bool fatto = _utente.startUpUtente(dominio.Text, user.Text);
if (fatto)
{
string _rigaLog = String.Format("User {0} has forced user identity ok: logged as \t {1}\\{2}", Page.User.Identity.Name, dominio.Text, user.Text);
httpLog(_rigaLog, SteamWare.tipoLog.INFO);
if (Login_ok != null)
{
Login_ok(this, new EventArgs());
}
}
}
else
{
lblMessage.Text = String.Format("{0}<br>key not allowed for operation!!! operation logged!!!", user_std.UtSn.Traduci("AccessFail"));
mandaEmail(_fromEmail, _adminEmail, "Attenzione: tentativo di accesso non autorizzato!", String.Format("Tentativo di forcing user non autorizzato!<br>L'utente {0} ha tentato di accedere a {1} forzando l'utente ma la sua key autorizzativa e' sbagliata...", Page.User.Identity.Name, user_std.UtSn.Traduci(SteamWare.memLayer.ML.confReadString("defaultApp"))));
string _rigaLog = String.Format("User {0}\t tried to force user - wrong password - he tried to log as \t {1}\\{2}", Page.User.Identity.Name, dominio.Text, user.Text);
httpLog(_rigaLog, SteamWare.tipoLog.WARNING);
if (Login_Error != null)
{
Login_Error(this, new EventArgs());
}
}
}
else
{
mandaEmail(_fromEmail, _adminEmail, "Attenzione: tentativo di accesso non autorizzato!", String.Format("Tentativo di forcing user non autorizzato!<br>L'utente {0} ha tentato di accedere a {1} forzando l'utente ma la funzione e' disabilitata...", Page.User.Identity.Name, user_std.UtSn.Traduci(SteamWare.memLayer.ML.confReadString("defaultApp"))));
string _rigaLog = String.Format("User {0}\t tried to force user - access disabled - he tried to log as \t {1}\\{2}", Page.User.Identity.Name, dominio.Text, user.Text);
httpLog(_rigaLog, SteamWare.tipoLog.WARNING);
if (Login_Error != null)
{
Login_Error(this, new EventArgs());
}
}
}
else
{
lblMessage.Text = string.Format("{0}<br>user not authenticated!<br>", user_std.UtSn.Traduci("AccessFail"));
if (Login_Error != null)
{
Login_Error(this, new EventArgs());
}
string _rigaLog = String.Format("\t Someone tried to force user - real user: \t - not autenticated - \t tried to log as \t {0}\\{1}", dominio.Text, user.Text);
httpLog(_rigaLog, SteamWare.tipoLog.WARNING);
}
}
protected void btnOk_Click(object sender, EventArgs e)
{
ForceUserIdentity();
}
#endregion
#endregion
#region area public
#region eventi pubblici esposti
public event EventHandler Login_ok;
public event EventHandler Login_Error;
#endregion
#region area proprietà
/// <summary>
/// modalità funzionamento controllo tra normale (ActiveDirectory e user auth di default) e forceUser
/// </summary>
public SteamWare.loginMode modoLogin
{
get
{
return _isForceUser;
}
set
{
_isForceUser = value;
}
}
#endregion
/// <summary>
/// avvio pagina
/// </summary>
protected override void Page_Load(object sender, EventArgs e)
{
//base.Page_Load(sender, e);
//carico da web.config i default values
loadDefaultsWebConfig();
// procedo...
setLoginMode();
Session.RemoveAll();
if (_isForceUser == SteamWare.loginMode.normale)
{
AdLogin();
}
}
#endregion
}
+113
View File
@@ -0,0 +1,113 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:2.0.50727.4927
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
public partial class mod_login {
/// <summary>
/// pnlForceUser control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Panel pnlForceUser;
/// <summary>
/// lblTitolo control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Label lblTitolo;
/// <summary>
/// lblPwd control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Label lblPwd;
/// <summary>
/// authKey control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.TextBox authKey;
/// <summary>
/// lblDominio control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Label lblDominio;
/// <summary>
/// dominio control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.TextBox dominio;
/// <summary>
/// lblUser control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Label lblUser;
/// <summary>
/// user control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.TextBox user;
/// <summary>
/// btnOk control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Button btnOk;
/// <summary>
/// lblMessage control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Label lblMessage;
/// <summary>
/// HypLinkSSO control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.HyperLink HypLinkSSO;
}
BIN
View File
Binary file not shown.
Binary file not shown.
Binary file not shown.
+26
View File
@@ -0,0 +1,26 @@
<%@ Page Language="C#" MasterPageFile="~/JumboPage.master" AutoEventWireup="true"
Inherits="login" Title="Login" CodeBehind="login.aspx.cs" %>
<%@ Register Src="~/WebUserControls/mod_login.ascx" TagName="mod_login" TagPrefix="uc1" %>
<asp:Content runat="server" ID="FeaturedContent" ContentPlaceHolderID="FeaturedContent">
<div class="row" style="margin-top: -10px;">
<div class="col-xs-6">
<div style="color: #ee8800;">
<h1>CostiMate<sub>line</sub></h1>
</div>
<p>Cost to Price for Extrusion</p>
</div>
<div class="col-xs-6 text-right">
<img src="Images/extrusion.png" alt="" class="img-responsive" /></div>
</div>
</asp:Content>
<asp:Content runat="server" ID="BodyContent" ContentPlaceHolderID="MainContent">
<div class="container marketing">
<div class="row">
<div class="col-xs-10 col-xs-offset-1">
<uc1:mod_login ID="Mod_login1" runat="server" />
</div>
</div>
</div>
</asp:Content>
+56
View File
@@ -0,0 +1,56 @@
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
public partial class login : System.Web.UI.Page
{
protected string _nextPage
{
get
{
string pagina = SteamWare.memLayer.ML.StringSessionObj("nextPage");
if (pagina == "")
{
pagina = "Default.aspx";
}
return pagina;
}
}
protected void Page_Load(object sender, EventArgs e)
{
Mod_login1.modoLogin = SteamWare.loginMode.normale;
// pulisco dir temp dai file dei cartellini stampati
reportPrinter.obj.pulisciDir();
}
protected override void OnInit(EventArgs e)
{
base.OnInit(e);
Mod_login1.Login_ok += new EventHandler(Mod_login1_Login_ok);
Mod_login1.Login_Error += new EventHandler(Mod_login1_Login_Error);
}
void Mod_login1_Login_Error(object sender, EventArgs e)
{
Response.Redirect("./unauthorized.aspx");
}
void Mod_login1_Login_ok(object sender, EventArgs e)
{
Response.Redirect(_nextPage);
}
protected override void OnUnload(EventArgs e)
{
base.OnUnload(e);
Mod_login1.Login_ok -= new EventHandler(Mod_login1_Login_ok);
Mod_login1.Login_Error -= new EventHandler(Mod_login1_Login_Error);
}
}
+22
View File
@@ -0,0 +1,22 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
public partial class login {
/// <summary>
/// Mod_login1 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::mod_login Mod_login1;
}
Binary file not shown.
Binary file not shown.
Binary file not shown.
+2 -2
View File
@@ -5,7 +5,7 @@
using System.Reflection;
[assembly: AssemblyVersion("0.8.102.229")]
[assembly: AssemblyFileVersion("0.8.102.229")]
[assembly: AssemblyVersion("0.8.103.229")]
[assembly: AssemblyFileVersion("0.8.103.229")]
[assembly: AssemblyCopyright("Proxima & Steamware © 2013-2014")]
[assembly: AssemblyCompany("Steamware")]
+2 -2
View File
@@ -6,8 +6,8 @@
using System.Reflection;
[assembly: AssemblyVersion("0.8.102.<#= this.RevisionNumber #>")]
[assembly: AssemblyFileVersion("0.8.102.<#= this.RevisionNumber #>")]
[assembly: AssemblyVersion("0.8.103.<#= this.RevisionNumber #>")]
[assembly: AssemblyFileVersion("0.8.103.<#= this.RevisionNumber #>")]
[assembly: AssemblyCopyright("Proxima & Steamware © 2013-<#= DateTime.Now.Year #>")]
[assembly: AssemblyCompany("Steamware")]
<#+