organization password settings added (without GPO)

This commit is contained in:
vfedosevich 2015-04-06 07:09:53 -07:00
parent e320b4c79e
commit 60214cdcf1
40 changed files with 2351 additions and 152 deletions

View file

@ -9685,3 +9685,64 @@ SELECT
FROM AccessTokens
Where AccessTokenGuid = @AccessToken AND ExpirationDate > getdate() AND TokenType = @TokenType
GO
-- ORGANIZATION SETTINGS
IF EXISTS (SELECT * FROM SYS.TABLES WHERE name = 'ExchangeOrganizationSettings')
DROP TABLE ExchangeOrganizationSettings
GO
CREATE TABLE ExchangeOrganizationSettings
(
ItemId INT NOT NULL,
SettingsName nvarchar(100) NOT NULL,
Xml nvarchar(max) NOT NULL
)
GO
ALTER TABLE [dbo].[ExchangeOrganizationSettings] WITH CHECK ADD CONSTRAINT [FK_ExchangeOrganizationSettings_ExchangeOrganizations_ItemId] FOREIGN KEY([ItemId])
REFERENCES [dbo].[ExchangeOrganizations] ([ItemId])
ON DELETE CASCADE
GO
IF EXISTS (SELECT * FROM SYS.OBJECTS WHERE type = 'P' AND name = 'UpdateExchangeOrganizationSettings')
DROP PROCEDURE UpdateExchangeOrganizationSettings
GO
CREATE PROCEDURE [dbo].[UpdateExchangeOrganizationSettings]
(
@ItemId INT ,
@SettingsName nvarchar(100) ,
@Xml nvarchar(max)
)
AS
IF NOT EXISTS (SELECT * FROM [dbo].[ExchangeOrganizationSettings] WHERE [ItemId] = @ItemId AND [SettingsName]= @SettingsName )
BEGIN
INSERT [dbo].[ExchangeOrganizationSettings] ([ItemId], [SettingsName], [Xml]) VALUES (@ItemId, @SettingsName, @Xml)
END
ELSE
UPDATE [dbo].[ExchangeOrganizationSettings] SET [Xml] = @Xml WHERE [ItemId] = @ItemId AND [SettingsName]= @SettingsName
GO
IF EXISTS (SELECT * FROM SYS.OBJECTS WHERE type = 'P' AND name = 'GetExchangeOrganizationSettings')
DROP PROCEDURE GetExchangeOrganizationSettings
GO
CREATE PROCEDURE [dbo].[GetExchangeOrganizationSettings]
(
@ItemId INT ,
@SettingsName nvarchar(100)
)
AS
SELECT
ItemId,
SettingsName,
Xml
FROM ExchangeOrganizationSettings
Where ItemId = @ItemId AND SettingsName = @SettingsName
GO

View file

@ -66,6 +66,7 @@ namespace WebsitePanel.EnterpriseServer
public const string RDS_SETUP_LETTER = "RDSSetupLetter";
public const string RDS_POLICY = "RdsPolicy";
public const string USER_PASSWORD_EXPIRATION_LETTER = "UserPasswordExpirationLetter";
public const string HOSTED_ORGANIZATION_PASSWORD_POLICY = "MailboxPasswordPolicy";
public int UserId;

View file

@ -12,11 +12,11 @@
// This source code was auto-generated by wsdl, Version=2.0.50727.3038.
//
using WebsitePanel.EnterpriseServer.Base.HostedSolution;
using WebsitePanel.Providers;
using WebsitePanel.Providers.Common;
using WebsitePanel.Providers.ResultObjects;
using WebsitePanel.Providers.HostedSolution;
using WebsitePanel.EnterpriseServer.Base.HostedSolution;
using WebsitePanel.Providers.ResultObjects;
namespace WebsitePanel.EnterpriseServer.HostedSolution {
using System.Xml.Serialization;
@ -36,6 +36,10 @@ namespace WebsitePanel.EnterpriseServer.HostedSolution {
[System.Xml.Serialization.XmlIncludeAttribute(typeof(ServiceProviderItem))]
public partial class esOrganizations : Microsoft.Web.Services3.WebServicesClientProtocol {
private System.Threading.SendOrPostCallback UpdateOrganizationPasswordSettingsOperationCompleted;
private System.Threading.SendOrPostCallback GetOrganizationPasswordSettingsOperationCompleted;
private System.Threading.SendOrPostCallback CheckOrgIdExistsOperationCompleted;
private System.Threading.SendOrPostCallback CreateOrganizationOperationCompleted;
@ -145,6 +149,12 @@ namespace WebsitePanel.EnterpriseServer.HostedSolution {
this.Url = "http://localhost:9002/esOrganizations.asmx";
}
/// <remarks/>
public event UpdateOrganizationPasswordSettingsCompletedEventHandler UpdateOrganizationPasswordSettingsCompleted;
/// <remarks/>
public event GetOrganizationPasswordSettingsCompletedEventHandler GetOrganizationPasswordSettingsCompleted;
/// <remarks/>
public event CheckOrgIdExistsCompletedEventHandler CheckOrgIdExistsCompleted;
@ -301,6 +311,89 @@ namespace WebsitePanel.EnterpriseServer.HostedSolution {
/// <remarks/>
public event GetSupportServiceLevelCompletedEventHandler GetSupportServiceLevelCompleted;
/// <remarks/>
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://tempuri.org/UpdateOrganizationPasswordSettings", RequestNamespace="http://tempuri.org/", ResponseNamespace="http://tempuri.org/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
public void UpdateOrganizationPasswordSettings(int itemId, OrganizationPasswordSettings settings) {
this.Invoke("UpdateOrganizationPasswordSettings", new object[] {
itemId,
settings});
}
/// <remarks/>
public System.IAsyncResult BeginUpdateOrganizationPasswordSettings(int itemId, OrganizationPasswordSettings settings, System.AsyncCallback callback, object asyncState) {
return this.BeginInvoke("UpdateOrganizationPasswordSettings", new object[] {
itemId,
settings}, callback, asyncState);
}
/// <remarks/>
public void EndUpdateOrganizationPasswordSettings(System.IAsyncResult asyncResult) {
this.EndInvoke(asyncResult);
}
/// <remarks/>
public void UpdateOrganizationPasswordSettingsAsync(int itemId, OrganizationPasswordSettings settings) {
this.UpdateOrganizationPasswordSettingsAsync(itemId, settings, null);
}
/// <remarks/>
public void UpdateOrganizationPasswordSettingsAsync(int itemId, OrganizationPasswordSettings settings, object userState) {
if ((this.UpdateOrganizationPasswordSettingsOperationCompleted == null)) {
this.UpdateOrganizationPasswordSettingsOperationCompleted = new System.Threading.SendOrPostCallback(this.OnUpdateOrganizationPasswordSettingsOperationCompleted);
}
this.InvokeAsync("UpdateOrganizationPasswordSettings", new object[] {
itemId,
settings}, this.UpdateOrganizationPasswordSettingsOperationCompleted, userState);
}
private void OnUpdateOrganizationPasswordSettingsOperationCompleted(object arg) {
if ((this.UpdateOrganizationPasswordSettingsCompleted != null)) {
System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
this.UpdateOrganizationPasswordSettingsCompleted(this, new System.ComponentModel.AsyncCompletedEventArgs(invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
}
}
/// <remarks/>
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://tempuri.org/GetOrganizationPasswordSettings", RequestNamespace="http://tempuri.org/", ResponseNamespace="http://tempuri.org/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
public OrganizationPasswordSettings GetOrganizationPasswordSettings(int itemId) {
object[] results = this.Invoke("GetOrganizationPasswordSettings", new object[] {
itemId});
return ((OrganizationPasswordSettings)(results[0]));
}
/// <remarks/>
public System.IAsyncResult BeginGetOrganizationPasswordSettings(int itemId, System.AsyncCallback callback, object asyncState) {
return this.BeginInvoke("GetOrganizationPasswordSettings", new object[] {
itemId}, callback, asyncState);
}
/// <remarks/>
public OrganizationPasswordSettings EndGetOrganizationPasswordSettings(System.IAsyncResult asyncResult) {
object[] results = this.EndInvoke(asyncResult);
return ((OrganizationPasswordSettings)(results[0]));
}
/// <remarks/>
public void GetOrganizationPasswordSettingsAsync(int itemId) {
this.GetOrganizationPasswordSettingsAsync(itemId, null);
}
/// <remarks/>
public void GetOrganizationPasswordSettingsAsync(int itemId, object userState) {
if ((this.GetOrganizationPasswordSettingsOperationCompleted == null)) {
this.GetOrganizationPasswordSettingsOperationCompleted = new System.Threading.SendOrPostCallback(this.OnGetOrganizationPasswordSettingsOperationCompleted);
}
this.InvokeAsync("GetOrganizationPasswordSettings", new object[] {
itemId}, this.GetOrganizationPasswordSettingsOperationCompleted, userState);
}
private void OnGetOrganizationPasswordSettingsOperationCompleted(object arg) {
if ((this.GetOrganizationPasswordSettingsCompleted != null)) {
System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
this.GetOrganizationPasswordSettingsCompleted(this, new GetOrganizationPasswordSettingsCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
}
}
/// <remarks/>
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://tempuri.org/CheckOrgIdExists", RequestNamespace="http://tempuri.org/", ResponseNamespace="http://tempuri.org/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
public bool CheckOrgIdExists(string orgId) {
@ -2936,6 +3029,36 @@ namespace WebsitePanel.EnterpriseServer.HostedSolution {
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
public delegate void UpdateOrganizationPasswordSettingsCompletedEventHandler(object sender, System.ComponentModel.AsyncCompletedEventArgs e);
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
public delegate void GetOrganizationPasswordSettingsCompletedEventHandler(object sender, GetOrganizationPasswordSettingsCompletedEventArgs e);
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
public partial class GetOrganizationPasswordSettingsCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
private object[] results;
internal GetOrganizationPasswordSettingsCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) :
base(exception, cancelled, userState) {
this.results = results;
}
/// <remarks/>
public OrganizationPasswordSettings Result {
get {
this.RaiseExceptionIfNecessary();
return ((OrganizationPasswordSettings)(this.results[0]));
}
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
public delegate void CheckOrgIdExistsCompletedEventHandler(object sender, CheckOrgIdExistsCompletedEventArgs e);

View file

@ -27,11 +27,13 @@
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
using System;
using System.IO;
using System.Reflection;
using System.Data;
using System.Collections;
using System.Collections.Generic;
using System.Xml;
using System.Xml.Serialization;
using WebsitePanel.Providers;
namespace WebsitePanel.EnterpriseServer
@ -645,6 +647,37 @@ namespace WebsitePanel.EnterpriseServer
return type.FullName + ", " + type.Assembly.GetName().Name;
}
public static TResult Deserialize<TResult>(string inputString)
{
TResult result;
var serializer = new XmlSerializer(typeof(TResult));
using (TextReader reader = new StringReader(inputString))
{
result = (TResult)serializer.Deserialize(reader);
}
return result;
}
public static string Serialize<TEntity>(TEntity entity)
{
string result = string.Empty;
var xmlSerializer = new XmlSerializer(typeof(TEntity));
using (var stringWriter = new StringWriter())
{
using (XmlWriter writer = XmlWriter.Create(stringWriter))
{
xmlSerializer.Serialize(writer, entity);
result = stringWriter.ToString();
}
}
return result;
}
#region Helper Functions

View file

@ -3236,6 +3236,23 @@ namespace WebsitePanel.EnterpriseServer
);
}
public static void UpdateOrganizationSettings(int itemId, string settingsName, string xml)
{
SqlHelper.ExecuteNonQuery(ConnectionString, CommandType.StoredProcedure,
ObjectQualifier + "UpdateExchangeOrganizationSettings",
new SqlParameter("@ItemId", itemId),
new SqlParameter("@SettingsName", settingsName),
new SqlParameter("@Xml", xml));
}
public static IDataReader GetOrganizationSettings(int itemId, string settingsName)
{
return SqlHelper.ExecuteReader(ConnectionString, CommandType.StoredProcedure,
ObjectQualifier + "GetExchangeOrganizationSettings",
new SqlParameter("@ItemId", itemId),
new SqlParameter("@SettingsName", settingsName));
}
public static int AddOrganizationDeletedUser(int accountId, int originAT, string storagePath, string folderName, string fileName, DateTime expirationDate)
{
SqlParameter outParam = new SqlParameter("@ID", SqlDbType.Int);

View file

@ -1647,6 +1647,56 @@ namespace WebsitePanel.EnterpriseServer
return token;
}
public static void UpdateOrganizationPasswordSettings(int itemId, OrganizationPasswordSettings settings)
{
TaskManager.StartTask("ORGANIZATION", "UPDATE_PASSWORD_SETTINGS");
try
{
// load organization
Organization org = GetOrganization(itemId);
if (org == null)
{
TaskManager.WriteWarning("Organization with itemId '{0}' not found", itemId.ToString());
return;
}
Organizations orgProxy = GetOrganizationProxy(org.ServiceId);
orgProxy.ApplyPasswordSettings(org.OrganizationId, settings);
var xml = ObjectUtils.Serialize(settings);
DataProvider.UpdateOrganizationSettings(itemId, OrganizationSettings.PasswordSettings, xml);
}
catch (Exception ex)
{
throw TaskManager.WriteError(ex);
}
finally
{
TaskManager.CompleteTask();
}
}
public static OrganizationPasswordSettings GetOrganizationPasswordSettings(int itemId)
{
return GetOrganizationSettings<OrganizationPasswordSettings>(itemId, OrganizationSettings.PasswordSettings);
}
private static T GetOrganizationSettings<T>(int itemId, string settingsName)
{
var entity = ObjectUtils.FillObjectFromDataReader<OrganizationSettingsEntity>(DataProvider.GetOrganizationSettings(itemId, settingsName));
if (entity == null)
{
return default(T);
}
return ObjectUtils.Deserialize<T>(entity.Xml);
}
private static bool EmailAddressExists(string emailAddress)
{
return DataProvider.ExchangeAccountEmailAddressExists(emailAddress);

View file

@ -47,6 +47,18 @@ namespace WebsitePanel.EnterpriseServer
{
#region Organizations
[WebMethod]
public void UpdateOrganizationPasswordSettings(int itemId, OrganizationPasswordSettings settings)
{
OrganizationController.UpdateOrganizationPasswordSettings(itemId, settings);
}
[WebMethod]
public OrganizationPasswordSettings GetOrganizationPasswordSettings(int itemId)
{
return OrganizationController.GetOrganizationPasswordSettings(itemId);
}
[WebMethod]
public bool CheckOrgIdExists(string orgId)
{

View file

@ -99,5 +99,6 @@ namespace WebsitePanel.Providers.HostedSolution
void ChangeDriveMapFolderPath(string organizationId, string oldFolder, string newFolder);
List<OrganizationUser> GetOrganizationUsersWithExpiredPassword(string organizationId, int daysBeforeExpiration);
void ApplyPasswordSettings(string organizationId, OrganizationPasswordSettings passwordSettings);
}
}

View file

@ -0,0 +1,19 @@
namespace WebsitePanel.Providers.HostedSolution
{
public class OrganizationPasswordSettings
{
public int MinimumLength { get; set; }
public int MaximumLength { get; set; }
public int EnforcePasswordHistory { get; set; }
public bool LockoutSettingsEnabled { get; set; }
public int AccountLockoutDuration { get; set; }
public int AccountLockoutThreshold { get; set; }
public int ResetAccountLockoutCounterAfter { get; set; }
public bool PasswordComplexityEnabled { get; set; }
public int UppercaseLettersCount { get; set; }
public int NumbersCount { get; set; }
public int SymbolsCount { get; set; }
}
}

View file

@ -0,0 +1,7 @@
namespace WebsitePanel.Providers.HostedSolution
{
public class OrganizationSettings
{
public const string PasswordSettings = "PasswordSettings";
}
}

View file

@ -0,0 +1,9 @@
namespace WebsitePanel.Providers.HostedSolution
{
public class OrganizationSettingsEntity
{
public int ItemId { get; set; }
public string SettingsName { get; set; }
public string Xml { get; set; }
}
}

View file

@ -119,9 +119,12 @@
<Compile Include="HostedSolution\LyncUserPlanType.cs" />
<Compile Include="HostedSolution\LyncUsersPaged.cs" />
<Compile Include="HostedSolution\LyncVoicePolicyType.cs" />
<Compile Include="HostedSolution\OrganizationPasswordSettings.cs" />
<Compile Include="HostedSolution\OrganizationSecurityGroup.cs" />
<Compile Include="HostedSolution\OrganizationDeletedUser.cs" />
<Compile Include="HostedSolution\OrganizationDeletedUsersPaged.cs" />
<Compile Include="HostedSolution\OrganizationSettings.cs" />
<Compile Include="HostedSolution\OrganizationSettingsEntity.cs" />
<Compile Include="HostedSolution\TransactionAction.cs" />
<Compile Include="OS\MappedDrivesPaged.cs" />
<Compile Include="OS\MappedDrive.cs" />

View file

@ -552,6 +552,114 @@ namespace WebsitePanel.Providers.HostedSolution
}
}
public void ApplyPasswordSettings(string organizationId, OrganizationPasswordSettings settings)
{
HostedSolutionLog.LogStart("ApplyPasswordPolicy");
Runspace runspace = null;
try
{
runspace = OpenRunspace();
var gpoId = CreatePolicyIfNotExist(runspace, organizationId, FormOrganizationSettingsGpoName(organizationId));
}
catch (Exception ex)
{
HostedSolutionLog.LogError(ex);
throw;
}
finally
{
CloseRunspace(runspace);
HostedSolutionLog.LogEnd("ApplyPasswordPolicy");
}
}
private string FormOrganizationSettingsGpoName(string organizationId)
{
return string.Format("{0}-settings", organizationId);
}
private string CreatePolicyIfNotExist(Runspace runspace, string organizationId, string gpoName)
{
string gpoId = GetPolicyId(runspace, gpoName);
if (string.IsNullOrEmpty(gpoId))
{
gpoId = CreateAndLinkPolicy(runspace, gpoName, organizationId);
}
return gpoId;
}
private void DeleteGpo(Runspace runspace, string gpoName)
{
Command cmd = new Command("Remove-GPO");
cmd.Parameters.Add("Name", gpoName);
// Collection<PSObject> result = ExecuteRemoteShellCommand(runspace, PrimaryDomainController, cmd);
}
private string CreateAndLinkPolicy(Runspace runspace, string gpoName, string organizationId)
{
string pathOU = GetOrganizationTargetPath(organizationId);
//create new gpo
Command cmd = new Command("New-GPO");
cmd.Parameters.Add("Name", gpoName);
Collection<PSObject> result = ExecuteShellCommand(runspace, cmd);
string gpoId = null;
if (result != null && result.Count > 0)
{
PSObject gpo = result[0];
//get gpo id
gpoId = ((Guid) GetPSObjectProperty(gpo, "Id")).ToString("B");
}
//create gpo link
cmd = new Command("New-GPLink");
cmd.Parameters.Add("Name", gpoName);
cmd.Parameters.Add("Target", pathOU);
ExecuteShellCommand(runspace, cmd);
return gpoId;
}
private string GetPolicyId(Runspace runspace, string gpoName)
{
Runspace runSpace = null;
string gpoId = null;
try
{
runSpace = OpenRunspace();
Command cmd = new Command("Get-GPO");
cmd.Parameters.Add("Name", gpoName);
Collection<PSObject> result = ExecuteShellCommand(runSpace, cmd);
if (result != null && result.Count > 0)
{
PSObject gpo = result[0];
gpoId = ((Guid)GetPSObjectProperty(gpo, "Id")).ToString("B");
}
}
finally
{
CloseRunspace(runSpace);
}
return gpoId;
}
public PasswordPolicyResult GetPasswordPolicy()
{
return GetPasswordPolicyInternal();

View file

@ -12,6 +12,7 @@
// This source code was auto-generated by wsdl, Version=2.0.50727.3038.
//
using WebsitePanel.Providers.Common;
using WebsitePanel.Providers.OS;
using WebsitePanel.Providers.ResultObjects;
@ -94,6 +95,8 @@ namespace WebsitePanel.Providers.HostedSolution {
private System.Threading.SendOrPostCallback GetOrganizationUsersWithExpiredPasswordOperationCompleted;
private System.Threading.SendOrPostCallback ApplyPasswordSettingsOperationCompleted;
/// <remarks/>
public Organizations() {
this.Url = "http://localhost:9003/Organizations.asmx";
@ -186,6 +189,9 @@ namespace WebsitePanel.Providers.HostedSolution {
/// <remarks/>
public event GetOrganizationUsersWithExpiredPasswordCompletedEventHandler GetOrganizationUsersWithExpiredPasswordCompleted;
/// <remarks/>
public event ApplyPasswordSettingsCompletedEventHandler ApplyPasswordSettingsCompleted;
/// <remarks/>
[System.Web.Services.Protocols.SoapHeaderAttribute("ServiceProviderSettingsSoapHeaderValue")]
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://tempuri.org/OrganizationExists", RequestNamespace="http://tempuri.org/", ResponseNamespace="http://tempuri.org/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
@ -1675,6 +1681,49 @@ namespace WebsitePanel.Providers.HostedSolution {
}
}
/// <remarks/>
[System.Web.Services.Protocols.SoapHeaderAttribute("ServiceProviderSettingsSoapHeaderValue")]
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://tempuri.org/ApplyPasswordSettings", RequestNamespace="http://tempuri.org/", ResponseNamespace="http://tempuri.org/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
public void ApplyPasswordSettings(string organizationId, OrganizationPasswordSettings passwordSettings) {
this.Invoke("ApplyPasswordSettings", new object[] {
organizationId,
passwordSettings});
}
/// <remarks/>
public System.IAsyncResult BeginApplyPasswordSettings(string organizationId, OrganizationPasswordSettings passwordSettings, System.AsyncCallback callback, object asyncState) {
return this.BeginInvoke("ApplyPasswordSettings", new object[] {
organizationId,
passwordSettings}, callback, asyncState);
}
/// <remarks/>
public void EndApplyPasswordSettings(System.IAsyncResult asyncResult) {
this.EndInvoke(asyncResult);
}
/// <remarks/>
public void ApplyPasswordSettingsAsync(string organizationId, OrganizationPasswordSettings passwordSettings) {
this.ApplyPasswordSettingsAsync(organizationId, passwordSettings, null);
}
/// <remarks/>
public void ApplyPasswordSettingsAsync(string organizationId, OrganizationPasswordSettings passwordSettings, object userState) {
if ((this.ApplyPasswordSettingsOperationCompleted == null)) {
this.ApplyPasswordSettingsOperationCompleted = new System.Threading.SendOrPostCallback(this.OnApplyPasswordSettingsOperationCompleted);
}
this.InvokeAsync("ApplyPasswordSettings", new object[] {
organizationId,
passwordSettings}, this.ApplyPasswordSettingsOperationCompleted, userState);
}
private void OnApplyPasswordSettingsOperationCompleted(object arg) {
if ((this.ApplyPasswordSettingsCompleted != null)) {
System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
this.ApplyPasswordSettingsCompleted(this, new System.ComponentModel.AsyncCompletedEventArgs(invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
}
}
/// <remarks/>
public new void CancelAsync(object userState) {
base.CancelAsync(userState);
@ -2060,4 +2109,8 @@ namespace WebsitePanel.Providers.HostedSolution {
}
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
public delegate void ApplyPasswordSettingsCompletedEventHandler(object sender, System.ComponentModel.AsyncCompletedEventArgs e);
}

View file

@ -261,5 +261,11 @@ namespace WebsitePanel.Server
{
return Organization.GetOrganizationUsersWithExpiredPassword(organizationId, daysBeforeExpiration);
}
[WebMethod, SoapHeader("settings")]
public void ApplyPasswordSettings(string organizationId, OrganizationPasswordSettings passwordSettings)
{
Organization.ApplyPasswordSettings(organizationId, passwordSettings);
}
}
}

View file

@ -476,6 +476,7 @@
<Control key="create_organization" src="WebsitePanel/ExchangeServer/OrganizationCreateOrganization.ascx" title="OrganizationCreateOrganization" type="View" />
<Control key="organization_home" src="WebsitePanel/ExchangeServer/OrganizationHome.ascx" title="OrganizationHome" type="View" />
<Control key="organization_user_setup" src="WebsitePanel/ExchangeServer/OrganizationUserSetupInstructions.ascx" title="OrganizationUserSetupInstructions" type="View" />
<Control key="organization_settings_password_settings" src="WebsitePanel/ExchangeServer/OrganizationSettingsPasswordSettings.ascx" title="OrganizationSettings" type="View" />
<Control key="mailboxes" src="WebsitePanel/ExchangeServer/ExchangeMailboxes.ascx" title="ExchangeMailboxes" type="View" />
<Control key="archivingmailboxes" src="WebsitePanel/ExchangeServer/ExchangeMailboxes.ascx" title="ExchangeArchivingMailboxes" type="View" />
<Control key="create_mailbox" src="WebsitePanel/ExchangeServer/ExchangeCreateMailbox.ascx" title="ExchangeCreateMailbox" type="View" />

View file

@ -5713,4 +5713,7 @@
<data name="SchedulerTask.SCHEDULE_TASK_USER_PASSWORD_EXPIRATION_NOTIFICATION" xml:space="preserve">
<value>User password expiration notification</value>
</data>
<data name="ERROR.ORANIZATIONSETTINGS_NOT_UPDATED" xml:space="preserve">
<value>Error during updating settings.</value>
</data>
</root>

View file

@ -237,4 +237,10 @@
<data name="lnkRdsUsers.Text" xml:space="preserve">
<value>RDS Users</value>
</data>
<data name="lnkEditOrganizationSettings.Text" xml:space="preserve">
<value>Edit</value>
</data>
<data name="OrganizationSettings.Text" xml:space="preserve">
<value>Organization settings</value>
</data>
</root>

View file

@ -0,0 +1,216 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="btnSave.Text" xml:space="preserve">
<value>Save Changes</value>
</data>
<data name="chkLockOutSettigns.Text" xml:space="preserve">
<value>Enable Lockout Settings</value>
</data>
<data name="chkPasswordComplexity" xml:space="preserve">
<value>Enable Password Complexity</value>
</data>
<data name="colPasswordSettings.Text" xml:space="preserve">
<value>Password settings</value>
</data>
<data name="lblAccountLockoutDuration.Text" xml:space="preserve">
<value>Account lockout duration:</value>
</data>
<data name="lblEnforcePasswordHistory.Text" xml:space="preserve">
<value>Enforce password history:</value>
</data>
<data name="lblLockedOut.Text" xml:space="preserve">
<value>Account lockout threshold:</value>
</data>
<data name="lblLockOutSettigns.Text" xml:space="preserve">
<value>Lock out settings:</value>
</data>
<data name="lblMaximumLength.Text" xml:space="preserve">
<value>Maximum length:</value>
</data>
<data name="lblMinimumLength.Text" xml:space="preserve">
<value>Minimum length:</value>
</data>
<data name="lblMinimumNumbers.Text" xml:space="preserve">
<value>Numbers:</value>
</data>
<data name="lblMinimumSymbols.Text" xml:space="preserve">
<value>Non-alphanumeric symbols:</value>
</data>
<data name="lblMinimumUppercase.Text" xml:space="preserve">
<value>Uppercase letters:</value>
</data>
<data name="lblResetAccountLockout.Text" xml:space="preserve">
<value>Reset account lockout counter after (minutes):</value>
</data>
<data name="lblShouldContain.Text" xml:space="preserve">
<value>Password should contain at least:</value>
</data>
<data name="locTitle.Text" xml:space="preserve">
<value>Edit settings</value>
</data>
<data name="valCorrectAccountLockoutDuration.Text" xml:space="preserve">
<value>*</value>
</data>
<data name="valCorrectEnforcePasswordHistory.Text" xml:space="preserve">
<value>*</value>
</data>
<data name="valCorrectLockedOut.Text" xml:space="preserve">
<value>*</value>
</data>
<data name="valCorrectMaxLength.Text" xml:space="preserve">
<value>*</value>
</data>
<data name="valCorrectMinLength.Text" xml:space="preserve">
<value>*</value>
</data>
<data name="valCorrectNumbers.Text" xml:space="preserve">
<value>*</value>
</data>
<data name="valCorrectSymbols.Text" xml:space="preserve">
<value>*</value>
</data>
<data name="valCorrectUppercase.Text" xml:space="preserve">
<value>*</value>
</data>
<data name="valRequireAccountLockoutDuration.Text" xml:space="preserve">
<value>*</value>
</data>
<data name="valRequireEnforcePasswordHistory.Text" xml:space="preserve">
<value>*</value>
</data>
<data name="valRequireMaxLength.Text" xml:space="preserve">
<value>*</value>
</data>
<data name="valRequireMinLength.Text" xml:space="preserve">
<value>*</value>
</data>
<data name="valRequireNumbers.Text" xml:space="preserve">
<value>*</value>
</data>
<data name="valRequireSymbols.Text" xml:space="preserve">
<value>*</value>
</data>
<data name="valRequireUppercase.Text" xml:space="preserve">
<value>*</value>
</data>
<data name="valResetAccountLockout.Text" xml:space="preserve">
<value>*</value>
</data>
</root>

View file

@ -49,23 +49,7 @@ namespace WebsitePanel.Portal.ExchangeServer
if (!IsPostBack)
{
password.SetPackagePolicy(PanelSecurity.PackageId, UserSettings.EXCHANGE_POLICY, "MailboxPasswordPolicy");
PasswordPolicyResult passwordPolicy = ES.Services.Organizations.GetPasswordPolicy(PanelRequest.ItemID);
if (passwordPolicy.IsSuccess)
{
password.MinimumLength = passwordPolicy.Value.MinLength;
if (passwordPolicy.Value.IsComplexityEnable)
{
password.MinimumNumbers = 1;
password.MinimumSymbols = 1;
password.MinimumUppercase = 1;
}
}
else
{
messageBox.ShowMessage(passwordPolicy, "EXCHANGE_CREATE_MAILBOX", "HostedOrganization");
return;
}
BindPasswordSettings();
string instructions = ES.Services.ExchangeServer.GetMailboxSetupInstructions(PanelRequest.ItemID, PanelRequest.AccountID, false, false, false);
if (!string.IsNullOrEmpty(instructions))
@ -135,6 +119,37 @@ namespace WebsitePanel.Portal.ExchangeServer
}
private void BindPasswordSettings()
{
var grainedPasswordSettigns = ES.Services.Organizations.GetOrganizationPasswordSettings(PanelRequest.ItemID);
if (grainedPasswordSettigns != null)
{
password.SetUserPolicy(grainedPasswordSettigns);
}
else
{
password.SetPackagePolicy(PanelSecurity.PackageId, UserSettings.EXCHANGE_POLICY, "MailboxPasswordPolicy");
PasswordPolicyResult passwordPolicy = ES.Services.Organizations.GetPasswordPolicy(PanelRequest.ItemID);
if (passwordPolicy.IsSuccess)
{
password.MinimumLength = passwordPolicy.Value.MinLength;
if (passwordPolicy.Value.IsComplexityEnable)
{
password.MinimumNumbers = 1;
password.MinimumSymbols = 1;
password.MinimumUppercase = 1;
}
}
else
{
messageBox.ShowMessage(passwordPolicy, "CREATE_ORGANIZATION_USER", "HostedOrganization");
}
}
}
protected void btnCreate_Click(object sender, EventArgs e)
{
CreateMailbox();

View file

@ -40,23 +40,7 @@ namespace WebsitePanel.Portal.HostedSolution
{
if (!IsPostBack)
{
password.SetPackagePolicy(PanelSecurity.PackageId, UserSettings.EXCHANGE_POLICY, "MailboxPasswordPolicy");
PasswordPolicyResult passwordPolicy = ES.Services.Organizations.GetPasswordPolicy(PanelRequest.ItemID);
if (passwordPolicy.IsSuccess)
{
password.MinimumLength = passwordPolicy.Value.MinLength;
if (passwordPolicy.Value.IsComplexityEnable)
{
password.MinimumNumbers = 1;
password.MinimumSymbols = 1;
password.MinimumUppercase = 1;
}
}
else
{
messageBox.ShowMessage(passwordPolicy, "CREATE_ORGANIZATION_USER", "HostedOrganization");
}
BindPasswordSettings();
string instructions = ES.Services.Organizations.GetOrganizationUserSummuryLetter(PanelRequest.ItemID, PanelRequest.AccountID, false, false, false);
if (!string.IsNullOrEmpty(instructions))
@ -88,6 +72,37 @@ namespace WebsitePanel.Portal.HostedSolution
}
private void BindPasswordSettings()
{
var grainedPasswordSettigns = ES.Services.Organizations.GetOrganizationPasswordSettings(PanelRequest.ItemID);
if (grainedPasswordSettigns != null)
{
password.SetUserPolicy(grainedPasswordSettigns);
}
else
{
password.SetPackagePolicy(PanelSecurity.PackageId, UserSettings.EXCHANGE_POLICY, "MailboxPasswordPolicy");
PasswordPolicyResult passwordPolicy = ES.Services.Organizations.GetPasswordPolicy(PanelRequest.ItemID);
if (passwordPolicy.IsSuccess)
{
password.MinimumLength = passwordPolicy.Value.MinLength;
if (passwordPolicy.Value.IsComplexityEnable)
{
password.MinimumNumbers = 1;
password.MinimumSymbols = 1;
password.MinimumUppercase = 1;
}
}
else
{
messageBox.ShowMessage(passwordPolicy, "CREATE_ORGANIZATION_USER", "HostedOrganization");
}
}
}
protected void btnCreate_Click(object sender, EventArgs e)
{
CreateMailbox();

View file

@ -37,6 +37,14 @@
<asp:Label runat="server" ID="lblCreatedValue" />
</td>
</tr>
<tr>
<td class="OrgStatsRow">
<asp:Label runat="server" meta:resourcekey="OrganizationSettings" ID="Label1" />
</td>
<td>
<asp:HyperLink ID="lnkEditOrganizationSettings" runat="server" meta:resourcekey="lnkEditOrganizationSettings"></asp:HyperLink>
</td>
</tr>
</table>
<br />
<table width="100%">

View file

@ -175,6 +175,9 @@ namespace WebsitePanel.Portal.ExchangeServer
lblOrganizationNameValue.Text = org.Name;
lblOrganizationIDValue.Text = org.OrganizationId;
lblCreatedValue.Text = org.CreatedDate.Date.ToShortDateString();
lnkEditOrganizationSettings.NavigateUrl = EditUrl("ItemID", PanelRequest.ItemID.ToString(), "organization_settings_password_settings",
"SpaceID=" + PanelSecurity.PackageId);
OrganizationStatistics orgStats = ES.Services.Organizations.GetOrganizationStatisticsByOrganization(PanelRequest.ItemID);
OrganizationStatistics tenantStats = ES.Services.Organizations.GetOrganizationStatistics(PanelRequest.ItemID);

View file

@ -84,6 +84,24 @@ namespace WebsitePanel.Portal.ExchangeServer {
/// </remarks>
protected global::System.Web.UI.WebControls.Label lblCreatedValue;
/// <summary>
/// Label1 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 Label1;
/// <summary>
/// lnkEditOrganizationSettings 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 lnkEditOrganizationSettings;
/// <summary>
/// organizationStatsPanel control.
/// </summary>

View file

@ -0,0 +1,164 @@
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="OrganizationSettingsPasswordSettings.ascx.cs" Inherits="WebsitePanel.Portal.ExchangeServer.OrganizationSettingsPasswordSettings" %>
<%@ Register Src="UserControls/OrganizationSettingsTabs.ascx" TagName="CollectionTabs" TagPrefix="wsp" %>
<%@ Register TagPrefix="wsp" TagName="CollapsiblePanel" Src="../UserControls/CollapsiblePanel.ascx" %>
<%@ Register Src="../UserControls/SimpleMessageBox.ascx" TagName="SimpleMessageBox" TagPrefix="wsp" %>
<%@ Register Src="../UserControls/ItemButtonPanel.ascx" TagName="ItemButtonPanel" TagPrefix="wsp" %>
<%@ Register Src="../UserControls/EnableAsyncTasksSupport.ascx" TagName="EnableAsyncTasksSupport" TagPrefix="wsp" %>
<script type="text/javascript" src="/JavaScript/jquery.min.js?v=1.4.4"></script>
<wsp:EnableAsyncTasksSupport id="asyncTasks" runat="server"/>
<div id="ExchangeContainer">
<div class="Module">
<div class="Left">
</div>
<div class="Content">
<div class="Center">
<div class="Title">
<asp:Image ID="Image1" SkinID="ExchangeList48" runat="server" />
<asp:Localize ID="locTitle" runat="server" meta:resourcekey="locTitle" Text="Edit Settings"></asp:Localize>
<asp:Literal ID="litOrganizationName" runat="server" Text="Organization" />
</div>
<div class="FormBody">
<wsp:CollectionTabs id="tabs" runat="server" SelectedTab="organization_settings_password_s
ettings" />
<wsp:SimpleMessageBox id="messageBox" runat="server" />
<asp:UpdatePanel runat="server" ID="PasswordPolicyPanel" UpdateMode="Conditional" ChildrenAsTriggers="true">
<ContentTemplate>
<wsp:CollapsiblePanel id="colPasswordSettings" runat="server" TargetControlID="panelPasswordSettings" meta:resourcekey="colPasswordSettings" Text="Password settings">
</wsp:CollapsiblePanel>
<asp:Panel runat="server" ID="panelPasswordSettings">
<table id="PolicyTable" runat="server" cellpadding="2">
<tr>
<td class="Normal" style="width:150px;"><asp:Label ID="lblMinimumLength" runat="server"
meta:resourcekey="lblMinimumLength" Text="Minimum length:"></asp:Label></td>
<td class="Normal">
<asp:TextBox ID="txtMinimumLength" runat="server" CssClass="NormalTextBox" Width="40px"></asp:TextBox>
<asp:RequiredFieldValidator ID="valRequireMinLength" runat="server" ControlToValidate="txtMinimumLength" meta:resourcekey="valRequireMinLength"
ErrorMessage="*" ValidationGroup="SettingsEditor" Display="Dynamic"></asp:RequiredFieldValidator>
<asp:RegularExpressionValidator ID="valCorrectMinLength" runat="server" ControlToValidate="txtMinimumLength" meta:resourcekey="valCorrectMinLength"
Display="Dynamic" ErrorMessage="*" ValidationExpression="\d{1,3}" ValidationGroup="SettingsEditor"></asp:RegularExpressionValidator></td>
</tr>
<tr>
<td class="Normal"><asp:Label ID="lblMaximumLength" runat="server"
meta:resourcekey="lblMaximumLength" Text="Maximum length:"></asp:Label></td>
<td class="Normal">
<asp:TextBox ID="txtMaximumLength" runat="server" CssClass="NormalTextBox" Width="40px"></asp:TextBox>
<asp:RequiredFieldValidator ID="valRequireMaxLength" runat="server" ControlToValidate="txtMaximumLength" meta:resourcekey="valRequireMaxLength"
ErrorMessage="*" ValidationGroup="SettingsEditor" Display="Dynamic"></asp:RequiredFieldValidator>
<asp:RegularExpressionValidator ID="valCorrectMaxLength" runat="server" ControlToValidate="txtMaximumLength" meta:resourcekey="valCorrectMaxLength"
Display="Dynamic" ErrorMessage="*" ValidationExpression="\d{1,3}" ValidationGroup="SettingsEditor"></asp:RegularExpressionValidator>
</td>
</tr>
<tr>
<td class="Normal" style="width:150px;"><asp:Label ID="lblEnforcePasswordHistory" runat="server"
meta:resourcekey="lblEnforcePasswordHistory" Text="Enforce Password History:"></asp:Label></td>
<td class="Normal">
<asp:TextBox ID="txtEnforcePasswordHistory" runat="server" CssClass="NormalTextBox" Width="40px"></asp:TextBox>
<asp:RequiredFieldValidator ID="valRequireEnforcePasswordHistory" runat="server" ControlToValidate="txtEnforcePasswordHistory" meta:resourcekey="valRequireEnforcePasswordHistory"
ErrorMessage="*" ValidationGroup="SettingsEditor" Display="Dynamic"></asp:RequiredFieldValidator>
<asp:RegularExpressionValidator ID="valCorrectEnforcePasswordHistory" runat="server" ControlToValidate="txtEnforcePasswordHistory" meta:resourcekey="valCorrectEnforcePasswordHistory"
Display="Dynamic" ErrorMessage="*" ValidationExpression="\d{1,3}" ValidationGroup="SettingsEditor"></asp:RegularExpressionValidator></td>
</tr>
<tr id="RowChkLockOutSettigns" runat="server">
<td colspan="2" class="NormalBold">
<asp:CheckBox id="chkLockOutSettigns" runat="server" meta:resourcekey="chkLockOutSettigns"
Text="Enable Lockout Settings" CssClass="NormalBold" AutoPostBack="true" OnCheckedChanged="chkLockOutSettigns_CheckedChanged" />
</td>
</tr>
<tr id="RowAccountLockoutDuration" runat="server">
<td class="Normal" style="width:150px;"><asp:Label ID="lblAccountLockoutDuration" runat="server"
meta:resourcekey="lblAccountLockoutDuration" Text="Account Lockout Duration:"></asp:Label></td>
<td class="Normal">
<asp:TextBox ID="txtAccountLockoutDuration" runat="server" CssClass="NormalTextBox" Width="40px"></asp:TextBox>
<asp:RequiredFieldValidator ID="valRequireAccountLockoutDuration" runat="server" ControlToValidate="txtAccountLockoutDuration" meta:resourcekey="valRequireAccountLockoutDuration"
ErrorMessage="*" ValidationGroup="SettingsEditor" Display="Dynamic"></asp:RequiredFieldValidator>
<asp:RegularExpressionValidator ID="valCorrectAccountLockoutDuration" runat="server" ControlToValidate="txtAccountLockoutDuration" meta:resourcekey="valCorrectAccountLockoutDuration"
Display="Dynamic" ErrorMessage="*" ValidationExpression="\d{1,3}" ValidationGroup="SettingsEditor"></asp:RegularExpressionValidator></td>
</tr>
<tr id="RowLockedOut" runat="server">
<td class="Normal">
<asp:Label ID="lblLockedOut" runat="server"
meta:resourcekey="lblLockedOut" Text="Account Lockout threshold:"></asp:Label>
</td>
<td class="Normal"><asp:TextBox ID="txtLockedOut" runat="server" CssClass="NormalTextBox" Width="40px"></asp:TextBox>
<asp:RegularExpressionValidator ID="valCorrectLockedOut" runat="server" ControlToValidate="txtLockedOut" meta:resourcekey="valCorrectLockedOut"
Display="Dynamic" ErrorMessage="*" ValidationExpression="\d{1,10}" ValidationGroup="SettingsEditor"></asp:RegularExpressionValidator>
</td>
</tr>
<tr id="RowResetAccountLockout" runat="server">
<td class="Normal">
<asp:Label ID="lblResetAccountLockout" runat="server"
meta:resourcekey="lblResetAccountLockout" Text="Reset account lockout counter after (minutes):"></asp:Label>
</td>
<td class="Normal"><asp:TextBox ID="txtResetAccountLockout" runat="server" CssClass="NormalTextBox" Width="40px"></asp:TextBox>
<asp:RegularExpressionValidator ID="valResetAccountLockout" runat="server" ControlToValidate="txtResetAccountLockout" meta:resourcekey="valResetAccountLockout"
Display="Dynamic" ErrorMessage="*" ValidationExpression="\d{1,10}" ValidationGroup="SettingsEditor"></asp:RegularExpressionValidator>
</td>
</tr>
<tr>
<td colspan="2" class="NormalBold">
<asp:CheckBox id="chkPasswordComplexity" runat="server" meta:resourcekey="chkPasswordComplexity"
Text="Enable Password Complexity" CssClass="NormalBold" AutoPostBack="true" OnCheckedChanged="chkPasswordComplexity_CheckedChanged" />
</td>
</tr>
<tr id="RowMinimumUppercase" runat="server">
<td class="Normal">
<asp:Label ID="lblMinimumUppercase" runat="server"
meta:resourcekey="lblMinimumUppercase" Text="Uppercase letters:"></asp:Label>
</td>
<td class="Normal"><asp:TextBox ID="txtMinimumUppercase" runat="server" CssClass="NormalTextBox" Width="40px"></asp:TextBox>
<asp:RequiredFieldValidator ID="valRequireUppercase" runat="server" ControlToValidate="txtMinimumUppercase" meta:resourcekey="valRequireUppercase"
ErrorMessage="*" ValidationGroup="SettingsEditor" Display="Dynamic"></asp:RequiredFieldValidator>
<asp:RegularExpressionValidator ID="valCorrectUppercase" runat="server" ControlToValidate="txtMinimumUppercase" meta:resourcekey="valCorrectUppercase"
Display="Dynamic" ErrorMessage="*" ValidationExpression="\d{1,3}" ValidationGroup="SettingsEditor"></asp:RegularExpressionValidator>
</td>
</tr>
<tr id="RowMinimumNumbers" runat="server">
<td class="Normal">
<asp:Label ID="lblMinimumNumbers" runat="server"
meta:resourcekey="lblMinimumNumbers" Text="Numbers:"></asp:Label>
</td>
<td class="Normal"><asp:TextBox ID="txtMinimumNumbers" runat="server" CssClass="NormalTextBox" Width="40px"></asp:TextBox>
<asp:RequiredFieldValidator ID="valRequireNumbers" runat="server" ControlToValidate="txtMinimumNumbers" meta:resourcekey="valRequireNumbers"
ErrorMessage="*" ValidationGroup="SettingsEditor" Display="Dynamic"></asp:RequiredFieldValidator>
<asp:RegularExpressionValidator ID="valCorrectNumbers" runat="server" ControlToValidate="txtMinimumNumbers" meta:resourcekey="valCorrectNumbers"
Display="Dynamic" ErrorMessage="*" ValidationExpression="\d{1,3}" ValidationGroup="SettingsEditor"></asp:RegularExpressionValidator>
</td>
</tr>
<tr id="RowMinimumSymbols" runat="server">
<td class="Normal">
<asp:Label ID="lblMinimumSymbols" runat="server"
meta:resourcekey="lblMinimumSymbols" Text="Non-alphanumeric symbols:"></asp:Label>
</td>
<td class="Normal"><asp:TextBox ID="txtMinimumSymbols" runat="server" CssClass="NormalTextBox" Width="40px"></asp:TextBox>
<asp:RequiredFieldValidator ID="valRequireSymbols" runat="server" ControlToValidate="txtMinimumSymbols" meta:resourcekey="valRequireSymbols"
ErrorMessage="*" ValidationGroup="SettingsEditor" Display="Dynamic"></asp:RequiredFieldValidator>
<asp:RegularExpressionValidator ID="valCorrectSymbols" runat="server" ControlToValidate="txtMinimumSymbols" meta:resourcekey="valCorrectSymbols"
Display="Dynamic" ErrorMessage="*" ValidationExpression="\d{1,3}" ValidationGroup="SettingsEditor"></asp:RegularExpressionValidator>
</td>
</tr>
<tr id="rowEqualUsername" runat="server" visible="false">
<td class="Normal" colspan="2">
<asp:CheckBox id="chkNotEqualUsername" runat="server" meta:resourcekey="chkNotEqualUsername" Text="Should not be equal to username" />
</td>
</tr>
</table>
</asp:Panel>
</ContentTemplate>
</asp:UpdatePanel>
<div class="FormFooterClean">
<wsp:ItemButtonPanel id="buttonPanel" runat="server" ValidationGroup="EditPasswordSettings"
OnSaveClick="btnSave_Click" OnSaveExitClick="btnSaveExit_Click" />
</div>
</div>
</div>
</div>
</div>
</div>

View file

@ -0,0 +1,163 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using WebsitePanel.EnterpriseServer;
using WebsitePanel.Providers.HostedSolution;
namespace WebsitePanel.Portal.ExchangeServer
{
public partial class OrganizationSettingsPasswordSettings : WebsitePanelModuleBase
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
Organization org = ES.Services.Organizations.GetOrganization(PanelRequest.ItemID);
litOrganizationName.Text = org.OrganizationId;
BindSettings();
}
}
private void BindSettings()
{
var settings = ES.Services.Organizations.GetOrganizationPasswordSettings(PanelRequest.ItemID);
if (settings == null)
{
var defaultSettings = ES.Services.Users.GetUserSettings(PanelSecurity.LoggedUserId, UserSettings.EXCHANGE_POLICY);
BindDefaultSettings(defaultSettings[UserSettings.HOSTED_ORGANIZATION_PASSWORD_POLICY]);
}
else
{
BindSettings(settings);
}
ToggleLockoutControls(chkLockOutSettigns.Checked);
ToggleComplexityControls(chkPasswordComplexity.Checked);
}
private void BindDefaultSettings(string defaultSettings)
{
// parse settings
string[] parts = defaultSettings.Split(';');
txtMinimumLength.Text = parts[1];
txtMaximumLength.Text = parts[2];
txtMinimumUppercase.Text = parts[3];
txtMinimumNumbers.Text = parts[4];
txtMinimumSymbols.Text = parts[5];
chkNotEqualUsername.Checked = Utils.ParseBool(parts[6], false);
txtLockedOut.Text = parts[7];
txtEnforcePasswordHistory.Text = PasswordPolicyEditor.GetValueSafe(parts, 8, "0");
txtAccountLockoutDuration.Text = PasswordPolicyEditor.GetValueSafe(parts, 9, "0");
txtResetAccountLockout.Text = PasswordPolicyEditor.GetValueSafe(parts, 10, "0");
chkLockOutSettigns.Checked = PasswordPolicyEditor.GetValueSafe(parts, 11, false);
chkPasswordComplexity.Checked = PasswordPolicyEditor.GetValueSafe(parts, 12, true);
}
private void BindSettings(OrganizationPasswordSettings settings)
{
txtMinimumLength.Text = settings.MinimumLength.ToString();
txtMaximumLength.Text = settings.MaximumLength.ToString();
txtMinimumUppercase.Text = settings.UppercaseLettersCount.ToString();
txtMinimumNumbers.Text = settings.NumbersCount.ToString();
txtMinimumSymbols.Text = settings.SymbolsCount.ToString();
txtLockedOut.Text = settings.AccountLockoutThreshold.ToString();
txtEnforcePasswordHistory.Text = settings.EnforcePasswordHistory.ToString();
txtAccountLockoutDuration.Text = settings.AccountLockoutDuration.ToString();
txtResetAccountLockout.Text = settings.ResetAccountLockoutCounterAfter.ToString();
chkLockOutSettigns.Checked = settings.LockoutSettingsEnabled;
chkPasswordComplexity.Checked = settings.PasswordComplexityEnabled;
}
private OrganizationPasswordSettings GetSettings()
{
var settings = new OrganizationPasswordSettings();
settings.MinimumLength = Utils.ParseInt(txtMinimumLength.Text, 3);
settings.MaximumLength = Utils.ParseInt(txtMaximumLength.Text, 7);
settings.UppercaseLettersCount = Utils.ParseInt(txtMinimumUppercase.Text, 3);
settings.NumbersCount = Utils.ParseInt(txtMinimumNumbers.Text, 3);
settings.SymbolsCount = Utils.ParseInt(txtMinimumSymbols.Text, 3);
settings.AccountLockoutThreshold = Utils.ParseInt(txtLockedOut.Text, 3);
settings.EnforcePasswordHistory = Utils.ParseInt(txtEnforcePasswordHistory.Text, 3);
settings.AccountLockoutDuration = Utils.ParseInt(txtAccountLockoutDuration.Text, 3);
settings.ResetAccountLockoutCounterAfter = Utils.ParseInt(txtResetAccountLockout.Text, 3);
settings.LockoutSettingsEnabled = chkLockOutSettigns.Checked;
settings.PasswordComplexityEnabled =chkPasswordComplexity.Checked;
return settings;
}
private bool SavePasswordSettings()
{
try
{
ES.Services.Organizations.UpdateOrganizationPasswordSettings(PanelRequest.ItemID, GetSettings());
}
catch (Exception ex)
{
ShowErrorMessage("ORANIZATIONSETTINGS_NOT_UPDATED", ex);
return false;
}
return true;
}
protected void btnSave_Click(object sender, EventArgs e)
{
if (!Page.IsValid)
{
return;
}
SavePasswordSettings();
}
private void ToggleLockoutControls(bool visible)
{
RowAccountLockoutDuration.Visible = visible;
RowLockedOut.Visible = visible;
RowResetAccountLockout.Visible = visible;
}
protected void chkLockOutSettigns_CheckedChanged(object sender, EventArgs e)
{
ToggleLockoutControls(chkLockOutSettigns.Checked);
}
private void ToggleComplexityControls(bool visible)
{
RowMinimumUppercase.Visible = visible;
RowMinimumNumbers.Visible = visible;
RowMinimumSymbols.Visible = visible;
}
protected void chkPasswordComplexity_CheckedChanged(object sender, EventArgs e)
{
ToggleComplexityControls(chkPasswordComplexity.Checked);
}
protected void btnSaveExit_Click(object sender, EventArgs e)
{
if (!Page.IsValid)
{
return;
}
if (SavePasswordSettings())
{
Response.Redirect(EditUrl("ItemID", PanelRequest.ItemID.ToString(), "organization_home", "SpaceID=" + PanelSecurity.PackageId));
}
}
}
}

View file

@ -0,0 +1,519 @@
//------------------------------------------------------------------------------
// <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 WebsitePanel.Portal.ExchangeServer {
public partial class OrganizationSettingsPasswordSettings {
/// <summary>
/// asyncTasks control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::WebsitePanel.Portal.EnableAsyncTasksSupport asyncTasks;
/// <summary>
/// Image1 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.Image Image1;
/// <summary>
/// locTitle 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.Localize locTitle;
/// <summary>
/// litOrganizationName 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.Literal litOrganizationName;
/// <summary>
/// tabs control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::WebsitePanel.Portal.ExchangeServer.UserControls.OrganizationSettingsTabs tabs;
/// <summary>
/// messageBox control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::WebsitePanel.Portal.UserControls.SimpleMessageBox messageBox;
/// <summary>
/// PasswordPolicyPanel control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.UpdatePanel PasswordPolicyPanel;
/// <summary>
/// colPasswordSettings control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::WebsitePanel.Portal.CollapsiblePanel colPasswordSettings;
/// <summary>
/// panelPasswordSettings 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 panelPasswordSettings;
/// <summary>
/// PolicyTable control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.HtmlControls.HtmlTable PolicyTable;
/// <summary>
/// lblMinimumLength 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 lblMinimumLength;
/// <summary>
/// txtMinimumLength 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 txtMinimumLength;
/// <summary>
/// valRequireMinLength 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.RequiredFieldValidator valRequireMinLength;
/// <summary>
/// valCorrectMinLength 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.RegularExpressionValidator valCorrectMinLength;
/// <summary>
/// lblMaximumLength 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 lblMaximumLength;
/// <summary>
/// txtMaximumLength 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 txtMaximumLength;
/// <summary>
/// valRequireMaxLength 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.RequiredFieldValidator valRequireMaxLength;
/// <summary>
/// valCorrectMaxLength 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.RegularExpressionValidator valCorrectMaxLength;
/// <summary>
/// lblEnforcePasswordHistory 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 lblEnforcePasswordHistory;
/// <summary>
/// txtEnforcePasswordHistory 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 txtEnforcePasswordHistory;
/// <summary>
/// valRequireEnforcePasswordHistory 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.RequiredFieldValidator valRequireEnforcePasswordHistory;
/// <summary>
/// valCorrectEnforcePasswordHistory 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.RegularExpressionValidator valCorrectEnforcePasswordHistory;
/// <summary>
/// RowChkLockOutSettigns control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.HtmlControls.HtmlTableRow RowChkLockOutSettigns;
/// <summary>
/// chkLockOutSettigns 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.CheckBox chkLockOutSettigns;
/// <summary>
/// RowAccountLockoutDuration control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.HtmlControls.HtmlTableRow RowAccountLockoutDuration;
/// <summary>
/// lblAccountLockoutDuration 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 lblAccountLockoutDuration;
/// <summary>
/// txtAccountLockoutDuration 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 txtAccountLockoutDuration;
/// <summary>
/// valRequireAccountLockoutDuration 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.RequiredFieldValidator valRequireAccountLockoutDuration;
/// <summary>
/// valCorrectAccountLockoutDuration 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.RegularExpressionValidator valCorrectAccountLockoutDuration;
/// <summary>
/// RowLockedOut control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.HtmlControls.HtmlTableRow RowLockedOut;
/// <summary>
/// lblLockedOut 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 lblLockedOut;
/// <summary>
/// txtLockedOut 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 txtLockedOut;
/// <summary>
/// valCorrectLockedOut 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.RegularExpressionValidator valCorrectLockedOut;
/// <summary>
/// RowResetAccountLockout control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.HtmlControls.HtmlTableRow RowResetAccountLockout;
/// <summary>
/// lblResetAccountLockout 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 lblResetAccountLockout;
/// <summary>
/// txtResetAccountLockout 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 txtResetAccountLockout;
/// <summary>
/// valResetAccountLockout 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.RegularExpressionValidator valResetAccountLockout;
/// <summary>
/// chkPasswordComplexity 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.CheckBox chkPasswordComplexity;
/// <summary>
/// RowMinimumUppercase control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.HtmlControls.HtmlTableRow RowMinimumUppercase;
/// <summary>
/// lblMinimumUppercase 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 lblMinimumUppercase;
/// <summary>
/// txtMinimumUppercase 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 txtMinimumUppercase;
/// <summary>
/// valRequireUppercase 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.RequiredFieldValidator valRequireUppercase;
/// <summary>
/// valCorrectUppercase 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.RegularExpressionValidator valCorrectUppercase;
/// <summary>
/// RowMinimumNumbers control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.HtmlControls.HtmlTableRow RowMinimumNumbers;
/// <summary>
/// lblMinimumNumbers 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 lblMinimumNumbers;
/// <summary>
/// txtMinimumNumbers 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 txtMinimumNumbers;
/// <summary>
/// valRequireNumbers 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.RequiredFieldValidator valRequireNumbers;
/// <summary>
/// valCorrectNumbers 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.RegularExpressionValidator valCorrectNumbers;
/// <summary>
/// RowMinimumSymbols control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.HtmlControls.HtmlTableRow RowMinimumSymbols;
/// <summary>
/// lblMinimumSymbols 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 lblMinimumSymbols;
/// <summary>
/// txtMinimumSymbols 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 txtMinimumSymbols;
/// <summary>
/// valRequireSymbols 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.RequiredFieldValidator valRequireSymbols;
/// <summary>
/// valCorrectSymbols 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.RegularExpressionValidator valCorrectSymbols;
/// <summary>
/// rowEqualUsername control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.HtmlControls.HtmlTableRow rowEqualUsername;
/// <summary>
/// chkNotEqualUsername 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.CheckBox chkNotEqualUsername;
/// <summary>
/// buttonPanel control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::WebsitePanel.Portal.ItemButtonPanel buttonPanel;
}
}

View file

@ -59,18 +59,7 @@ namespace WebsitePanel.Portal.HostedSolution
{
try
{
password.SetPackagePolicy(PanelSecurity.PackageId, UserSettings.EXCHANGE_POLICY, "MailboxPasswordPolicy");
PasswordPolicyResult passwordPolicy = ES.Services.Organizations.GetPasswordPolicy(PanelRequest.ItemID);
if (passwordPolicy.IsSuccess)
{
password.MinimumLength = passwordPolicy.Value.MinLength;
if (passwordPolicy.Value.IsComplexityEnable)
{
password.MinimumNumbers = 1;
password.MinimumSymbols = 1;
password.MinimumUppercase = 1;
}
}
BindPasswordSettings();
// get settings
OrganizationUser user = ES.Services.Organizations.GetUserGeneralSettings(PanelRequest.ItemID,
@ -273,6 +262,37 @@ namespace WebsitePanel.Portal.HostedSolution
}
private void BindPasswordSettings()
{
var grainedPasswordSettigns = ES.Services.Organizations.GetOrganizationPasswordSettings(PanelRequest.ItemID);
if (grainedPasswordSettigns != null)
{
password.SetUserPolicy(grainedPasswordSettigns);
}
else
{
password.SetPackagePolicy(PanelSecurity.PackageId, UserSettings.EXCHANGE_POLICY, "MailboxPasswordPolicy");
PasswordPolicyResult passwordPolicy = ES.Services.Organizations.GetPasswordPolicy(PanelRequest.ItemID);
if (passwordPolicy.IsSuccess)
{
password.MinimumLength = passwordPolicy.Value.MinLength;
if (passwordPolicy.Value.IsComplexityEnable)
{
password.MinimumNumbers = 1;
password.MinimumSymbols = 1;
password.MinimumUppercase = 1;
}
}
else
{
messageBox.ShowMessage(passwordPolicy, "CREATE_ORGANIZATION_USER", "HostedOrganization");
}
}
}
private bool CheckServiceLevelQuota(QuotaValueInfo quota)
{

View file

@ -0,0 +1,123 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="Tab.PasswordSettings" xml:space="preserve">
<value>Password Settings</value>
</data>
</root>

View file

@ -0,0 +1,32 @@
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="OrganizationSettingsTabs.ascx.cs" Inherits="WebsitePanel.Portal.ExchangeServer.UserControls.OrganizationSettingsTabs" %>
<table width="100%" cellpadding="0" cellspacing="1">
<tr>
<td class="Tabs">
<asp:DataList ID="osTabs" runat="server" RepeatDirection="Horizontal" RepeatLayout="Flow" EnableViewState="false">
<ItemStyle Wrap="False" />
<ItemTemplate >
<asp:HyperLink ID="lnkTab" runat="server" CssClass="Tab" NavigateUrl='<%# Eval("Url") %>' OnClick="return tabClicked();">
<%# Eval("Name") %>
</asp:HyperLink>
</ItemTemplate>
<SelectedItemStyle Wrap="False" />
<SelectedItemTemplate>
<asp:HyperLink ID="lnkSelTab" runat="server" CssClass="ActiveTab" NavigateUrl='<%# Eval("Url") %>' OnClick="return tabClicked;">
<%# Eval("Name") %>
</asp:HyperLink>
</SelectedItemTemplate>
</asp:DataList>
</td>
</tr>
</table>
<br />
<script type="text/javascript">
function tabClicked() {
ShowProgressDialog('Loading');
ShowProgressDialogInternal();
return true;
}
</script>

View file

@ -0,0 +1,50 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using WebsitePanel.Portal.Code.UserControls;
namespace WebsitePanel.Portal.ExchangeServer.UserControls
{
public partial class OrganizationSettingsTabs : WebsitePanelControlBase
{
public string SelectedTab { get; set; }
protected void Page_Load(object sender, EventArgs e)
{
BindTabs();
}
private void BindTabs()
{
List<Tab> tabsList = new List<Tab>();
tabsList.Add(CreateTab("organization_settings_password_settings", "Tab.PasswordSettings"));
int idx = 0;
foreach (Tab tab in tabsList)
{
if (String.Compare(tab.Id, SelectedTab, true) == 0)
{
break;
}
idx++;
}
osTabs.SelectedIndex = idx;
osTabs.DataSource = tabsList;
osTabs.DataBind();
}
private Tab CreateTab(string id, string text)
{
return new Tab(id, GetLocalizedString(text),
HostModule.EditUrl("ItemID", PanelRequest.ItemID.ToString(), id,
"SpaceID=" + PanelSecurity.PackageId
));
}
}
}

View file

@ -0,0 +1,24 @@
//------------------------------------------------------------------------------
// <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 WebsitePanel.Portal.ExchangeServer.UserControls {
public partial class OrganizationSettingsTabs {
/// <summary>
/// osTabs 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.DataList osTabs;
}
}

View file

@ -13,7 +13,7 @@
</td>
<td>
<wsp:PasswordPolicyEditor id="mailboxPasswordPolicy" runat="server" />
<wsp:PasswordPolicyEditor id="mailboxPasswordPolicy" runat="server" ShowLockoutSettings="true"/>
</td>
</tr>
</table>

View file

@ -1,30 +1,11 @@
// Copyright (c) 2015, Outercurve Foundation.
// All rights reserved.
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// - Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer.
//
// - Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// - Neither the name of the Outercurve Foundation nor the names of its
// contributors may be used to endorse or promote products derived from this
// software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace WebsitePanel.Portal {

View file

@ -120,11 +120,26 @@
<data name="chkEnabled.Text" xml:space="preserve">
<value>Enable Policy</value>
</data>
<data name="chkLockOutSettigns.Text" xml:space="preserve">
<value>Enable Lockout Settings</value>
</data>
<data name="chkNotEqualUsername.Text" xml:space="preserve">
<value>Should not be equal to username</value>
</data>
<data name="chkPasswordComplexity" xml:space="preserve">
<value>Enable Password Complexity</value>
</data>
<data name="lblAccountLockoutDuration.Text" xml:space="preserve">
<value>Account lockout duration:</value>
</data>
<data name="lblEnforcePasswordHistory.Text" xml:space="preserve">
<value>Enforce password history:</value>
</data>
<data name="lblLockedOut.Text" xml:space="preserve">
<value>Lock out after # attempts:</value>
<value>Account lockout threshold:</value>
</data>
<data name="lblLockOutSettigns.Text" xml:space="preserve">
<value>Lock out settings:</value>
</data>
<data name="lblMaximumLength.Text" xml:space="preserve">
<value>Maximum length:</value>
@ -141,9 +156,18 @@
<data name="lblMinimumUppercase.Text" xml:space="preserve">
<value>Uppercase letters:</value>
</data>
<data name="lblResetAccountLockout.Text" xml:space="preserve">
<value>Reset account lockout counter after (minutes):</value>
</data>
<data name="lblShouldContain.Text" xml:space="preserve">
<value>Password should contain at least:</value>
</data>
<data name="valCorrectAccountLockoutDuration.Text" xml:space="preserve">
<value>*</value>
</data>
<data name="valCorrectEnforcePasswordHistory.Text" xml:space="preserve">
<value>*</value>
</data>
<data name="valCorrectLockedOut.Text" xml:space="preserve">
<value>*</value>
</data>
@ -162,6 +186,12 @@
<data name="valCorrectUppercase.Text" xml:space="preserve">
<value>*</value>
</data>
<data name="valRequireAccountLockoutDuration.Text" xml:space="preserve">
<value>*</value>
</data>
<data name="valRequireEnforcePasswordHistory.Text" xml:space="preserve">
<value>*</value>
</data>
<data name="valRequireMaxLength.Text" xml:space="preserve">
<value>*</value>
</data>
@ -177,4 +207,7 @@
<data name="valRequireUppercase.Text" xml:space="preserve">
<value>*</value>
</data>
<data name="valResetAccountLockout.Text" xml:space="preserve">
<value>*</value>
</data>
</root>

View file

@ -27,6 +27,7 @@
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
using System;
using System.Configuration.Internal;
using System.Data;
using System.Configuration;
using System.Collections;
@ -41,6 +42,7 @@ using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using WebsitePanel.EnterpriseServer;
using WebsitePanel.Providers.HostedSolution;
namespace WebsitePanel.Portal
{
@ -112,7 +114,14 @@ namespace WebsitePanel.Portal
public int MaximumLength
{
get { return (ViewState["MaximumLength"] != null) ? (int)ViewState["MaximumLength"] : 0; }
set { ViewState["MaximumLength"] = value; }
set
{
{
txtPassword.MaxLength = value;
txtConfirmPassword.MaxLength = value;
ViewState["MaximumLength"] = value;
}
}
}
public int MinimumNumbers
@ -182,6 +191,38 @@ namespace WebsitePanel.Portal
ToggleControls();
}
public void SetUserPolicy(OrganizationPasswordSettings settings)
{
int minimumUppercase;
int minimumNumbers;
int minimumSymbols;
if (settings.PasswordComplexityEnabled)
{
minimumUppercase = settings.UppercaseLettersCount;
minimumNumbers = settings.NumbersCount;
minimumSymbols = settings.SymbolsCount;
}
else
{
minimumUppercase = 0;
minimumNumbers = 0;
minimumSymbols = 0;
}
PolicyValue = string.Join(";", true, settings.MinimumLength, settings.MaximumLength, minimumUppercase, minimumNumbers, minimumSymbols, true);
ToggleControls();
}
public void SetUserPolicy(bool enabled, int minLength, int maxLength, int minimumUppercase, int minimumNumbers, int minimumSymbols, bool notEqualToUsername)
{
PolicyValue = string.Join(";", enabled, minLength, maxLength, minimumUppercase, minimumNumbers, minimumSymbols, notEqualToUsername);
ToggleControls();
}
protected void Page_Load(object sender, EventArgs e)
{
txtPassword.Attributes["value"] = txtPassword.Text;

View file

@ -28,10 +28,59 @@
</td>
</tr>
<tr>
<td colspan="2" class="NormalBold"><asp:Label ID="lblShouldContain" runat="server"
meta:resourcekey="lblShouldContain" Text="Password should contain at least:"></asp:Label></td>
<td class="Normal" style="width:150px;"><asp:Label ID="lblEnforcePasswordHistory" runat="server"
meta:resourcekey="lblEnforcePasswordHistory" Text="Enforce Password History:"></asp:Label></td>
<td class="Normal">
<asp:TextBox ID="txtEnforcePasswordHistory" runat="server" CssClass="NormalTextBox" Width="40px"></asp:TextBox>
<asp:RequiredFieldValidator ID="valRequireEnforcePasswordHistory" runat="server" ControlToValidate="txtEnforcePasswordHistory" meta:resourcekey="valRequireEnforcePasswordHistory"
ErrorMessage="*" ValidationGroup="SettingsEditor" Display="Dynamic"></asp:RequiredFieldValidator>
<asp:RegularExpressionValidator ID="valCorrectEnforcePasswordHistory" runat="server" ControlToValidate="txtEnforcePasswordHistory" meta:resourcekey="valCorrectEnforcePasswordHistory"
Display="Dynamic" ErrorMessage="*" ValidationExpression="\d{1,3}" ValidationGroup="SettingsEditor"></asp:RegularExpressionValidator></td>
</tr>
<tr id="RowChkLockOutSettigns" runat="server">
<td colspan="2" class="NormalBold">
<asp:CheckBox id="chkLockOutSettigns" runat="server" meta:resourcekey="chkLockOutSettigns"
Text="Enable Lockout Settings" CssClass="NormalBold" AutoPostBack="true" OnCheckedChanged="chkLockOutSettigns_CheckedChanged" />
</td>
</tr>
<tr id="RowAccountLockoutDuration" runat="server">
<td class="Normal" style="width:150px;"><asp:Label ID="lblAccountLockoutDuration" runat="server"
meta:resourcekey="lblAccountLockoutDuration" Text="Account Lockout Duration:"></asp:Label></td>
<td class="Normal">
<asp:TextBox ID="txtAccountLockoutDuration" runat="server" CssClass="NormalTextBox" Width="40px"></asp:TextBox>
<asp:RequiredFieldValidator ID="valRequireAccountLockoutDuration" runat="server" ControlToValidate="txtAccountLockoutDuration" meta:resourcekey="valRequireAccountLockoutDuration"
ErrorMessage="*" ValidationGroup="SettingsEditor" Display="Dynamic"></asp:RequiredFieldValidator>
<asp:RegularExpressionValidator ID="valCorrectAccountLockoutDuration" runat="server" ControlToValidate="txtAccountLockoutDuration" meta:resourcekey="valCorrectAccountLockoutDuration"
Display="Dynamic" ErrorMessage="*" ValidationExpression="\d{1,3}" ValidationGroup="SettingsEditor"></asp:RegularExpressionValidator></td>
</tr>
<tr id="RowLockedOut" runat="server">
<td class="Normal">
<asp:Label ID="lblLockedOut" runat="server"
meta:resourcekey="lblLockedOut" Text="Account Lockout threshold:"></asp:Label>
</td>
<td class="Normal"><asp:TextBox ID="txtLockedOut" runat="server" CssClass="NormalTextBox" Width="40px"></asp:TextBox>
<asp:RegularExpressionValidator ID="valCorrectLockedOut" runat="server" ControlToValidate="txtLockedOut" meta:resourcekey="valCorrectLockedOut"
Display="Dynamic" ErrorMessage="*" ValidationExpression="\d{1,10}" ValidationGroup="SettingsEditor"></asp:RegularExpressionValidator>
</td>
</tr>
<tr id="RowResetAccountLockout" runat="server">
<td class="Normal">
<asp:Label ID="lblResetAccountLockout" runat="server"
meta:resourcekey="lblResetAccountLockout" Text="Reset account lockout counter after (minutes):"></asp:Label>
</td>
<td class="Normal"><asp:TextBox ID="txtResetAccountLockout" runat="server" CssClass="NormalTextBox" Width="40px"></asp:TextBox>
<asp:RegularExpressionValidator ID="valResetAccountLockout" runat="server" ControlToValidate="txtResetAccountLockout" meta:resourcekey="valResetAccountLockout"
Display="Dynamic" ErrorMessage="*" ValidationExpression="\d{1,10}" ValidationGroup="SettingsEditor"></asp:RegularExpressionValidator>
</td>
</tr>
<tr>
<td colspan="2" class="NormalBold">
<asp:CheckBox id="chkPasswordComplexity" runat="server" meta:resourcekey="chkPasswordComplexity"
Text="Enable Password Complexity" CssClass="NormalBold" AutoPostBack="true" OnCheckedChanged="chkPasswordComplexity_CheckedChanged" />
</td>
</tr>
<tr id="RowMinimumUppercase" runat="server">
<td class="Normal">
<asp:Label ID="lblMinimumUppercase" runat="server"
meta:resourcekey="lblMinimumUppercase" Text="Uppercase letters:"></asp:Label>
@ -43,7 +92,7 @@
Display="Dynamic" ErrorMessage="*" ValidationExpression="\d{1,3}" ValidationGroup="SettingsEditor"></asp:RegularExpressionValidator>
</td>
</tr>
<tr>
<tr id="RowMinimumNumbers" runat="server">
<td class="Normal">
<asp:Label ID="lblMinimumNumbers" runat="server"
meta:resourcekey="lblMinimumNumbers" Text="Numbers:"></asp:Label>
@ -55,7 +104,7 @@
Display="Dynamic" ErrorMessage="*" ValidationExpression="\d{1,3}" ValidationGroup="SettingsEditor"></asp:RegularExpressionValidator>
</td>
</tr>
<tr>
<tr id="RowMinimumSymbols" runat="server">
<td class="Normal">
<asp:Label ID="lblMinimumSymbols" runat="server"
meta:resourcekey="lblMinimumSymbols" Text="Non-alphanumeric symbols:"></asp:Label>
@ -72,18 +121,6 @@
<asp:CheckBox id="chkNotEqualUsername" runat="server" meta:resourcekey="chkNotEqualUsername" Text="Should not be equal to username" />
</td>
</tr>
<tr>
<td class="Normal">
<asp:Label ID="lblLockedOut" runat="server"
meta:resourcekey="lblLockedOut" Text="Lock out after :"></asp:Label>
</td>
<td class="Normal"><asp:TextBox ID="txtLockedOut" runat="server" CssClass="NormalTextBox" Width="40px"></asp:TextBox>
<asp:RegularExpressionValidator ID="valCorrectLockedOut" runat="server" ControlToValidate="txtLockedOut" meta:resourcekey="valCorrectLockedOut"
Display="Dynamic" ErrorMessage="*" ValidationExpression="\d{1,10}" ValidationGroup="SettingsEditor"></asp:RegularExpressionValidator>
</td>
</tr>
</table>
</ContentTemplate>

View file

@ -42,6 +42,8 @@ namespace WebsitePanel.Portal
{
public partial class PasswordPolicyEditor : WebsitePanelControlBase
{
public bool ShowLockoutSettings { get; set; }
public string Value
{
get
@ -56,6 +58,12 @@ namespace WebsitePanel.Portal
sb.Append(chkNotEqualUsername.Checked.ToString()).Append(";");
sb.Append(txtLockedOut.Text).Append(";");
sb.Append(txtEnforcePasswordHistory.Text).Append(";");
sb.Append(txtAccountLockoutDuration.Text).Append(";");
sb.Append(txtResetAccountLockout.Text).Append(";");
sb.Append(chkLockOutSettigns.Checked.ToString()).Append(";");
sb.Append(chkPasswordComplexity.Checked.ToString()).Append(";");
return sb.ToString();
}
set
@ -70,6 +78,7 @@ namespace WebsitePanel.Portal
txtMinimumNumbers.Text = "0";
txtMinimumSymbols.Text = "0";
txtLockedOut.Text = "3";
chkPasswordComplexity.Checked = true;
}
else
{
@ -85,8 +94,17 @@ namespace WebsitePanel.Portal
txtMinimumSymbols.Text = parts[5];
chkNotEqualUsername.Checked = Utils.ParseBool(parts[6], false);
txtLockedOut.Text = parts[7];
txtEnforcePasswordHistory.Text = GetValueSafe(parts, 8, "0");
txtAccountLockoutDuration.Text = GetValueSafe(parts, 9, "0");
txtResetAccountLockout.Text = GetValueSafe(parts, 10, "0");
chkLockOutSettigns.Checked = GetValueSafe(parts, 11, false) && ShowLockoutSettings;
chkPasswordComplexity.Checked = GetValueSafe(parts, 12, true);
}
catch
{
/* skip */
}
catch { /* skip */ }
}
ToggleControls();
}
@ -99,11 +117,56 @@ namespace WebsitePanel.Portal
private void ToggleControls()
{
PolicyTable.Visible = chkEnabled.Checked;
ToggleLockOutSettignsControls();
TogglePasswordCompelxitySettignsControls();
RowChkLockOutSettigns.Visible = ShowLockoutSettings;
}
protected void chkEnabled_CheckedChanged(object sender, EventArgs e)
{
ToggleControls();
}
private void ToggleLockOutSettignsControls()
{
RowAccountLockoutDuration.Visible = chkLockOutSettigns.Checked;
RowLockedOut.Visible = chkLockOutSettigns.Checked;
RowResetAccountLockout.Visible = chkLockOutSettigns.Checked;
}
private void TogglePasswordCompelxitySettignsControls()
{
RowMinimumUppercase.Visible = chkPasswordComplexity.Checked;
RowMinimumNumbers.Visible = chkPasswordComplexity.Checked;
RowMinimumSymbols.Visible = chkPasswordComplexity.Checked;
}
protected void chkLockOutSettigns_CheckedChanged(object sender, EventArgs e)
{
ToggleLockOutSettignsControls();
}
protected void chkPasswordComplexity_CheckedChanged(object sender, EventArgs e)
{
TogglePasswordCompelxitySettignsControls();
}
public static T GetValueSafe<T>(string[] array, int index, T defaultValue)
{
if (array.Length > index)
{
if (string.IsNullOrEmpty(array[index]))
{
return defaultValue;
}
return (T)Convert.ChangeType(array[index], typeof(T));
}
return defaultValue;
}
}
}

View file

@ -1,31 +1,3 @@
// Copyright (c) 2015, Outercurve Foundation.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// - Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer.
//
// - Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// - Neither the name of the Outercurve Foundation nor the names of its
// contributors may be used to endorse or promote products derived from this
// software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
@ -140,13 +112,193 @@ namespace WebsitePanel.Portal {
protected global::System.Web.UI.WebControls.RegularExpressionValidator valCorrectMaxLength;
/// <summary>
/// lblShouldContain control.
/// lblEnforcePasswordHistory 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 lblShouldContain;
protected global::System.Web.UI.WebControls.Label lblEnforcePasswordHistory;
/// <summary>
/// txtEnforcePasswordHistory 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 txtEnforcePasswordHistory;
/// <summary>
/// valRequireEnforcePasswordHistory 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.RequiredFieldValidator valRequireEnforcePasswordHistory;
/// <summary>
/// valCorrectEnforcePasswordHistory 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.RegularExpressionValidator valCorrectEnforcePasswordHistory;
/// <summary>
/// RowChkLockOutSettigns control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.HtmlControls.HtmlTableRow RowChkLockOutSettigns;
/// <summary>
/// chkLockOutSettigns 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.CheckBox chkLockOutSettigns;
/// <summary>
/// RowAccountLockoutDuration control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.HtmlControls.HtmlTableRow RowAccountLockoutDuration;
/// <summary>
/// lblAccountLockoutDuration 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 lblAccountLockoutDuration;
/// <summary>
/// txtAccountLockoutDuration 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 txtAccountLockoutDuration;
/// <summary>
/// valRequireAccountLockoutDuration 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.RequiredFieldValidator valRequireAccountLockoutDuration;
/// <summary>
/// valCorrectAccountLockoutDuration 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.RegularExpressionValidator valCorrectAccountLockoutDuration;
/// <summary>
/// RowLockedOut control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.HtmlControls.HtmlTableRow RowLockedOut;
/// <summary>
/// lblLockedOut 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 lblLockedOut;
/// <summary>
/// txtLockedOut 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 txtLockedOut;
/// <summary>
/// valCorrectLockedOut 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.RegularExpressionValidator valCorrectLockedOut;
/// <summary>
/// RowResetAccountLockout control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.HtmlControls.HtmlTableRow RowResetAccountLockout;
/// <summary>
/// lblResetAccountLockout 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 lblResetAccountLockout;
/// <summary>
/// txtResetAccountLockout 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 txtResetAccountLockout;
/// <summary>
/// valResetAccountLockout 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.RegularExpressionValidator valResetAccountLockout;
/// <summary>
/// chkPasswordComplexity 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.CheckBox chkPasswordComplexity;
/// <summary>
/// RowMinimumUppercase control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.HtmlControls.HtmlTableRow RowMinimumUppercase;
/// <summary>
/// lblMinimumUppercase control.
@ -184,6 +336,15 @@ namespace WebsitePanel.Portal {
/// </remarks>
protected global::System.Web.UI.WebControls.RegularExpressionValidator valCorrectUppercase;
/// <summary>
/// RowMinimumNumbers control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.HtmlControls.HtmlTableRow RowMinimumNumbers;
/// <summary>
/// lblMinimumNumbers control.
/// </summary>
@ -220,6 +381,15 @@ namespace WebsitePanel.Portal {
/// </remarks>
protected global::System.Web.UI.WebControls.RegularExpressionValidator valCorrectNumbers;
/// <summary>
/// RowMinimumSymbols control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.HtmlControls.HtmlTableRow RowMinimumSymbols;
/// <summary>
/// lblMinimumSymbols control.
/// </summary>
@ -273,32 +443,5 @@ namespace WebsitePanel.Portal {
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.CheckBox chkNotEqualUsername;
/// <summary>
/// lblLockedOut 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 lblLockedOut;
/// <summary>
/// txtLockedOut 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 txtLockedOut;
/// <summary>
/// valCorrectLockedOut 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.RegularExpressionValidator valCorrectLockedOut;
}
}

View file

@ -244,6 +244,13 @@
<DependentUpon>OrganizationDeletedUserGeneralSettings.ascx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="ExchangeServer\OrganizationSettingsPasswordSettings.ascx.cs">
<DependentUpon>OrganizationSettingsPasswordSettings.ascx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="ExchangeServer\OrganizationSettingsPasswordSettings.ascx.designer.cs">
<DependentUpon>OrganizationSettingsPasswordSettings.ascx</DependentUpon>
</Compile>
<Compile Include="ExchangeServer\OrganizationUserResetPassword.ascx.cs">
<DependentUpon>OrganizationUserResetPassword.ascx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
@ -265,6 +272,13 @@
<Compile Include="ExchangeServer\UserControls\EnterpriseStorageOwaUsersList.ascx.designer.cs">
<DependentUpon>EnterpriseStorageOwaUsersList.ascx</DependentUpon>
</Compile>
<Compile Include="ExchangeServer\UserControls\OrganizationSettingsTabs.ascx.cs">
<DependentUpon>OrganizationSettingsTabs.ascx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="ExchangeServer\UserControls\OrganizationSettingsTabs.ascx.designer.cs">
<DependentUpon>OrganizationSettingsTabs.ascx</DependentUpon>
</Compile>
<Compile Include="ProviderControls\HyperV2012R2_Settings.ascx.cs">
<DependentUpon>HyperV2012R2_Settings.ascx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
@ -4557,9 +4571,11 @@
<Content Include="ExchangeServer\EnterpriseStorageFolderSettingsFolderPermissions.ascx" />
<Content Include="ExchangeServer\EnterpriseStorageFolderSettingsOwaEditing.ascx" />
<Content Include="ExchangeServer\ExchangeCheckDomainName.ascx" />
<Content Include="ExchangeServer\OrganizationSettingsPasswordSettings.ascx" />
<Content Include="ExchangeServer\OrganizationUserResetPassword.ascx" />
<Content Include="ExchangeServer\UserControls\EnterpriseStorageEditFolderTabs.ascx" />
<Content Include="ExchangeServer\UserControls\EnterpriseStorageOwaUsersList.ascx" />
<Content Include="ExchangeServer\UserControls\OrganizationSettingsTabs.ascx" />
<Content Include="ProviderControls\HyperV2012R2_Settings.ascx" />
<Content Include="ScheduleTaskControls\UserPasswordExpirationNotificationView.ascx" />
<Content Include="SettingsUserPasswordExpirationLetter.ascx" />
@ -4622,6 +4638,8 @@
</Content>
<Content Include="ExchangeServer\App_LocalResources\OrganizationUserResetPassword.ascx.resx" />
<Content Include="App_LocalResources\SettingsUserPasswordExpirationLetter.ascx.resx" />
<Content Include="ExchangeServer\UserControls\App_LocalResources\OrganizationSettingsTabs.ascx.resx" />
<Content Include="ExchangeServer\App_LocalResources\OrganizationSettingsPasswordSettings.ascx.resx" />
<EmbeddedResource Include="RDS\App_LocalResources\RDSEditCollectionSettings.ascx.resx" />
<Content Include="RDSServersEditServer.ascx" />
<Content Include="RDS\AssignedRDSServers.ascx" />