diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/HostedSolution/OrganizationController.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/HostedSolution/OrganizationController.cs index f615daaf..733a4642 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/HostedSolution/OrganizationController.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/HostedSolution/OrganizationController.cs @@ -33,6 +33,7 @@ using System.Collections.Specialized; using System.Data; using System.Net.Mail; using System.Text; +using System.Threading.Tasks; using WebsitePanel.EnterpriseServer.Code.HostedSolution; using WebsitePanel.EnterpriseServer.Code.SharePoint; using WebsitePanel.EnterpriseServer.Extensions; @@ -1699,7 +1700,62 @@ namespace WebsitePanel.EnterpriseServer public static OrganizationPasswordSettings GetOrganizationPasswordSettings(int itemId) { - return GetOrganizationSettings(itemId, OrganizationSettings.PasswordSettings); + var passwordSettings = GetOrganizationSettings(itemId, OrganizationSettings.PasswordSettings); + + if (passwordSettings == null) + { + Organization org = GetOrganization(itemId); + + if (org == null) + { + throw new Exception(string.Format("Organization not found (ItemId = {0})", itemId)); + } + + var package = PackageController.GetPackage(org.PackageId); + + UserSettings userSettings = UserController.GetUserSettings(package.UserId, UserSettings.EXCHANGE_POLICY); + + if (userSettings != null) + { + string policyValue = userSettings["MailboxPasswordPolicy"]; + + if (policyValue != null) + { + string[] parts = policyValue.Split(';'); + + passwordSettings = new OrganizationPasswordSettings + { + MinimumLength = Utils.ParseInt(parts[1], 0), + MaximumLength = Utils.ParseInt(parts[2], 0), + UppercaseLettersCount = Utils.ParseInt(parts[3], 0), + NumbersCount = Utils.ParseInt(parts[4], 0), + SymbolsCount = Utils.ParseInt(parts[5], 0), + AccountLockoutThreshold = Utils.ParseInt(parts[7], 0), + EnforcePasswordHistory = Utils.ParseInt(parts[8], 0), + AccountLockoutDuration = Utils.ParseInt(parts[9], 0), + ResetAccountLockoutCounterAfter = Utils.ParseInt(parts[10], 0), + LockoutSettingsEnabled = Utils.ParseBool(parts[11], false), + PasswordComplexityEnabled = Utils.ParseBool(parts[12], true), + }; + + + PasswordPolicyResult passwordPolicy = GetPasswordPolicy(itemId); + + if (passwordPolicy.IsSuccess) + { + passwordSettings.MinimumLength = passwordPolicy.Value.MinLength; + if (passwordPolicy.Value.IsComplexityEnable) + { + passwordSettings.NumbersCount = 1; + passwordSettings.SymbolsCount = 1; + passwordSettings.UppercaseLettersCount = 1; + } + } + } + } + } + + return passwordSettings; } public static void UpdateOrganizationGeneralSettings(int itemId, OrganizationGeneralSettings settings) @@ -2740,6 +2796,9 @@ namespace WebsitePanel.EnterpriseServer // place log record TaskManager.StartTask("ORGANIZATION", "SET_USER_PASSWORD", itemId); + TaskManager.Write("ItemId: {0}", itemId.ToString()); + TaskManager.Write("AccountId: {0}", accountId.ToString()); + try { // load organization diff --git a/WebsitePanel/Sources/WebsitePanel.WebDav.Core/Interfaces/Security/IAuthenticationService.cs b/WebsitePanel/Sources/WebsitePanel.WebDav.Core/Interfaces/Security/IAuthenticationService.cs index 0cddd68c..2c526578 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebDav.Core/Interfaces/Security/IAuthenticationService.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebDav.Core/Interfaces/Security/IAuthenticationService.cs @@ -14,5 +14,6 @@ namespace WebsitePanel.WebDav.Core.Interfaces.Security WspPrincipal LogIn(string login, string password); void CreateAuthenticationTicket(WspPrincipal principal); void LogOut(); + bool ValidateAuthenticationData(string login, string password); } } diff --git a/WebsitePanel/Sources/WebsitePanel.WebDav.Core/Security/Authentication/FormsAuthenticationService.cs b/WebsitePanel/Sources/WebsitePanel.WebDav.Core/Security/Authentication/FormsAuthenticationService.cs index f802b9b8..972589f3 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebDav.Core/Security/Authentication/FormsAuthenticationService.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebDav.Core/Security/Authentication/FormsAuthenticationService.cs @@ -26,14 +26,7 @@ namespace WebsitePanel.WebDav.Core.Security.Authentication public WspPrincipal LogIn(string login, string password) { - if (string.IsNullOrEmpty(login) || string.IsNullOrEmpty(password)) - { - return null; - } - - var user = UserPrincipal.FindByIdentity(_principalContext, IdentityType.UserPrincipalName, login); - - if (user == null || _principalContext.ValidateCredentials(login, password) == false) + if (ValidateAuthenticationData(login, password) == false) { return null; } @@ -83,5 +76,22 @@ namespace WebsitePanel.WebDav.Core.Security.Authentication { FormsAuthentication.SignOut(); } + + public bool ValidateAuthenticationData(string login, string password) + { + if (string.IsNullOrEmpty(login) || string.IsNullOrEmpty(password)) + { + return false; + } + + var user = UserPrincipal.FindByIdentity(_principalContext, IdentityType.UserPrincipalName, login); + + if (user == null || _principalContext.ValidateCredentials(login, password) == false) + { + return false; + } + + return true; + } } } diff --git a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/App_Start/BundleConfig.cs b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/App_Start/BundleConfig.cs index d3be4e58..1986068a 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/App_Start/BundleConfig.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/App_Start/BundleConfig.cs @@ -17,7 +17,8 @@ namespace WebsitePanel.WebDavPortal bundles.Add(jQueryBundle); bundles.Add(new ScriptBundle("~/bundles/jqueryval").Include( - "~/Scripts/jquery.validate*")); + "~/Scripts/jquery.validate*", + "~/Scripts/appScripts/validation/passwordeditor.unobtrusive.js")); // Use the development version of Modernizr to develop with and learn from. Then, when you're // ready for production, use the build tool at http://modernizr.com to pick only the tests you need. diff --git a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/App_Start/RouteConfig.cs b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/App_Start/RouteConfig.cs index bf48c585..93bf1f75 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/App_Start/RouteConfig.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/App_Start/RouteConfig.cs @@ -12,6 +12,18 @@ namespace WebsitePanel.WebDavPortal #region Account + routes.MapRoute( + name: AccountRouteNames.UserProfile, + url: "account/profile", + defaults: new { controller = "Account", action = "UserProfile" } + ); + + routes.MapRoute( + name: AccountRouteNames.PasswordChange, + url: "account/profile/password-change", + defaults: new { controller = "Account", action = "PasswordChange" } + ); + routes.MapRoute( name: AccountRouteNames.Logout, url: "account/logout", diff --git a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/App_Start/Routes/AccountRouteNames.cs b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/App_Start/Routes/AccountRouteNames.cs index 035fde95..36f4c562 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/App_Start/Routes/AccountRouteNames.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/App_Start/Routes/AccountRouteNames.cs @@ -9,5 +9,8 @@ namespace WebsitePanel.WebDavPortal.UI.Routes { public const string Logout = "AccountLogout"; public const string Login = "AccountLogin"; + public const string UserProfile = "UserProfileRoute"; + + public const string PasswordChange = "PasswordChangeRoute"; } } \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Constants/Formtas.cs b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Constants/Formats.cs similarity index 81% rename from WebsitePanel/Sources/WebsitePanel.WebDavPortal/Constants/Formtas.cs rename to WebsitePanel/Sources/WebsitePanel.WebDavPortal/Constants/Formats.cs index 9c4127ab..775cd9b3 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Constants/Formtas.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Constants/Formats.cs @@ -1,6 +1,6 @@ namespace WebsitePanel.WebDavPortal.Constants { - public class Formtas + public class Formats { public const string DateFormatWithTime = "MM/dd/yyyy hh:mm tt"; } diff --git a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Content/Site.css b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Content/Site.css index 609ab5d0..1cbed98d 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Content/Site.css +++ b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Content/Site.css @@ -231,6 +231,23 @@ tr.selected-file { } +.navbar-fixed-top #user-profile { + font-size: 18px; + text-decoration: none; +} + +.navbar-fixed-top #user-profile:hover { + text-decoration: none; +} + +.user-profile .password-information { + padding-top: 7px; +} + +.user-profile .login-name { + padding-top: 7px; +} + .web-dav-folder-progress { margin-bottom: 0px; } diff --git a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Controllers/AccountController.cs b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Controllers/AccountController.cs index 6af67e4b..091e4899 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Controllers/AccountController.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Controllers/AccountController.cs @@ -2,11 +2,16 @@ using System.Net; using System.Web.Mvc; using System.Web.Routing; +using AutoMapper; +using WebsitePanel.Providers.HostedSolution; using WebsitePanel.WebDav.Core.Config; using WebsitePanel.WebDav.Core.Security.Authentication; using WebsitePanel.WebDav.Core.Security.Cryptography; +using WebsitePanel.WebDavPortal.CustomAttributes; using WebsitePanel.WebDavPortal.Models; +using WebsitePanel.WebDavPortal.Models.Account; using WebsitePanel.WebDavPortal.Models.Common; +using WebsitePanel.WebDavPortal.Models.Common.EditorTemplates; using WebsitePanel.WebDavPortal.Models.Common.Enums; using WebsitePanel.WebDavPortal.UI.Routes; using WebsitePanel.WebDav.Core.Interfaces.Security; @@ -14,7 +19,7 @@ using WebsitePanel.WebDav.Core; namespace WebsitePanel.WebDavPortal.Controllers { - [AllowAnonymous] + [LdapAuthorization] public class AccountController : Controller { private readonly ICryptography _cryptography; @@ -27,6 +32,8 @@ namespace WebsitePanel.WebDavPortal.Controllers } [HttpGet] + [AllowAnonymous] + public ActionResult Login() { if (WspContext.User != null && WspContext.User.Identity.IsAuthenticated) @@ -38,6 +45,7 @@ namespace WebsitePanel.WebDavPortal.Controllers } [HttpPost] + [AllowAnonymous] public ActionResult Login(AccountModel model) { var user = _authenticationService.LogIn(model.Login, model.Password); @@ -63,5 +71,114 @@ namespace WebsitePanel.WebDavPortal.Controllers return RedirectToRoute(AccountRouteNames.Login); } + + [HttpGet] + public ActionResult UserProfile() + { + var model = GetUserProfileModel(WspContext.User.ItemId, WspContext.User.AccountId); + + return View(model); + } + + [HttpPost] + [ValidateAntiForgeryToken] + public ActionResult UserProfile(UserProfile model) + { + if (!ModelState.IsValid) + { + return View(model); + } + + int result = UpdateUserProfile(WspContext.User.ItemId, WspContext.User.AccountId, model); + + model.AddMessage(MessageType.Success, Resources.UI.UserProfileSuccessfullyUpdated); + + return View(model); + } + + [HttpGet] + public ActionResult PasswordChange() + { + var model = new PasswordChangeModel(); + model.PasswordEditor.Settings = WspContext.Services.Organizations.GetOrganizationPasswordSettings(WspContext.User.ItemId); + + return View(model); + } + + [HttpPost] + public ActionResult PasswordChange(PasswordChangeModel model) + { + if (!ModelState.IsValid) + { + return View(model); + } + + if (_authenticationService.ValidateAuthenticationData(WspContext.User.Login, model.OldPassword) == false) + { + model.AddMessage(MessageType.Error, Resources.Messages.OldPasswordIsNotCorrect); + + return View(model); + } + + WspContext.Services.Organizations.SetUserPassword( + WspContext.User.ItemId, WspContext.User.AccountId, + model.PasswordEditor.NewPassword); + + return RedirectToRoute(AccountRouteNames.UserProfile); + } + + #region Helpers + + private UserProfile GetUserProfileModel(int itemId, int accountId) + { + var user = WspContext.Services.Organizations.GetUserGeneralSettings(itemId, accountId); + + return Mapper.Map(user); + } + + private int UpdateUserProfile(int itemId, int accountId, UserProfile model) + { + var user = WspContext.Services.Organizations.GetUserGeneralSettings(itemId, accountId); + + return WspContext.Services.Organizations.SetUserGeneralSettings( + itemId, accountId, + model.DisplayName, + string.Empty, + false, + user.Disabled, + user.Locked, + + model.FirstName, + model.Initials, + model.LastName, + + model.Address, + model.City, + model.State, + model.Zip, + model.Country, + + user.JobTitle, + user.Company, + user.Department, + user.Office, + user.Manager == null ? null : user.Manager.AccountName, + + model.BusinessPhone, + model.Fax, + model.HomePhone, + model.MobilePhone, + model.Pager, + model.WebPage, + model.Notes, + model.ExternalEmail, + user.SubscriberNumber, + user.LevelId, + user.IsVIP, + user.UserMustChangePassword); + } + + #endregion + } } \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/CustomAttributes/OrganizationPasswordPolicyAttribute.cs b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/CustomAttributes/OrganizationPasswordPolicyAttribute.cs new file mode 100644 index 00000000..14cfd4c1 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/CustomAttributes/OrganizationPasswordPolicyAttribute.cs @@ -0,0 +1,124 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.Linq; +using System.Web.Mvc; +using WebsitePanel.Providers.HostedSolution; +using WebsitePanel.WebDav.Core; + +namespace WebsitePanel.WebDavPortal.CustomAttributes +{ + [AttributeUsage(AttributeTargets.Property, AllowMultiple = false, Inherited = false)] + public class OrganizationPasswordPolicyAttribute : ValidationAttribute, IClientValidatable + { + public OrganizationPasswordSettings Settings { get; private set; } + + public OrganizationPasswordPolicyAttribute() + { + Settings = WspContext.Services.Organizations.GetOrganizationPasswordSettings(WspContext.User.ItemId); + } + + protected override ValidationResult IsValid(object value, ValidationContext validationContext) + { + if (value != null && WspContext.User != null) + { + + var resultMessages = new List(); + + if (Settings != null) + { + var valueString = value.ToString(); + + if (valueString.Length < Settings.MinimumLength) + { + resultMessages.Add(string.Format(Resources.Messages.PasswordMinLengthFormat, + Settings.MinimumLength)); + } + + if (valueString.Length > Settings.MaximumLength) + { + resultMessages.Add(string.Format(Resources.Messages.PasswordMaxLengthFormat, + Settings.MaximumLength)); + } + + if (Settings.PasswordComplexityEnabled) + { + var symbolsCount = valueString.Count(Char.IsSymbol); + var numbersCount = valueString.Count(Char.IsDigit); + var upperLetterCount = valueString.Count(Char.IsUpper); + + if (upperLetterCount < Settings.UppercaseLettersCount) + { + resultMessages.Add(string.Format(Resources.Messages.PasswordUppercaseCountFormat, + Settings.UppercaseLettersCount)); + } + + if (numbersCount < Settings.NumbersCount) + { + resultMessages.Add(string.Format(Resources.Messages.PasswordNumbersCountFormat, + Settings.NumbersCount)); + } + + if (symbolsCount < Settings.SymbolsCount) + { + resultMessages.Add(string.Format(Resources.Messages.PasswordSymbolsCountFormat, + Settings.SymbolsCount)); + } + } + + } + + return resultMessages.Any()? new ValidationResult(string.Join("
", resultMessages)) : ValidationResult.Success; + } + + return ValidationResult.Success; + } + + public IEnumerable GetClientValidationRules(ModelMetadata metadata, ControllerContext context) + { + var rule = new ModelClientValidationRule(); + + rule.ErrorMessage = string.Format(Resources.Messages.PasswordMinLengthFormat, Settings.MinimumLength); + rule.ValidationParameters.Add("count", Settings.MinimumLength); + rule.ValidationType = "minimumlength"; + + yield return rule; + + rule = new ModelClientValidationRule(); + + rule.ErrorMessage = string.Format(Resources.Messages.PasswordMaxLengthFormat, Settings.MaximumLength); + rule.ValidationParameters.Add("count", Settings.MaximumLength); + rule.ValidationType = "maximumlength"; + + yield return rule; + + if (Settings.PasswordComplexityEnabled) + { + rule = new ModelClientValidationRule(); + + rule.ErrorMessage = string.Format(Resources.Messages.PasswordUppercaseCountFormat, Settings.UppercaseLettersCount); + rule.ValidationParameters.Add("count", Settings.UppercaseLettersCount); + rule.ValidationType = "uppercasecount"; + + yield return rule; + + rule = new ModelClientValidationRule(); + + rule.ErrorMessage = string.Format(Resources.Messages.PasswordNumbersCountFormat, Settings.NumbersCount); + rule.ValidationParameters.Add("count", Settings.NumbersCount); + rule.ValidationType = "numberscount"; + + yield return rule; + + rule = new ModelClientValidationRule(); + + rule.ErrorMessage = string.Format(Resources.Messages.PasswordSymbolsCountFormat, Settings.SymbolsCount); + rule.ValidationParameters.Add("count", Settings.SymbolsCount); + rule.ValidationType = "symbolscount"; + + yield return rule; + } + } + + } +} \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/CustomAttributes/PhoneNumberAttribute.cs b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/CustomAttributes/PhoneNumberAttribute.cs new file mode 100644 index 00000000..92f4c862 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/CustomAttributes/PhoneNumberAttribute.cs @@ -0,0 +1,21 @@ +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.Web.Mvc; + +namespace WebsitePanel.WebDavPortal.CustomAttributes +{ + public class PhoneNumberAttribute : RegularExpressionAttribute, IClientValidatable + { + public const string PhonePattern = @"^\+?(\d[\d-. ]+)?(\([\d-. ]+\))?[\d-. ]+\d$"; + + public PhoneNumberAttribute() + : base(PhonePattern) + { + } + + public IEnumerable GetClientValidationRules(ModelMetadata metadata, ControllerContext context) + { + yield return new ModelClientValidationRegexRule(FormatErrorMessage(metadata.GetDisplayName()), Pattern); + } + } +} \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Global.asax.cs b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Global.asax.cs index fd14b881..fa9a357c 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Global.asax.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Global.asax.cs @@ -15,6 +15,7 @@ using WebsitePanel.WebDav.Core.Security.Authentication.Principals; using WebsitePanel.WebDav.Core.Security.Cryptography; using WebsitePanel.WebDavPortal.App_Start; using WebsitePanel.WebDavPortal.Controllers; +using WebsitePanel.WebDavPortal.CustomAttributes; using WebsitePanel.WebDavPortal.DependencyInjection; using WebsitePanel.WebDavPortal.HttpHandlers; using WebsitePanel.WebDavPortal.Mapping; @@ -39,6 +40,10 @@ namespace WebsitePanel.WebDavPortal Mapper.AssertConfigurationIsValid(); log4net.Config.XmlConfigurator.Configure(); + + DataAnnotationsModelValidatorProvider.RegisterAdapter( + typeof(PhoneNumberAttribute), + typeof(RegularExpressionAttributeAdapter)); } protected void Application_Error(object sender, EventArgs e) diff --git a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Mapping/AutoMapperPortalConfiguration.cs b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Mapping/AutoMapperPortalConfiguration.cs index 060bb3af..b13fbf4c 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Mapping/AutoMapperPortalConfiguration.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Mapping/AutoMapperPortalConfiguration.cs @@ -1,4 +1,5 @@ using AutoMapper; +using WebsitePanel.WebDavPortal.Mapping.Profiles.Account; using WebsitePanel.WebDavPortal.Mapping.Profiles.Webdav; namespace WebsitePanel.WebDavPortal.Mapping @@ -10,6 +11,7 @@ namespace WebsitePanel.WebDavPortal.Mapping Mapper.Initialize( config => { + config.AddProfile(); config.AddProfile(); }); } diff --git a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Mapping/Profiles/Account/UserProfileProfile.cs b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Mapping/Profiles/Account/UserProfileProfile.cs new file mode 100644 index 00000000..4f92103e --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Mapping/Profiles/Account/UserProfileProfile.cs @@ -0,0 +1,67 @@ +using System; +using System.IO; +using AutoMapper; +using WebsitePanel.Providers.HostedSolution; +using WebsitePanel.WebDav.Core.Client; +using WebsitePanel.WebDav.Core.Config; +using WebsitePanel.WebDav.Core.Extensions; +using WebsitePanel.WebDavPortal.Constants; +using WebsitePanel.WebDavPortal.FileOperations; +using WebsitePanel.WebDavPortal.Models.Account; +using WebsitePanel.WebDavPortal.Models.FileSystem; + +namespace WebsitePanel.WebDavPortal.Mapping.Profiles.Account +{ + public class UserProfileProfile : Profile + { + /// + /// Gets the name of the profile. + /// + /// + /// The name of the profile. + /// + public override string ProfileName + { + get + { + return this.GetType().Name; + } + } + + /// + /// Override this method in a derived class and call the CreateMap method to associate that map with this profile. + /// Avoid calling the class from this method. + /// + protected override void Configure() + { + Mapper.CreateMap() + .ForMember(ti => ti.PrimaryEmailAddress, x => x.MapFrom(hi => hi.PrimaryEmailAddress)) + .ForMember(ti => ti.DisplayName, x => x.MapFrom(hi => hi.DisplayName)) + .ForMember(ti => ti.DisplayName, x => x.MapFrom(hi => hi.DisplayName)) + .ForMember(ti => ti.AccountName, x => x.MapFrom(hi => hi.AccountName)) + .ForMember(ti => ti.FirstName, x => x.MapFrom(hi => hi.FirstName)) + .ForMember(ti => ti.Initials, x => x.MapFrom(hi => hi.Initials)) + .ForMember(ti => ti.LastName, x => x.MapFrom(hi => hi.LastName)) + .ForMember(ti => ti.JobTitle, x => x.MapFrom(hi => hi.JobTitle)) + .ForMember(ti => ti.Company, x => x.MapFrom(hi => hi.Company)) + .ForMember(ti => ti.Department, x => x.MapFrom(hi => hi.Department)) + .ForMember(ti => ti.Office, x => x.MapFrom(hi => hi.Office)) + .ForMember(ti => ti.BusinessPhone, x => x.MapFrom(hi => hi.BusinessPhone)) + .ForMember(ti => ti.Fax, x => x.MapFrom(hi => hi.Fax)) + .ForMember(ti => ti.HomePhone, x => x.MapFrom(hi => hi.HomePhone)) + .ForMember(ti => ti.MobilePhone, x => x.MapFrom(hi => hi.MobilePhone)) + .ForMember(ti => ti.Pager, x => x.MapFrom(hi => hi.Pager)) + .ForMember(ti => ti.WebPage, x => x.MapFrom(hi => hi.WebPage)) + .ForMember(ti => ti.Address, x => x.MapFrom(hi => hi.Address)) + .ForMember(ti => ti.City, x => x.MapFrom(hi => hi.City)) + .ForMember(ti => ti.State, x => x.MapFrom(hi => hi.State)) + .ForMember(ti => ti.Zip, x => x.MapFrom(hi => hi.Zip)) + .ForMember(ti => ti.Country, x => x.MapFrom(hi => hi.Country)) + .ForMember(ti => ti.Notes, x => x.MapFrom(hi => hi.Notes)) + .ForMember(ti => ti.PasswordExpirationDateTime, x => x.MapFrom(hi => hi.PasswordExpirationDateTime)) + .ForMember(ti => ti.ExternalEmail, x => x.MapFrom(hi => hi.ExternalEmail)) + .ForMember(ti => ti.Messages, x => x.Ignore()); + } + } +} + diff --git a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Mapping/Profiles/Webdav/ResourceTableItemProfile.cs b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Mapping/Profiles/Webdav/ResourceTableItemProfile.cs index 92987801..579911bc 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Mapping/Profiles/Webdav/ResourceTableItemProfile.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Mapping/Profiles/Webdav/ResourceTableItemProfile.cs @@ -44,12 +44,16 @@ namespace WebsitePanel.WebDavPortal.Mapping.Profiles.Webdav .ForMember(ti => ti.IconHref, x => x.MapFrom(hi => hi.ItemType == ItemType.Folder ? WebDavAppConfigManager.Instance.FileIcons.FolderPath.Trim('~') : WebDavAppConfigManager.Instance.FileIcons[Path.GetExtension(hi.DisplayName.Trim('/'))].Trim('~'))) .ForMember(ti => ti.IsTargetBlank, x => x.MapFrom(hi => openerManager.GetIsTargetBlank(hi))) .ForMember(ti => ti.LastModified, x => x.MapFrom(hi => hi.LastModified)) - .ForMember(ti => ti.LastModifiedFormated, x => x.MapFrom(hi => hi.LastModified == DateTime.MinValue ? "--" : (new WebDavResource(null, hi)).LastModified.ToString(Formtas.DateFormatWithTime))) + .ForMember(ti => ti.LastModifiedFormated, x => x.MapFrom(hi => hi.LastModified == DateTime.MinValue ? "--" : (new WebDavResource(null, hi)).LastModified.ToString(Formats.DateFormatWithTime))) .ForMember(ti => ti.Summary, x => x.MapFrom(hi => hi.Summary)) .ForMember(ti => ti.IsRoot, x => x.MapFrom(hi => hi.IsRootItem)) .ForMember(ti => ti.Size, x => x.MapFrom(hi => hi.ContentLength)) .ForMember(ti => ti.Quota, x => x.MapFrom(hi => hi.AllocatedSpace)) + .ForMember(ti => ti.Url, x => x.Ignore()) + .ForMember(ti => ti.FolderUrlAbsoluteString, x => x.Ignore()) + .ForMember(ti => ti.FolderUrlLocalString, x => x.Ignore()) + .ForMember(ti => ti.FolderName, x => x.Ignore()) .ForMember(ti => ti.IsFolder, x => x.MapFrom(hi => hi.ItemType == ItemType.Folder)); } } diff --git a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Models/Account/PasswordChangeModel.cs b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Models/Account/PasswordChangeModel.cs new file mode 100644 index 00000000..3efb943a --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Models/Account/PasswordChangeModel.cs @@ -0,0 +1,23 @@ +using System.ComponentModel.DataAnnotations; +using WebsitePanel.Providers.HostedSolution; +using WebsitePanel.WebDavPortal.Models.Common; +using WebsitePanel.WebDavPortal.Models.Common.EditorTemplates; + +namespace WebsitePanel.WebDavPortal.Models.Account +{ + public class PasswordChangeModel : BaseModel + { + [Display(ResourceType = typeof (Resources.UI), Name = "OldPassword")] + [Required(ErrorMessageResourceType = typeof (Resources.Messages), ErrorMessageResourceName = "Required")] + public string OldPassword { get; set; } + + [UIHint("PasswordEditor")] + public PasswordEditor PasswordEditor { get; set; } + + + public PasswordChangeModel() + { + PasswordEditor = new PasswordEditor(); + } + } +} \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Models/Account/UserProfile.cs b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Models/Account/UserProfile.cs new file mode 100644 index 00000000..a38046aa --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Models/Account/UserProfile.cs @@ -0,0 +1,62 @@ +using System; +using System.ComponentModel; +using System.ComponentModel.DataAnnotations; +using System.Security.AccessControl; +using WebsitePanel.WebDavPortal.CustomAttributes; +using WebsitePanel.WebDavPortal.Models.Common; + +namespace WebsitePanel.WebDavPortal.Models.Account +{ + public class UserProfile : BaseModel + { + [Display(ResourceType = typeof(Resources.UI), Name = "PrimaryEmail")] + [Required(ErrorMessageResourceType = typeof(Resources.Messages), ErrorMessageResourceName = "Required")] + [EmailAddress(ErrorMessageResourceType = typeof(Resources.Messages), ErrorMessageResourceName = "EmailInvalid", ErrorMessage = null)] + public string PrimaryEmailAddress { get; set; } + + [Display(ResourceType = typeof(Resources.UI), Name = "DisplayName")] + [Required(ErrorMessageResourceType = typeof(Resources.Messages), ErrorMessageResourceName = "Required")] + public string DisplayName { get; set; } + public string AccountName { get; set; } + public string FirstName { get; set; } + public string Initials { get; set; } + public string LastName { get; set; } + public string JobTitle { get; set; } + public string Company { get; set; } + public string Department { get; set; } + public string Office { get; set; } + + [PhoneNumber(ErrorMessageResourceType = typeof(Resources.Messages), ErrorMessageResourceName = "PhoneNumberInvalid")] + public string BusinessPhone { get; set; } + + [PhoneNumber(ErrorMessageResourceType = typeof(Resources.Messages), ErrorMessageResourceName = "PhoneNumberInvalid")] + public string Fax { get; set; } + + [PhoneNumber(ErrorMessageResourceType = typeof(Resources.Messages), ErrorMessageResourceName = "PhoneNumberInvalid")] + public string HomePhone { get; set; } + + [Display(ResourceType = typeof(Resources.UI), Name = "MobilePhone")] + [Required(ErrorMessageResourceType = typeof(Resources.Messages), ErrorMessageResourceName = "Required")] + [PhoneNumber(ErrorMessageResourceType = typeof(Resources.Messages), ErrorMessageResourceName = "PhoneNumberInvalid")] + public string MobilePhone { get; set; } + + [PhoneNumber(ErrorMessageResourceType = typeof(Resources.Messages), ErrorMessageResourceName = "PhoneNumberInvalid")] + public string Pager { get; set; } + + [Url(ErrorMessageResourceType = typeof(Resources.Messages), ErrorMessageResourceName = "UrlInvalid", ErrorMessage = null)] + public string WebPage { get; set; } + public string Address { get; set; } + public string City { get; set; } + public string State { get; set; } + public string Zip { get; set; } + + [EmailAddress(ErrorMessageResourceType = typeof(Resources.Messages), ErrorMessageResourceName = "EmailInvalid", ErrorMessage = null)] + public string ExternalEmail { get; set; } + + [UIHint("CountrySelector")] + public string Country { get; set; } + + public string Notes { get; set; } + public DateTime PasswordExpirationDateTime { get; set; } + } +} \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Models/Common/BaseModel.cs b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Models/Common/BaseModel.cs index 7622e201..77261fa8 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Models/Common/BaseModel.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Models/Common/BaseModel.cs @@ -17,7 +17,7 @@ namespace WebsitePanel.WebDavPortal.Models.Common { Messages.Add(new Message { - Type =type, + Type = type, Value = value }); } diff --git a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Models/Common/EditorTemplates/PasswordEditor.cs b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Models/Common/EditorTemplates/PasswordEditor.cs new file mode 100644 index 00000000..03b30a43 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Models/Common/EditorTemplates/PasswordEditor.cs @@ -0,0 +1,22 @@ +using System.ComponentModel.DataAnnotations; +using WebsitePanel.Providers.HostedSolution; +using WebsitePanel.WebDavPortal.CustomAttributes; + +namespace WebsitePanel.WebDavPortal.Models.Common.EditorTemplates +{ + public class PasswordEditor + { + + [Display(ResourceType = typeof(Resources.UI), Name = "NewPassword")] + [Required(ErrorMessageResourceType = typeof(Resources.Messages), ErrorMessageResourceName = "Required")] + [OrganizationPasswordPolicy] + public string NewPassword { get; set; } + + [Display(ResourceType = typeof(Resources.UI), Name = "NewPasswordConfirmation")] + [Required(ErrorMessageResourceType = typeof(Resources.Messages), ErrorMessageResourceName = "Required")] + [Compare("NewPassword", ErrorMessageResourceType = typeof(Resources.Messages), ErrorMessageResourceName = "PasswordDoesntMatch")] + public string NewPasswordConfirmation { get; set; } + + public OrganizationPasswordSettings Settings { get; set; } + } +} \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Resources/Messages.Designer.cs b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Resources/Messages.Designer.cs new file mode 100644 index 00000000..af62e425 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Resources/Messages.Designer.cs @@ -0,0 +1,162 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.33440 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace WebsitePanel.WebDavPortal.Resources { + using System; + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + public class Messages { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Messages() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + public static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("WebsitePanel.WebDavPortal.Resources.Messages", typeof(Messages).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + public static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + + /// + /// Looks up a localized string similar to Email is invalid. + /// + public static string EmailInvalid { + get { + return ResourceManager.GetString("EmailInvalid", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Old password is not correct. + /// + public static string OldPasswordIsNotCorrect { + get { + return ResourceManager.GetString("OldPasswordIsNotCorrect", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The password and confirmation password do not match.. + /// + public static string PasswordDoesntMatch { + get { + return ResourceManager.GetString("PasswordDoesntMatch", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Password should be maximum {0} characters. + /// + public static string PasswordMaxLengthFormat { + get { + return ResourceManager.GetString("PasswordMaxLengthFormat", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Password should be at least {0} characters. + /// + public static string PasswordMinLengthFormat { + get { + return ResourceManager.GetString("PasswordMinLengthFormat", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Password should contain at least {0} numbers. + /// + public static string PasswordNumbersCountFormat { + get { + return ResourceManager.GetString("PasswordNumbersCountFormat", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Password should contain at least {0} non-alphanumeric symbols. + /// + public static string PasswordSymbolsCountFormat { + get { + return ResourceManager.GetString("PasswordSymbolsCountFormat", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Password should contain at least {0} UPPERCASE characters. + /// + public static string PasswordUppercaseCountFormat { + get { + return ResourceManager.GetString("PasswordUppercaseCountFormat", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Phone number is invalid. + /// + public static string PhoneNumberInvalid { + get { + return ResourceManager.GetString("PhoneNumberInvalid", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to {0} field is required. + /// + public static string Required { + get { + return ResourceManager.GetString("Required", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Url is invalid. + /// + public static string UrlInvalid { + get { + return ResourceManager.GetString("UrlInvalid", resourceCulture); + } + } + } +} diff --git a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Resources/Messages.resx b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Resources/Messages.resx new file mode 100644 index 00000000..88beb538 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Resources/Messages.resx @@ -0,0 +1,153 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Email is invalid + + + Old password is not correct + + + The password and confirmation password do not match. + + + Password should be maximum {0} characters + + + Password should be at least {0} characters + + + Password should contain at least {0} numbers + + + Password should contain at least {0} non-alphanumeric symbols + + + Password should contain at least {0} UPPERCASE characters + + + Phone number is invalid + + + {0} field is required + + + Url is invalid + + \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Resources/UI.Designer.cs b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Resources/UI.Designer.cs index f9a6db66..a88478a0 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Resources/UI.Designer.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Resources/UI.Designer.cs @@ -69,6 +69,42 @@ namespace WebsitePanel.WebDavPortal.Resources { } } + /// + /// Looks up a localized string similar to Address. + /// + public static string Address { + get { + return ResourceManager.GetString("Address", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Address Inforamtion. + /// + public static string AddressInforamtion { + get { + return ResourceManager.GetString("AddressInforamtion", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Back. + /// + public static string Back { + get { + return ResourceManager.GetString("Back", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Business Phone. + /// + public static string BusinessPhone { + get { + return ResourceManager.GetString("BusinessPhone", resourceCulture); + } + } + /// /// Looks up a localized string similar to Byte. /// @@ -105,6 +141,24 @@ namespace WebsitePanel.WebDavPortal.Resources { } } + /// + /// Looks up a localized string similar to Change password. + /// + public static string ChangePassword { + get { + return ResourceManager.GetString("ChangePassword", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to City. + /// + public static string City { + get { + return ResourceManager.GetString("City", resourceCulture); + } + } + /// /// Looks up a localized string similar to Close. /// @@ -114,6 +168,15 @@ namespace WebsitePanel.WebDavPortal.Resources { } } + /// + /// Looks up a localized string similar to Company Information. + /// + public static string CompanyInformation { + get { + return ResourceManager.GetString("CompanyInformation", resourceCulture); + } + } + /// /// Looks up a localized string similar to Confirm. /// @@ -123,6 +186,24 @@ namespace WebsitePanel.WebDavPortal.Resources { } } + /// + /// Looks up a localized string similar to Contact Information. + /// + public static string ContactInformation { + get { + return ResourceManager.GetString("ContactInformation", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Country/Region. + /// + public static string Country { + get { + return ResourceManager.GetString("Country", resourceCulture); + } + } + /// /// Looks up a localized string similar to Create. /// @@ -168,6 +249,24 @@ namespace WebsitePanel.WebDavPortal.Resources { } } + /// + /// Looks up a localized string similar to Display Name. + /// + public static string DisplayName { + get { + return ResourceManager.GetString("DisplayName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Email. + /// + public static string Email { + get { + return ResourceManager.GetString("Email", resourceCulture); + } + } + /// /// Looks up a localized string similar to Please enter file name. /// @@ -204,6 +303,24 @@ namespace WebsitePanel.WebDavPortal.Resources { } } + /// + /// Looks up a localized string similar to External Email. + /// + public static string ExternalEmail { + get { + return ResourceManager.GetString("ExternalEmail", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Fax. + /// + public static string Fax { + get { + return ResourceManager.GetString("Fax", resourceCulture); + } + } + /// /// Looks up a localized string similar to File. /// @@ -231,6 +348,24 @@ namespace WebsitePanel.WebDavPortal.Resources { } } + /// + /// Looks up a localized string similar to First Name. + /// + public static string FirstName { + get { + return ResourceManager.GetString("FirstName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to General Information. + /// + public static string GeneralInformation { + get { + return ResourceManager.GetString("GeneralInformation", resourceCulture); + } + } + /// /// Looks up a localized string similar to Gb. /// @@ -240,6 +375,24 @@ namespace WebsitePanel.WebDavPortal.Resources { } } + /// + /// Looks up a localized string similar to Here. + /// + public static string Here { + get { + return ResourceManager.GetString("Here", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Home Phone. + /// + public static string HomePhone { + get { + return ResourceManager.GetString("HomePhone", resourceCulture); + } + } + /// /// Looks up a localized string similar to Info. /// @@ -249,6 +402,15 @@ namespace WebsitePanel.WebDavPortal.Resources { } } + /// + /// Looks up a localized string similar to Initials. + /// + public static string Initials { + get { + return ResourceManager.GetString("Initials", resourceCulture); + } + } + /// /// Looks up a localized string similar to File already exist. /// @@ -267,6 +429,15 @@ namespace WebsitePanel.WebDavPortal.Resources { } } + /// + /// Looks up a localized string similar to Job Title. + /// + public static string JobTitle { + get { + return ResourceManager.GetString("JobTitle", resourceCulture); + } + } + /// /// Looks up a localized string similar to KB. /// @@ -276,6 +447,33 @@ namespace WebsitePanel.WebDavPortal.Resources { } } + /// + /// Looks up a localized string similar to Last Name. + /// + public static string LastName { + get { + return ResourceManager.GetString("LastName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Login name. + /// + public static string LoginName { + get { + return ResourceManager.GetString("LoginName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Log out. + /// + public static string LogOut { + get { + return ResourceManager.GetString("LogOut", resourceCulture); + } + } + /// /// Looks up a localized string similar to MB. /// @@ -285,6 +483,15 @@ namespace WebsitePanel.WebDavPortal.Resources { } } + /// + /// Looks up a localized string similar to Mobile Phone. + /// + public static string MobilePhone { + get { + return ResourceManager.GetString("MobilePhone", resourceCulture); + } + } + /// /// Looks up a localized string similar to Modified. /// @@ -303,6 +510,24 @@ namespace WebsitePanel.WebDavPortal.Resources { } } + /// + /// Looks up a localized string similar to New password. + /// + public static string NewPassword { + get { + return ResourceManager.GetString("NewPassword", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Confirm password. + /// + public static string NewPasswordConfirmation { + get { + return ResourceManager.GetString("NewPasswordConfirmation", resourceCulture); + } + } + /// /// Looks up a localized string similar to No files are selected.. /// @@ -321,6 +546,24 @@ namespace WebsitePanel.WebDavPortal.Resources { } } + /// + /// Looks up a localized string similar to Notes. + /// + public static string Notes { + get { + return ResourceManager.GetString("Notes", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Old password. + /// + public static string OldPassword { + get { + return ResourceManager.GetString("OldPassword", resourceCulture); + } + } + /// /// Looks up a localized string similar to or drag and drop files here.. /// @@ -330,6 +573,33 @@ namespace WebsitePanel.WebDavPortal.Resources { } } + /// + /// Looks up a localized string similar to Pager. + /// + public static string Pager { + get { + return ResourceManager.GetString("Pager", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Password. + /// + public static string Password { + get { + return ResourceManager.GetString("Password", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Will expire on {0}. If you want to change password then please click {1}.. + /// + public static string PasswordExpirationFormat { + get { + return ResourceManager.GetString("PasswordExpirationFormat", resourceCulture); + } + } + /// /// Looks up a localized string similar to PB. /// @@ -357,6 +627,15 @@ namespace WebsitePanel.WebDavPortal.Resources { } } + /// + /// Looks up a localized string similar to Primary Email. + /// + public static string PrimaryEmail { + get { + return ResourceManager.GetString("PrimaryEmail", resourceCulture); + } + } + /// /// Looks up a localized string similar to Processing. /// @@ -375,6 +654,24 @@ namespace WebsitePanel.WebDavPortal.Resources { } } + /// + /// Looks up a localized string similar to Profile. + /// + public static string Profile { + get { + return ResourceManager.GetString("Profile", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Save Changes. + /// + public static string SaveChanges { + get { + return ResourceManager.GetString("SaveChanges", resourceCulture); + } + } + /// /// Looks up a localized string similar to Search. /// @@ -402,6 +699,15 @@ namespace WebsitePanel.WebDavPortal.Resources { } } + /// + /// Looks up a localized string similar to Select. + /// + public static string Select { + get { + return ResourceManager.GetString("Select", resourceCulture); + } + } + /// /// Looks up a localized string similar to Select files to upload. /// @@ -420,6 +726,15 @@ namespace WebsitePanel.WebDavPortal.Resources { } } + /// + /// Looks up a localized string similar to State/Province. + /// + public static string State { + get { + return ResourceManager.GetString("State", resourceCulture); + } + } + /// /// Looks up a localized string similar to Table. /// @@ -456,6 +771,24 @@ namespace WebsitePanel.WebDavPortal.Resources { } } + /// + /// Looks up a localized string similar to User profile successfully updated. + /// + public static string UserProfileSuccessfullyUpdated { + get { + return ResourceManager.GetString("UserProfileSuccessfullyUpdated", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Web Page. + /// + public static string WebPage { + get { + return ResourceManager.GetString("WebPage", resourceCulture); + } + } + /// /// Looks up a localized string similar to Word document. /// @@ -473,5 +806,14 @@ namespace WebsitePanel.WebDavPortal.Resources { return ResourceManager.GetString("Yes", resourceCulture); } } + + /// + /// Looks up a localized string similar to Zip/Postal Code. + /// + public static string Zip { + get { + return ResourceManager.GetString("Zip", resourceCulture); + } + } } } diff --git a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Resources/UI.resx b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Resources/UI.resx index 56929bcc..deda00a1 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Resources/UI.resx +++ b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Resources/UI.resx @@ -120,6 +120,18 @@ Actions + + Address + + + Address Inforamtion + + + Back + + + Business Phone + Byte @@ -132,12 +144,27 @@ Cancel All + + Change password + + + City + Close + + Company Information + Confirm + + Contact Information + + + Country/Region + Create @@ -153,6 +180,12 @@ Are you sure you want to delete {0} item(s)? + + Display Name + + + Email + Please enter file name @@ -165,6 +198,12 @@ Excel workbook + + External Email + + + Fax + File @@ -174,39 +213,90 @@ File Upload + + First Name + + + General Information + Gb + + Here + + + Home Phone + Info + + Initials + File already exist {0} items was removed. + + Job Title + KB + + Last Name + + + Login name + + + Log out + MB + + Mobile Phone + Modified Name + + New password + + + Confirm password + No files are selected. Not a file. + + Notes + + + Old password + or drag and drop files here. + + Pager + + + Password + + + Will expire on {0}. If you want to change password then please click {1}. + PB @@ -216,12 +306,21 @@ Powerpoint presentation + + Primary Email + Processing Processing... + + Profile + + + Save Changes + Search @@ -231,12 +330,18 @@ Search Results + + Select + Select files to upload Size + + State/Province + Table @@ -249,10 +354,19 @@ Upload + + User profile successfully updated + + + Web Page + Word document Yes + + Zip/Postal Code + \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Scripts/appScripts/validation/passwordeditor.unobtrusive.js b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Scripts/appScripts/validation/passwordeditor.unobtrusive.js new file mode 100644 index 00000000..799b8f82 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Scripts/appScripts/validation/passwordeditor.unobtrusive.js @@ -0,0 +1,54 @@ +/// +/// + + +$.validator.unobtrusive.adapters.addSingleVal("minimumlength", "count"); + +$.validator.addMethod("minimumlength", function (value, element, count) { + if (value.length < count) { + return false; + } + + return true; +}); + +$.validator.unobtrusive.adapters.addSingleVal("maximumlength", "count"); + +$.validator.addMethod("maximumlength", function (value, element, count) { + if (value.length > count) { + return false; + } + + return true; +}); + +$.validator.unobtrusive.adapters.addSingleVal("uppercasecount", "count"); + +$.validator.addMethod("uppercasecount", function (value, element, count) { + if (value.replace(/[^A-Z]/g, "").length < count) { + return false; + } + + return true; +}); + +$.validator.unobtrusive.adapters.addSingleVal("numberscount", "count"); + +$.validator.addMethod("numberscount", function (value, element, count) { + if (value.replace(/[^0-9]/g, "").length < count) { + return false; + } + + return true; +}); + +$.validator.unobtrusive.adapters.addSingleVal("symbolscount", "count"); + +$.validator.addMethod("symbolscount", function (value, element, count) { + if (value.replace(/[a-zA-Z0-9_]/g, "").length < count) { + + return false; + } + + return true; +}); \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Scripts/appScripts/wsp.js b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Scripts/appScripts/wsp.js index a45da0f1..96a4a5ff 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Scripts/appScripts/wsp.js +++ b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Scripts/appScripts/wsp.js @@ -10,25 +10,11 @@ $(document).on('click', '.processing-dialog', function (e) { }); -$(document).ready(function() { +$(document).ready(function () { + //bootstrap jquery validate styles fix - $.validator.setDefaults({ - highlight: function(element) { - $(element).closest('.form-group').addClass('has-error'); - }, - unhighlight: function(element) { - $(element).closest('.form-group').removeClass('has-error'); - }, - errorElement: 'span', - errorClass: 'help-block', - errorPlacement: function(error, element) { - if (element.parent('.input-group').length) { - error.insertAfter(element.parent()); - } else { - error.insertAfter(element); - } - } - }); + BindBootstrapValidationStyles(); + $.validator.addMethod("synchronousRemote", function(value, element, param) { if (this.optional(element)) { @@ -86,6 +72,60 @@ $(document).ready(function() { }, "Please fix this field."); }); +function BindBootstrapValidationStyles() { + $.validator.setDefaults({ + highlight: function (element) { + $(element).closest('.form-group').addClass('has-error'); + }, + unhighlight: function (element) { + $(element).closest('.form-group').removeClass('has-error'); + }, + errorElement: 'span', + errorClass: 'help-block', + errorPlacement: function (error, element) { + if (element.parent('.input-group').length) { + error.insertAfter(element.parent()); + } else { + error.insertAfter(element); + } + } + }); + + $('.bs-val-styles').each(function () { + var form = $(this); + var formData = $.data(form[0]); + if (formData && formData.validator) { + + var settings = formData.validator.settings; + // Store existing event handlers in local variables + var oldErrorPlacement = settings.errorPlacement; + var oldSuccess = settings.success; + + settings.errorPlacement = function (label, element) { + + oldErrorPlacement(label, element); + + element.closest('.form-group').addClass('has-error'); + label.addClass('text-danger'); + }; + + settings.success = function (label, element) { + $(element).closest('.form-group').removeClass('has-error'); + + oldSuccess(label); + } + } + }); + + $('.input-validation-error').each(function () { + $(this).closest('.form-group').addClass('has-error'); + }); + + $('.field-validation-error').each(function () { + $(this).addClass('text-danger'); + }); +} + $.fn.clearValidation = function () { var v = $(this).validate(); $('[name]', this).each(function () { v.successList.push(this); v.showErrors(); }); v.resetForm(); v.reset(); $(this).find('.form-group').removeClass('has-error'); }; diff --git a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Views/Account/PasswordChange.cshtml b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Views/Account/PasswordChange.cshtml new file mode 100644 index 00000000..dafe337e --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Views/Account/PasswordChange.cshtml @@ -0,0 +1,31 @@ +@using WebsitePanel.WebDavPortal.Resources +@using WebsitePanel.WebDavPortal.UI.Routes +@model WebsitePanel.WebDavPortal.Models.Account.PasswordChangeModel + +@{ + Layout = "~/Views/Shared/_Layout.cshtml"; +} +
+ @using (Html.BeginRouteForm(AccountRouteNames.PasswordChange, FormMethod.Post, new { @class = "form-horizontal user-password-change bs-val-styles col-lg-10 col-lg-offset-3", id = "user-password-change" })) + { +
+

@UI.ChangePassword

+
+
+ +
+ @Html.PasswordFor(x => x.OldPassword, new { @class = "form-control", placeholder = UI.OldPassword }) + @Html.ValidationMessageFor(x => x.OldPassword) +
+
+ + @Html.EditorFor(x=>x.PasswordEditor) + +
+
+ +
+
+ } +
+ diff --git a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Views/Account/UserProfile.cshtml b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Views/Account/UserProfile.cshtml new file mode 100644 index 00000000..b08841c4 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Views/Account/UserProfile.cshtml @@ -0,0 +1,212 @@ +@using WebsitePanel.WebDavPortal.Constants +@using WebsitePanel.WebDavPortal.Resources +@using WebsitePanel.WebDavPortal.UI.Routes +@model WebsitePanel.WebDavPortal.Models.Account.UserProfile + +@{ + Layout = "~/Views/Shared/_Layout.cshtml"; + + var passwordExpriationText = string.Format(UI.PasswordExpirationFormat, Model.PasswordExpirationDateTime.ToString(Formats.DateFormatWithTime), Html.RouteLink(UI.Here.ToLowerInvariant(), AccountRouteNames.PasswordChange)); +} + +
+ @using (Html.BeginRouteForm(AccountRouteNames.UserProfile, FormMethod.Post, new { @class = "form-horizontal user-profile bs-val-styles", id = "user-profile-form" })) + { + @Html.HiddenFor(x => x.PasswordExpirationDateTime) + @Html.HiddenFor(x => x.PrimaryEmailAddress) + @Html.AntiForgeryToken() + +
+
+ +
+
+ +
+ + +
+ +
+ +
+ @Html.TextBoxFor(x => x.DisplayName, new { @class = "form-control", placeholder = UI.DisplayName }) +
+
+ +
+ +
+ @Html.TextBoxFor(x => x.FirstName, new { @class = "form-control", placeholder = UI.FirstName }) +
+
+ +
+ +
+ @Html.TextBoxFor(x => x.Initials, new { @class = "form-control", placeholder = UI.Initials }) +
+
+ +
+ +
+ @Html.TextBoxFor(x => x.LastName, new { @class = "form-control", placeholder = UI.LastName }) +
+
+ +
+ +
+ @Html.TextAreaFor(x => x.Notes, new { @class = "form-control", placeholder = UI.Notes }) +
+
+ +
+ +
+ +
+
+ +
+ +
+ @Html.TextBoxFor(x => x.ExternalEmail, new { @class = "form-control", placeholder = UI.ExternalEmail }) +
+
+ +
+
+
+
+ +
+
+ +
+ +
+ @Html.TextBoxFor(x => x.BusinessPhone, new { @class = "form-control", placeholder = UI.BusinessPhone }) +
+
+ +
+ +
+ @Html.TextBoxFor(x => x.Fax, new { @class = "form-control", placeholder = UI.Fax }) +
+
+ +
+ +
+ @Html.TextBoxFor(x => x.HomePhone, new { @class = "form-control", placeholder = UI.HomePhone }) +
+
+ +
+ +
+ @Html.TextBoxFor(x => x.MobilePhone, new { @class = "form-control", placeholder = UI.MobilePhone }) +
+
+ +
+ +
+ @Html.TextBoxFor(x => x.Pager, new { @class = "form-control", placeholder = UI.Pager }) +
+
+ +
+ +
+ @Html.TextBoxFor(x => x.WebPage, new { @class = "form-control", placeholder = UI.WebPage }) +
+
+ +
+
+
+
+ +
+
+ +
+ +
+ @Html.TextBoxFor(x => x.Address, new { @class = "form-control", placeholder = UI.Address }) +
+
+ +
+ +
+ @Html.TextBoxFor(x => x.City, new { @class = "form-control", placeholder = UI.City }) +
+
+ +
+ +
+ @Html.TextBoxFor(x => x.State, new { @class = "form-control", placeholder = UI.State }) +
+
+ +
+ +
+ @Html.TextBoxFor(x => x.Zip, new { @class = "form-control", placeholder = UI.Zip }) +
+
+ +
+ +
+ @Html.EditorFor(x => x.Country) +
+
+ +
+
+
+
+ +
+
+ +
+
+ } +
+ + @section scripts{ + + } diff --git a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Views/Shared/EditorTemplates/CountrySelector.cshtml b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Views/Shared/EditorTemplates/CountrySelector.cshtml new file mode 100644 index 00000000..34e18c14 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Views/Shared/EditorTemplates/CountrySelector.cshtml @@ -0,0 +1,264 @@ +@using WebsitePanel.WebDavPortal.Resources +@model string + +@{ + List listItems = new List + { + new SelectListItem {Text = "Afghanistan", Value = "AF"}, + new SelectListItem {Text = "Aland Islands", Value = "AX"}, + new SelectListItem {Text = "Algeria", Value = "DZ"}, + new SelectListItem {Text = "American Samoa", Value = "AS"}, + new SelectListItem {Text = "Andorra", Value = "AD"}, + new SelectListItem {Text = "Angola", Value = "AO"}, + new SelectListItem {Text = "Anguilla", Value = "AI"}, + new SelectListItem {Text = "Antarctica", Value = "AQ"}, + new SelectListItem {Text = "Antigua and Barbuda", Value = "AG"}, + new SelectListItem {Text = "Argentina", Value = "AR"}, + new SelectListItem {Text = "Armenia", Value = "AM"}, + new SelectListItem {Text = "Aruba", Value = "AW"}, + new SelectListItem {Text = "Australia", Value = "AU"}, + }; + + var selectedItem = listItems.FirstOrDefault(x => x.Value == Model); + + if (selectedItem != null) + { + selectedItem.Selected = true; + } + + @*Austria + Azerbaijan + Bahamas + Bahrain + Bangladesh + Barbados + Belarus + Belgium + Belize + Benin + Bermuda + Bhutan + Bolivia, Plurinational State of + Bosnia and Herzegovina + Botswana + Bouvet Island + Brazil + British Indian Ocean Territory + Brunei Darussalam + Bulgaria + Burkina Faso + Burundi + Cambodia + Cameroon + Canada + Cape Verde + Cayman Islands + Central African Republic + Chad + Chile + China + Christmas Island + Cocos (Keeling) Islands + Colombia + Comoros + Congo + Congo, the Democratic Republic of the + Cook Islands + Costa Rica + Cote D'Ivoire + Croatia + Cuba + Cyprus + Czech Republic + Denmark + Djibouti + Dominica + Dominican Republic + Ecuador + Egypt + El Salvador + Equatorial Guinea + Eritrea + Estonia + Ethiopia + Falkland Islands (Malvinas) + Faroe Islands + Fiji + Finland + France + French Guiana + French Polynesia + French Southern Territories + Gabon + Gambia + Georgia + Germany + Ghana + Gibraltar + Greece + Greenland + Grenada + Guadeloupe + Guam + Guatemala + Guernsey + Guinea + Guinea-Bissau + Guyana + Haiti + Heard Island and Mcdonald Islands + Holy See (Vatican City State) + Honduras + Hong Kong + Hungary + Iceland + India + Indonesia + Iran, Islamic Republic of + Iraq + Ireland + Isle of Man + Israel + Italy + Jamaica + Japan + Jersey + Jordan + Kazakhstan + Kenya + Kiribati + Korea, Democratic People's Republic of + Korea, Republic of + Kuwait + Kyrgyzstan + Lao People's Democratic Republic + Latvia + Lebanon + Lesotho + Liberia + Libyan Arab Jamahiriya + Liechtenstein + Lithuania + Luxembourg + Macao + Macedonia, the Former Yugoslav Republic of + Madagascar + Malawi + Malaysia + Maldives + Mali + Malta + Marshall Islands + Martinique + Mauritania + Mauritius + Mayotte + Mexico + Micronesia, Federated States of + Moldova, Republic of + Monaco + Mongolia + Montenegro + Montserrat + Morocco + Mozambique + Myanmar + Namibia + Nauru + Nepal + Netherlands + Netherlands Antilles + New Caledonia + New Zealand + Nicaragua + Niger + Nigeria + Niue + Norfolk Island + Northern Mariana Islands + Norway + Oman + Pakistan + Palau + Palestinian Territory, Occupied + Panama + Papua New Guinea + Paraguay + Peru + Philippines + Pitcairn + Poland + Portugal + Puerto Rico + Qatar + Reunion + Romania + Russian Federation + Rwanda + Saint Barthelemy + Saint Helena + Saint Kitts and Nevis + Saint Lucia + Saint Martin + Saint Pierre and Miquelon + Saint Vincent and the Grenadines + Samoa + San Marino + Sao Tome and Principe + Saudi Arabia + Senegal + Serbia + Seychelles + Sierra Leone + Singapore + Slovakia + Slovenia + Solomon Islands + Somalia + South Africa + South Georgia and the South Sandwich Islands + Spain + Sri Lanka + Sudan + Suriname + Svalbard and Jan Mayen + Swaziland + Sweden + Switzerland + Syrian Arab Republic + Taiwan, Province of China + Tajikistan + Tanzania, United Republic of + Thailand + Timor-Leste + Togo + Tokelau + Tonga + Trinidad and Tobago + Tunisia + Turkey + Turkmenistan + Turks and Caicos Islands + Tuvalu + Uganda + Ukraine + United Arab Emirates + United Kingdom + United States + United States Minor Outlying Islands + Uruguay + Uzbekistan + Vanuatu + Venezuela, Bolivarian Republic of + Viet Nam + Virgin Islands, British + Virgin Islands, U.S. + Wallis and Futuna + Western Sahara + Yemen + Zambia + Zimbabwe*@ + +} + +@Html.DropDownListFor(model => model, listItems, @UI.Select, new { @class = "form-control" }) \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Views/Shared/EditorTemplates/PasswordEditor.cshtml b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Views/Shared/EditorTemplates/PasswordEditor.cshtml new file mode 100644 index 00000000..d285f042 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Views/Shared/EditorTemplates/PasswordEditor.cshtml @@ -0,0 +1,22 @@ +@using WebsitePanel.WebDavPortal.Resources +@model WebsitePanel.WebDavPortal.Models.Common.EditorTemplates.PasswordEditor + +@{ + var settings = Model.Settings; + var maxlength = settings != null ? settings.MaximumLength : 20; +} +
+ +
+ @Html.PasswordFor(x => x.NewPassword, new { @class = "form-control", placeholder = UI.NewPassword, maxlength }) + @Html.Raw(HttpUtility.HtmlDecode(Html.ValidationMessageFor(m => m.NewPassword).ToHtmlString())) +
+
+ +
+ +
+ @Html.PasswordFor(x => x.NewPasswordConfirmation, new { @class = "form-control", placeholder = UI.NewPasswordConfirmation, maxlength }) + @Html.ValidationMessageFor(x => x.NewPasswordConfirmation) +
+
diff --git a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Views/Shared/_Layout.cshtml b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Views/Shared/_Layout.cshtml index ba5378f3..25cc02b3 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Views/Shared/_Layout.cshtml +++ b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Views/Shared/_Layout.cshtml @@ -4,6 +4,7 @@ @using WebsitePanel.WebDav.Core.Config @using WebsitePanel.WebDavPortal.DependencyInjection @using WebsitePanel.WebDavPortal.Models +@using WebsitePanel.WebDavPortal.Resources @using WebsitePanel.WebDavPortal.UI.Routes; @model WebsitePanel.WebDavPortal.Models.Common.BaseModel @@ -26,7 +27,7 @@ - + @@ -34,8 +35,8 @@ @{ if (WspContext.User != null) { - - + + @WspContext.User.Login } } @@ -65,9 +66,9 @@ @Scripts.Render("~/bundles/authScripts") } diff --git a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/WebsitePanel.WebDavPortal.csproj b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/WebsitePanel.WebDavPortal.csproj index 21db106b..67af8355 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/WebsitePanel.WebDavPortal.csproj +++ b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/WebsitePanel.WebDavPortal.csproj @@ -165,13 +165,15 @@ - + + + @@ -188,9 +190,12 @@ + + + @@ -198,6 +203,7 @@ + @@ -208,6 +214,11 @@ + + True + True + Messages.resx + True True @@ -380,6 +391,7 @@ + @@ -465,6 +477,10 @@ + + + + @@ -481,6 +497,10 @@ + + PublicResXFileCodeGenerator + Messages.Designer.cs + PublicResXFileCodeGenerator UI.Designer.cs diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/App_GlobalResources/WebsitePanel_SharedResources.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/App_GlobalResources/WebsitePanel_SharedResources.ascx.resx index 490b50b0..b9b15589 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/App_GlobalResources/WebsitePanel_SharedResources.ascx.resx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/App_GlobalResources/WebsitePanel_SharedResources.ascx.resx @@ -5716,4 +5716,7 @@ Error during updating settings. + + Unable to load password settings + \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeCreateMailbox.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeCreateMailbox.ascx.cs index 20d3049f..84e1404d 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeCreateMailbox.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeCreateMailbox.ascx.cs @@ -129,24 +129,7 @@ namespace WebsitePanel.Portal.ExchangeServer } 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"); - } + messageBox.ShowErrorMessage("UNABLETOLOADPASSWORDSETTINGS"); } } diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationCreateUser.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationCreateUser.ascx.cs index 11f190db..217ac7f0 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationCreateUser.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationCreateUser.ascx.cs @@ -82,24 +82,7 @@ namespace WebsitePanel.Portal.HostedSolution } 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"); - } + messageBox.ShowErrorMessage("UNABLETOLOADPASSWORDSETTINGS"); } } diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationUserGeneralSettings.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationUserGeneralSettings.ascx.cs index 7eed531f..c4baf96b 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationUserGeneralSettings.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationUserGeneralSettings.ascx.cs @@ -272,24 +272,7 @@ namespace WebsitePanel.Portal.HostedSolution } 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"); - } + messageBox.ShowErrorMessage("UNABLETOLOADPASSWORDSETTINGS"); } }