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"]);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user