3.0.0.1 Demo repository registration
This commit is contained in:
@@ -3,7 +3,6 @@ using Sarand.BusinessMgr.Net.Standard.Base.App;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Sarand.BusinessMgr.Net.Core.Web.App
|
||||
{
|
||||
@@ -43,11 +42,26 @@ namespace Sarand.BusinessMgr.Net.Core.Web.App
|
||||
// Security.
|
||||
public class SecurityConfig
|
||||
{
|
||||
public class DemoConfig
|
||||
{
|
||||
public class AccountConfig
|
||||
{
|
||||
public class RegisterConfig
|
||||
{
|
||||
public int EmailLinkExpiresMins = Sbm.Config.Security.Demo.Register.EmailLinkExpiresMins_Default;
|
||||
}
|
||||
public RegisterConfig Register{ get; } = new RegisterConfig();
|
||||
}
|
||||
public AccountConfig Account { get; } = new AccountConfig();
|
||||
}
|
||||
public DemoConfig Demo{ get; } = new DemoConfig();
|
||||
// Password.
|
||||
public class PasswordConfig
|
||||
{
|
||||
public int MinLength { get; set; }
|
||||
}
|
||||
public PasswordConfig Password { get; } = new PasswordConfig();
|
||||
// Sign-up.
|
||||
public class SignUpConfig
|
||||
{
|
||||
public class ActivationConfig
|
||||
|
||||
@@ -105,7 +105,7 @@ namespace Sarand.BusinessMgr.Net.Core.Web.App
|
||||
else
|
||||
ApplicationOptions_Disallowed.Add(option);
|
||||
}
|
||||
else SaLogger.Warn($"{SysUtil.Fn} Unrecognised application option: {itemParam.Name}.");
|
||||
else SaLogger.Warn($"{SysUtil.Fn} Unrecognised application 'Option Allowed': {itemParam.Name}.");
|
||||
}
|
||||
else if (itemParam.Context.EqualsCI(ParamContext_AffiliateTypeAllowed))
|
||||
{
|
||||
|
||||
@@ -5,6 +5,7 @@ using Sarand.BusinessMgr.Net.Standard.Base.App;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Consoles;
|
||||
using Sarand.Net.Standard.Base.App;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Net;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -105,6 +106,15 @@ namespace Sarand.BusinessMgr.Net.Core.Web.App
|
||||
return new HtmlString(value);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
/// <summary>
|
||||
/// Encode the text to avoid conflict with HTML document structure.
|
||||
/// </summary>
|
||||
public String HtmlEncode(string text)
|
||||
{
|
||||
return WebUtil.HtmlEncode(text);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
/// <summary>
|
||||
/// Localised javascript string.
|
||||
|
||||
@@ -13,6 +13,7 @@ using Sarand.BusinessMgr.Net.Standard.Base.Bus;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Consoles;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Core;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Mgr;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Mgr.Control;
|
||||
using Sarand.Net.Standard.Base.App;
|
||||
using Sarand.Net.Standard.Base.CodeTypes;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
@@ -44,6 +45,7 @@ namespace Sarand.BusinessMgr.Net.Core.Web.Components
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Data members.
|
||||
private SbmInternals_Control internals_Control;
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Protected construction.
|
||||
@@ -58,6 +60,7 @@ namespace Sarand.BusinessMgr.Net.Core.Web.Components
|
||||
{
|
||||
if (disposing)
|
||||
{
|
||||
if (internals_Control != null) internals_Control.Dispose(); internals_Control = null;
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
@@ -65,6 +68,11 @@ namespace Sarand.BusinessMgr.Net.Core.Web.Components
|
||||
//-------------------------------------------------------------------
|
||||
// Properties.
|
||||
protected override SbmSessionContext SessionContext { get { return SessionData?.SessionContext ?? null; } }
|
||||
// Control database.
|
||||
protected SbmInternals_Control Internals_Control { get { if (internals_Control == null) { internals_Control = new SbmInternals_Control(); } return internals_Control; } }
|
||||
protected SbmcAccountMgr ControlAccountMgr { get { return Internals_Control.ControlAccountMgr; } }
|
||||
protected SbmcInstanceMgr ControlInstanceMgr { get { return Internals_Control.ControlInstanceMgr; } }
|
||||
protected SbmcItemMgr ControlItemMgr { get { return Internals_Control.ControlItemMgr; } }
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Action execution events.
|
||||
@@ -134,7 +142,7 @@ namespace Sarand.BusinessMgr.Net.Core.Web.Components
|
||||
// Online encryption parameters.
|
||||
//-------------------------------------------------------------------
|
||||
// Portal Request Password encryption parameters (key & IV) are defined in
|
||||
// the base Controller so that they can be shared with the Admin application.
|
||||
// the base Controller so that they can be shared with the Control application.
|
||||
// NB IV value is generated from the key and fixed so that it doesn't change when the application restarts.
|
||||
// IV Must be regenerated if key is changed.
|
||||
protected static string Base64Key_RequestPassword_Portal { get; } = SacsEncryptionHelper.EncodePlainKey("[5Abus1neSSmGR~Request#Password}", SacsEncryptionHelper.KeyLength);
|
||||
|
||||
@@ -61,6 +61,7 @@ namespace Sarand.BusinessMgr.Net.Core.Web.Components
|
||||
protected SbmSessionContext SessionContext { get { return SessionData_Web?.SessionContext ?? null; } }
|
||||
protected DbUpdateInfo DbUpdateInfo { get { return SessionData_Web?.DbUpdateInfo ?? new DbUpdateInfo(null, "", Sarand.Net.Standard.Base.App.SacsSystem.ComputerName); } }
|
||||
protected SbmLocaliser Localiser { get; }
|
||||
protected virtual SbmInstanceSchemaConsole InstanceSchemaConsole { get; } = null;
|
||||
// Request properties.
|
||||
protected SbmController_Web Controller { get; private set; }
|
||||
internal void SetController(SbmController_Web controller) { Controller = controller; }
|
||||
@@ -88,14 +89,16 @@ namespace Sarand.BusinessMgr.Net.Core.Web.Components
|
||||
public int PasswordMaxLength { get; } = 32;
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Control max lengths - based on database tabke column length.
|
||||
|
||||
/// <summary>
|
||||
/// Form control value max length - Security tables.
|
||||
/// <para>In many cases the database columns allow plenty of extra space for the value, in case they need to be encrypted.</para>
|
||||
/// <para>Hence, several cases where the value entered in the control isn't allowed the full database length.</para>
|
||||
/// </summary>
|
||||
public int GetControlMaxLength(SaSecurityDbDfn.ColumnIdx column)
|
||||
public virtual int GetControlMaxLength(SaSecurityDbDfn.ColumnIdx column)
|
||||
{
|
||||
int maxLength = (int)SaSecurityDbDfn.GetColTextLen(column);
|
||||
int maxLength = (int)(InstanceSchemaConsole?.GetColTextLen(column) ?? SaSecurityDbDfn.GetColTextLen(column));
|
||||
switch (column)
|
||||
{
|
||||
case SaSecurityDbDfn.ColumnIdx.SaSecItem_EmailAddress:
|
||||
@@ -105,13 +108,13 @@ namespace Sarand.BusinessMgr.Net.Core.Web.Components
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Form control value max length - code type tables.
|
||||
/// Form control value max length - Code Type tables.
|
||||
/// <para>In many cases the database columns allow plenty of extra space for the value, in case they need to be encrypted.</para>
|
||||
/// <para>Hence, several cases where the value entered in the control isn't allowed the full database length.</para>
|
||||
/// </summary>
|
||||
public int GetControlMaxLength(SaCodeTypeDbDfn.ColumnIdx column)
|
||||
public virtual int GetControlMaxLength(SaCodeTypeDbDfn.ColumnIdx column)
|
||||
{
|
||||
int maxLength = (int)SaCodeTypeDbDfn.GetColTextLen(column);
|
||||
int maxLength = (int)(InstanceSchemaConsole?.GetColTextLen(column) ?? SaCodeTypeDbDfn.GetColTextLen(column));
|
||||
switch (column)
|
||||
{
|
||||
case SaCodeTypeDbDfn.ColumnIdx.SaCodeType_Name:
|
||||
@@ -121,14 +124,31 @@ namespace Sarand.BusinessMgr.Net.Core.Web.Components
|
||||
return maxLength;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Form control value max length - Item Option tables.
|
||||
/// <para>In many cases the database columns allow plenty of extra space for the value, in case they need to be encrypted.</para>
|
||||
/// <para>Hence, several cases where the value entered in the control isn't allowed the full database length.</para>
|
||||
/// </summary>
|
||||
public virtual int GetControlMaxLength(SaItemOptionDbDfn.ColumnIdx column)
|
||||
{
|
||||
int maxLength = (int)(InstanceSchemaConsole?.GetColTextLen(column) ?? SaItemOptionDbDfn.GetColTextLen(column));
|
||||
switch (column)
|
||||
{
|
||||
case SaItemOptionDbDfn.ColumnIdx.SaItemOption_Name:
|
||||
case SaItemOptionDbDfn.ColumnIdx.SaItemOption_Context:
|
||||
return Math.Min(maxLength, 100);
|
||||
}
|
||||
return maxLength;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Form control value max length - BusinessMgr tables.
|
||||
/// <para>In many cases the database columns allow plenty of extra space for the value, in case they need to be encrypted.</para>
|
||||
/// <para>Hence, several cases where the value entered in the control isn't allowed the full database length.</para>
|
||||
/// </summary>
|
||||
public int GetControlMaxLength(SbmDbDfn.ColumnIdx column)
|
||||
public virtual int GetControlMaxLength(SbmDbDfn.ColumnIdx column)
|
||||
{
|
||||
int maxLength = (int)SbmDbDfn.GetColTextLen(column);
|
||||
int maxLength = (int)(InstanceSchemaConsole?.GetColTextLen(column) ?? SbmDbDfn.GetColTextLen(column));
|
||||
switch (column)
|
||||
{
|
||||
case SbmDbDfn.ColumnIdx.Affiliate_Email:
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.App;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Consoles;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Core;
|
||||
using Sarand.BusinessMgr.Net.Standard.Dbas.Consoles;
|
||||
using Sarand.Net.Standard.Base.CodeTypes;
|
||||
@@ -14,7 +15,7 @@ namespace Sarand.BusinessMgr.Net.Core.Web.Consoles
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
public SbmCodeTypeConsole_Web(ISbmUserOrganisationContext userContext) : base(userContext)
|
||||
public SbmCodeTypeConsole_Web(SbmInternals internals) : base(internals)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ namespace Sarand.BusinessMgr.Net.Core.Web.Consoles
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
public SbmInterfaceConsole_Web(ISbmUserOrganisationContext userContext) : base(userContext)
|
||||
public SbmInterfaceConsole_Web(SbmInternals internals) : base(internals)
|
||||
{
|
||||
}
|
||||
protected override void Dispose(bool disposing)
|
||||
|
||||
@@ -20,7 +20,7 @@ namespace Sarand.BusinessMgr.Net.Core.Web.Consoles
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
public SbmItemOptionConsole_Web(ISbmUserOrganisationContext userContext) : base(userContext)
|
||||
public SbmItemOptionConsole_Web(SbmInternals internals) : base(internals)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace Sarand.BusinessMgr.Net.Core.Web.Consoles
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
public SbmSecurityConsole_Web(ISbmUserOrganisationContext userContext) : base(userContext)
|
||||
public SbmSecurityConsole_Web(SbmInternals internals) : base(internals)
|
||||
{
|
||||
}
|
||||
protected override void Dispose(bool disposing)
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace Sarand.BusinessMgr.Net.Core.Web.Consoles
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
public SbmUpdateLogConsole_Web(ISbmUserOrganisationContext userContext) : base(userContext)
|
||||
public SbmUpdateLogConsole_Web(SbmInternals internals) : base(internals)
|
||||
{
|
||||
}
|
||||
protected override void Dispose(bool disposing)
|
||||
|
||||
@@ -84,7 +84,7 @@ namespace Sarand.BusinessMgr.Net.Core.Web.Middleware
|
||||
|
||||
// Email addresses must be lowercase to ensure match to encrypted data.
|
||||
if (modelName.EqualsCI("EmailAddress") || modelName.EqualsCI("AccountEmailAddress"))
|
||||
value = value.ToLower();
|
||||
value = value.ToLowerInvariant();
|
||||
|
||||
// Uppercase selected values.
|
||||
if (modelName.EqualsCI("Postcode") || modelName.EqualsCI("AccountPostcode") || modelName.EqualsCI("RegisteredAddressPostcode"))
|
||||
|
||||
@@ -43,7 +43,9 @@ namespace Sarand.BusinessMgr.Net.Core.Web.Middleware
|
||||
{
|
||||
// Log action.
|
||||
//String rawTarget = context.Features.Get<IHttpRequestFeature>().RawTarget;
|
||||
if (SbmSystem.DebugMode) SaLogger.Debug($"{SysUtil.Fn} Action: '" + Regex.Replace(context.Request.Path.ToString(), "^/", "") + "'. Method: " + context.Request.Method);
|
||||
HashSet<String> pathsToIgnore = new HashSet<string>(StringComparer.InvariantCultureIgnoreCase) { "/Security/Ajax/ScorePassword" };
|
||||
if (SbmSystem.DebugMode && !pathsToIgnore.Contains($"{context.Request.Path}"))
|
||||
SaLogger.Debug($"{SysUtil.Fn} Action: '{Regex.Replace($"{context.Request.Path}", "^/", "")}'. Method: {context.Request.Method}.");
|
||||
|
||||
// Intercept POST requests and apply anti-forgery test.
|
||||
if (HttpMethods.IsPost(context.Request.Method))
|
||||
|
||||
Reference in New Issue
Block a user