diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Base/System/SystemSettings.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Base/System/SystemSettings.cs
index d713ba88..ba6a885f 100644
--- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Base/System/SystemSettings.cs
+++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Base/System/SystemSettings.cs
@@ -56,6 +56,7 @@ namespace WebsitePanel.EnterpriseServer
public const string TWILIO_PHONEFROM_KEY = "TwilioPhoneFrom";
public const string WEBDAV_PASSWORD_RESET_ENABLED_KEY = "WebdavPswResetEnabled";
+ public const string WEBDAV_PASSWORD_RESET_LINK_LIFE_SPAN = "WebdavPswdResetLinkLifeSpan";
// key to access to wpi main & custom feed in wpi settings
public const string WPI_MAIN_FEED_KEY = "WpiMainFeedUrl";
diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/HostedSolution/OrganizationController.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/HostedSolution/OrganizationController.cs
index 13d20ed1..fbf7b81e 100644
--- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/HostedSolution/OrganizationController.cs
+++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/HostedSolution/OrganizationController.cs
@@ -1877,7 +1877,9 @@ namespace WebsitePanel.EnterpriseServer
var webdavPortalUrl = new Uri(settings["WebdavPortalUrl"]);
- var token = CreateAccessToken(itemId, accountId, AccessTokenTypes.PasswrodReset);
+ var hours = settings.GetValueOrDefault(SystemSettings.WEBDAV_PASSWORD_RESET_LINK_LIFE_SPAN, 1);
+
+ var token = CreateAccessToken(itemId, accountId, AccessTokenTypes.PasswrodReset, hours);
tokenGuid = token.AccessTokenGuid;
@@ -1892,7 +1894,7 @@ namespace WebsitePanel.EnterpriseServer
return resultUrl.ToString();
}
- private static AccessToken CreateAccessToken(int itemId, int accountId, AccessTokenTypes type)
+ private static AccessToken CreateAccessToken(int itemId, int accountId, AccessTokenTypes type, int hours)
{
var token = new AccessToken
{
@@ -1900,7 +1902,7 @@ namespace WebsitePanel.EnterpriseServer
ItemId = itemId,
AccountId = accountId,
TokenType = type,
- ExpirationDate = DateTime.Now.AddHours(12)
+ ExpirationDate = DateTime.Now.AddHours(hours)
};
token.Id = DataProvider.AddAccessToken(token);
@@ -2890,6 +2892,7 @@ namespace WebsitePanel.EnterpriseServer
OrganizationUser retUser = orgProxy.GetOrganizationUserWithExtraData(accountName, org.OrganizationId);
retUser.AccountId = accountId;
+ retUser.ItemId = itemId;
retUser.AccountName = account.AccountName;
retUser.PrimaryEmailAddress = account.PrimaryEmailAddress;
retUser.AccountType = account.AccountType;
diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution/OrganizationProvider.cs b/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution/OrganizationProvider.cs
index 7aae57fa..a60a5682 100644
--- a/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution/OrganizationProvider.cs
+++ b/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution/OrganizationProvider.cs
@@ -576,6 +576,11 @@ namespace WebsitePanel.Providers.HostedSolution
if (span != null)
{
+ if (span.Value.Duration() == new TimeSpan().Duration())
+ {
+ return TimeSpan.MaxValue;
+ }
+
return span.Value;
}
}
@@ -679,15 +684,15 @@ namespace WebsitePanel.Providers.HostedSolution
if (!FineGrainedPasswordPolicyExist(runspace, psoName))
{
CreateFineGrainedPasswordPolicy(runspace, organizationId, psoName, settings);
-
- string groupPath = GetGroupPath(organizationId);
-
- SetFineGrainedPasswordPolicySubject(runspace, groupPath, psoName);
}
else
{
UpdateFineGrainedPasswordPolicy(runspace, psoName, settings);
}
+
+ string groupPath = GetGroupPath(organizationId);
+
+ SetFineGrainedPasswordPolicySubject(runspace, groupPath, psoName);
}
catch (Exception ex)
{
@@ -759,12 +764,12 @@ namespace WebsitePanel.Providers.HostedSolution
var cmd = new Command("Add-ADFineGrainedPasswordPolicySubject");
cmd.Parameters.Add("Identity", psoName);
- cmd.Parameters.Add("Subjects", entry.Properties[ADAttributes.SAMAccountName].Value.ToString());
+ cmd.Parameters.Add("Subjects", entry.Properties[ADAttributes.DistinguishedName].Value.ToString());
ExecuteShellCommand(runspace, cmd);
cmd = new Command("Set-ADGroup");
- cmd.Parameters.Add("Identity", entry.Properties[ADAttributes.SAMAccountName].Value.ToString());
+ cmd.Parameters.Add("Identity", entry.Properties[ADAttributes.DistinguishedName].Value.ToString());
cmd.Parameters.Add("GroupScope", "Global");
ExecuteShellCommand(runspace, cmd);
diff --git a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Controllers/AccountController.cs b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Controllers/AccountController.cs
index b63a7e2d..5d383a1b 100644
--- a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Controllers/AccountController.cs
+++ b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Controllers/AccountController.cs
@@ -267,15 +267,21 @@ namespace WebsitePanel.WebDavPortal.Controllers
return result;
}
+ var tokenEntity = WspContext.Services.Organizations.GetPasswordresetAccessToken(token);
+ var account = WspContext.Services.Organizations.GetUserGeneralSettings(tokenEntity.ItemId,
+ tokenEntity.AccountId);
- var model = new PasswordEditor();
+ var model = new PasswordResetFinalStepModel();
+
+ model.PasswordEditor.Settings = WspContext.Services.Organizations.GetOrganizationPasswordSettings(tokenEntity.ItemId);
+ model.Login = account.UserPrincipalName;
return View(model);
}
[HttpPost]
[AllowAnonymous]
- public ActionResult PasswordResetFinalStep(Guid token, string pincode, PasswordEditor model)
+ public ActionResult PasswordResetFinalStep(Guid token, string pincode, PasswordResetFinalStepModel model)
{
if (!ModelState.IsValid)
{
@@ -293,12 +299,10 @@ namespace WebsitePanel.WebDavPortal.Controllers
WspContext.Services.Organizations.SetUserPassword(
tokenEntity.ItemId, tokenEntity.AccountId,
- model.NewPassword);
+ model.PasswordEditor.NewPassword);
WspContext.Services.Organizations.DeletePasswordresetAccessToken(token);
- AddMessage(MessageType.Success, Resources.Messages.PasswordSuccessfullyChanged);
-
return RedirectToRoute(AccountRouteNames.PasswordResetSuccess);
}
diff --git a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Models/Account/PasswordResetFinalStepModel.cs b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Models/Account/PasswordResetFinalStepModel.cs
new file mode 100644
index 00000000..4bb82f03
--- /dev/null
+++ b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Models/Account/PasswordResetFinalStepModel.cs
@@ -0,0 +1,15 @@
+using WebsitePanel.WebDavPortal.Models.Common.EditorTemplates;
+
+namespace WebsitePanel.WebDavPortal.Models.Account
+{
+ public class PasswordResetFinalStepModel
+ {
+ public PasswordResetFinalStepModel()
+ {
+ PasswordEditor = new PasswordEditor();
+ }
+
+ public string Login { get; set; }
+ public PasswordEditor PasswordEditor { get; set; }
+ }
+}
\ 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 4fc8c9ae..0df331bf 100644
--- a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Resources/UI.Designer.cs
+++ b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Resources/UI.Designer.cs
@@ -654,6 +654,15 @@ namespace WebsitePanel.WebDavPortal.Resources {
}
}
+ ///