3.0.0.1 Demo repository registration
This commit is contained in:
@@ -34,8 +34,8 @@ namespace Sarand.BusinessMgr.Web.Control.Models.Instance
|
||||
UserFirstName,
|
||||
UserLastName,
|
||||
UserEmail,
|
||||
UserCode,
|
||||
UserPassword,
|
||||
UserPasswordConfirm,
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -89,8 +89,8 @@ namespace Sarand.BusinessMgr.Web.Control.Models.Instance
|
||||
public String FirstName { get; set; }
|
||||
public String LastName { get; set; }
|
||||
public String Email { get; set; }
|
||||
public String Code { get; set; }
|
||||
public String Password { get; set; }
|
||||
public String PasswordConfirm { get; set; }
|
||||
public String PasswordSet { get; set; }
|
||||
}
|
||||
public UserData User { get; } = new UserData();
|
||||
@@ -139,7 +139,7 @@ namespace Sarand.BusinessMgr.Web.Control.Models.Instance
|
||||
else
|
||||
{
|
||||
// Check that organisation name is not already in use.
|
||||
if (instanceConsole.Internals_Core.AccountMgr.OrganisationExistsByName(Organisation.Name, GetOrganisationAffiliateId()))
|
||||
if (instanceConsole.Internals.AccountMgr.OrganisationExistsByName(Organisation.Name, GetOrganisationAffiliateId()))
|
||||
responseData.SetControlError(controlName, Localiser["msg.validation.duplicate.value"]);
|
||||
}
|
||||
}
|
||||
@@ -198,30 +198,30 @@ namespace Sarand.BusinessMgr.Web.Control.Models.Instance
|
||||
if (User.Email != null)
|
||||
{
|
||||
String controlName = GetControlName(Control.UserEmail);
|
||||
User.Email = User.Email.ToLowerInvariant();
|
||||
responseData.SetControlValue(controlName, User.Email);
|
||||
if (StringUtil.IsBlank(User.Email))
|
||||
responseData.SetControlError(controlName, Localiser["msg.validation.mandatory.value"]);
|
||||
else if (StringUtil.GetLength(User.Email) > GetControlMaxLength(SbmDbDfn.ColumnIdx.Affiliate_Email))
|
||||
else if (!SacsDataValidationHelper.IsValidEmailAddress(User.Email))
|
||||
responseData.SetControlError(controlName, Localiser["msg.validation.invalid.value"]);
|
||||
// Email address must fit in both the Security Item Email and Code fields.
|
||||
else if (StringUtil.GetLength(User.Email) > GetControlMaxLength(SaSecurityDbDfn.ColumnIdx.SaSecItem_EmailAddress) || StringUtil.GetLength(User.Email) > GetControlMaxLength(SaSecurityDbDfn.ColumnIdx.SaSecItem_Code))
|
||||
responseData.SetControlError(controlName, Localiser["msg.validation.maximum.length", GetControlMaxLength(SbmDbDfn.ColumnIdx.Affiliate_Email)]);
|
||||
}
|
||||
|
||||
// User Code.
|
||||
if (User.Code != null)
|
||||
{
|
||||
String controlName = GetControlName(Control.UserCode);
|
||||
responseData.SetControlValue(controlName, User.Code);
|
||||
if (StringUtil.IsBlank(User.Code))
|
||||
responseData.SetControlError(controlName, Localiser["msg.validation.mandatory.value"]);
|
||||
else if (StringUtil.GetLength(User.Code) > GetControlMaxLength(SaSecurityDbDfn.ColumnIdx.SaSecItem_Code))
|
||||
responseData.SetControlError(controlName, Localiser["msg.validation.maximum.length", GetControlMaxLength(SaSecurityDbDfn.ColumnIdx.SaSecItem_Code)]);
|
||||
else
|
||||
{
|
||||
// Ensure that user name is not already in use.
|
||||
SysId securityItemId = instanceConsole.Internals_Core.SecurityConsole.GetIdForItemCode(SaSecurity.ItemType.User, User.Code);
|
||||
// Ensure that Email is not already in use as a User Code.
|
||||
SysId securityItemId = instanceConsole.Internals.SecurityConsole.GetIdForItemCode(SaSecurity.ItemType.User, User.Email);
|
||||
if (SysId.IsValid(securityItemId) && !securityItemId.Equals(GetUserSecurityItemId()))
|
||||
{
|
||||
responseData.SetControlError(controlName, Localiser["msg.validation.duplicate.value"]);
|
||||
|
||||
}
|
||||
// Ensure that Email is not already in use as a User Email.
|
||||
SaSecurityItem.Params prmSecurityItem = new SaSecurityItem.Params();
|
||||
prmSecurityItem.IdsExcluded.AddId(GetUserSecurityItemId());
|
||||
prmSecurityItem.SecurityItemType = SaSecurity.ItemType.User;
|
||||
prmSecurityItem.EmailAddress = User.Email;
|
||||
prmSecurityItem.StatusCat = SaSecurityItem.StatusCat.Any;
|
||||
if (instanceConsole.Internals.SecurityConsole.GetSecurityItemCount(prmSecurityItem) > 0)
|
||||
responseData.SetControlError(controlName, Localiser["msg.validation.duplicate.value"]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -229,7 +229,6 @@ namespace Sarand.BusinessMgr.Web.Control.Models.Instance
|
||||
if (User.Password != null && (StringUtil.ToBool(User.PasswordSet) || !StringUtil.ToBool(User.Exists)))
|
||||
{
|
||||
String controlName = GetControlName(Control.UserPassword);
|
||||
responseData.SetControlValue(controlName, User.Password);
|
||||
if (StringUtil.IsBlank(User.Password))
|
||||
responseData.SetControlError(controlName, Localiser["msg.validation.mandatory.value"]);
|
||||
else if (StringUtil.GetLength(User.Password) < Sbm.Config.Security.Password.MinLength)
|
||||
@@ -238,6 +237,14 @@ namespace Sarand.BusinessMgr.Web.Control.Models.Instance
|
||||
responseData.SetControlError(controlName, Localiser["msg.validation.maximum.length", Sbm.Config.Security.Password.MaxLength]);
|
||||
}
|
||||
|
||||
// User Password.
|
||||
if (User.PasswordConfirm != null && User.Password != null && (StringUtil.ToBool(User.PasswordSet) || !StringUtil.ToBool(User.Exists)))
|
||||
{
|
||||
String controlName = GetControlName(Control.UserPasswordConfirm);
|
||||
if (!User.PasswordConfirm.Equals(User.Password))
|
||||
responseData.SetControlError(controlName, Localiser["msg.validation.invalid.value"]);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
using Microsoft.AspNetCore.Mvc.Rendering;
|
||||
using Sarand.BusinessMgr.Net.Core.Web.App;
|
||||
using Sarand.BusinessMgr.Web.Control.Components;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
using Sarand.Net.Standard.Base.App;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace Sarand.BusinessMgr.Web.Control.Models.System
|
||||
{
|
||||
//=======================================================================
|
||||
public class Model_System : SbmModel_Control
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
public Model_System(SbmLocaliser localiser) :
|
||||
base(localiser)
|
||||
{
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Properties.
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Database page properties.
|
||||
public class DatabaseFilterData
|
||||
{
|
||||
public String Instance { get; set; }
|
||||
public String Search { get; set; }
|
||||
}
|
||||
public DatabaseFilterData DatabaseFilter { get; } = new DatabaseFilterData();
|
||||
public class DatabaseTableData
|
||||
{
|
||||
public String Instance { get; set; }
|
||||
public String Name { get; set; }
|
||||
}
|
||||
public DatabaseTableData DatabaseTable { get; } = new DatabaseTableData();
|
||||
|
||||
public IEnumerable<SelectListItem> GetDatabases()
|
||||
{
|
||||
List<CodeDesc> items = new List<CodeDesc>();
|
||||
if (ValidUserSession)
|
||||
{
|
||||
items.Add("Core", Localiser["label.core"]);
|
||||
items.Add("Reference", Localiser["label.reference"]);
|
||||
items.Add("Support", Localiser["label.support"]);
|
||||
}
|
||||
return new SelectList(items, "Code", "Desc");
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Logs page properties.
|
||||
public String LoggingRootFolder { get; } = Regex.Replace(SaLogger.LogFolder, "[\\\\/]Admin$", "");
|
||||
// Log file filter.
|
||||
public class LogsFilterData
|
||||
{
|
||||
public String Folder { get; set; }
|
||||
public String Year { get; set; }
|
||||
public String Month { get; set; }
|
||||
public String Filename { get; set; }
|
||||
}
|
||||
public LogsFilterData LogsFilter { get; } = new LogsFilterData();
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
}
|
||||
Reference in New Issue
Block a user