From afae6c4a6d2678514cc8a78d711c40a63bdb65cc Mon Sep 17 00:00:00 2001 From: vfedosevich Date: Tue, 28 Apr 2015 06:24:39 -0700 Subject: [PATCH] password reset link changed in setup letter --- .../ExchangeServerProxy.cs | 29 +++++++++++-------- .../ExchangeServerController.cs | 14 ++++----- .../HostedSolution/OrganizationController.cs | 15 ++++++---- .../esExchangeServer.asmx.cs | 4 +-- .../ExchangeCreateMailbox.ascx.cs | 2 +- .../ExchangeMailboxSetupInstructions.ascx.cs | 7 ++++- .../UserControls/MailboxTabs.ascx.cs | 2 +- 7 files changed, 44 insertions(+), 29 deletions(-) diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Client/ExchangeServerProxy.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Client/ExchangeServerProxy.cs index dbc4e005..d54d8eb3 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Client/ExchangeServerProxy.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Client/ExchangeServerProxy.cs @@ -11,6 +11,12 @@ // // This source code was auto-generated by wsdl, Version=2.0.50727.3038. // + +using WebsitePanel.Providers; +using WebsitePanel.Providers.Common; +using WebsitePanel.Providers.HostedSolution; +using WebsitePanel.Providers.ResultObjects; + namespace WebsitePanel.EnterpriseServer { using System.Xml.Serialization; using System.Web.Services; @@ -19,10 +25,6 @@ namespace WebsitePanel.EnterpriseServer { using System; using System.Diagnostics; using System.Data; - using WebsitePanel.Providers.HostedSolution; - using WebsitePanel.Providers.Common; - using WebsitePanel.Providers.ResultObjects; - using WebsitePanel.Providers; /// @@ -4311,24 +4313,26 @@ namespace WebsitePanel.EnterpriseServer { /// [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/GetMailboxSetupInstructions", RequestNamespace="http://smbsaas/websitepanel/enterpriseserver", ResponseNamespace="http://smbsaas/websitepanel/enterpriseserver", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] - public string GetMailboxSetupInstructions(int itemId, int accountId, bool pmm, bool emailMode, bool signup) { + public string GetMailboxSetupInstructions(int itemId, int accountId, bool pmm, bool emailMode, bool signup, string passwordResetUrl) { object[] results = this.Invoke("GetMailboxSetupInstructions", new object[] { itemId, accountId, pmm, emailMode, - signup}); + signup, + passwordResetUrl}); return ((string)(results[0])); } /// - public System.IAsyncResult BeginGetMailboxSetupInstructions(int itemId, int accountId, bool pmm, bool emailMode, bool signup, System.AsyncCallback callback, object asyncState) { + public System.IAsyncResult BeginGetMailboxSetupInstructions(int itemId, int accountId, bool pmm, bool emailMode, bool signup, string passwordResetUrl, System.AsyncCallback callback, object asyncState) { return this.BeginInvoke("GetMailboxSetupInstructions", new object[] { itemId, accountId, pmm, emailMode, - signup}, callback, asyncState); + signup, + passwordResetUrl}, callback, asyncState); } /// @@ -4338,12 +4342,12 @@ namespace WebsitePanel.EnterpriseServer { } /// - public void GetMailboxSetupInstructionsAsync(int itemId, int accountId, bool pmm, bool emailMode, bool signup) { - this.GetMailboxSetupInstructionsAsync(itemId, accountId, pmm, emailMode, signup, null); + public void GetMailboxSetupInstructionsAsync(int itemId, int accountId, bool pmm, bool emailMode, bool signup, string passwordResetUrl) { + this.GetMailboxSetupInstructionsAsync(itemId, accountId, pmm, emailMode, signup, passwordResetUrl, null); } /// - public void GetMailboxSetupInstructionsAsync(int itemId, int accountId, bool pmm, bool emailMode, bool signup, object userState) { + public void GetMailboxSetupInstructionsAsync(int itemId, int accountId, bool pmm, bool emailMode, bool signup, string passwordResetUrl, object userState) { if ((this.GetMailboxSetupInstructionsOperationCompleted == null)) { this.GetMailboxSetupInstructionsOperationCompleted = new System.Threading.SendOrPostCallback(this.OnGetMailboxSetupInstructionsOperationCompleted); } @@ -4352,7 +4356,8 @@ namespace WebsitePanel.EnterpriseServer { accountId, pmm, emailMode, - signup}, this.GetMailboxSetupInstructionsOperationCompleted, userState); + signup, + passwordResetUrl}, this.GetMailboxSetupInstructionsOperationCompleted, userState); } private void OnGetMailboxSetupInstructionsOperationCompleted(object arg) { diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/ExchangeServer/ExchangeServerController.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/ExchangeServer/ExchangeServerController.cs index 12ea3e0a..28402df7 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/ExchangeServer/ExchangeServerController.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/ExchangeServer/ExchangeServerController.cs @@ -2564,7 +2564,7 @@ namespace WebsitePanel.EnterpriseServer } } - public static string GetMailboxSetupInstructions(int itemId, int accountId, bool pmm, bool emailMode, bool signup) + public static string GetMailboxSetupInstructions(int itemId, int accountId, bool pmm, bool emailMode, bool signup, string passwordResetUrl) { #region Demo Mode if (IsDemoMode) @@ -2589,12 +2589,11 @@ namespace WebsitePanel.EnterpriseServer if (String.IsNullOrEmpty(body)) return null; - string result = EvaluateMailboxTemplate(itemId, accountId, pmm, false, false, body); + string result = EvaluateMailboxTemplate(itemId, accountId, pmm, false, false, body, passwordResetUrl); return user.HtmlMail ? result : result.Replace("\n", "
"); } - private static string EvaluateMailboxTemplate(int itemId, int accountId, - bool pmm, bool emailMode, bool signup, string template) + private static string EvaluateMailboxTemplate(int itemId, int accountId, bool pmm, bool emailMode, bool signup, string template, string passwordResetUrl) { Hashtable items = new Hashtable(); @@ -2618,7 +2617,8 @@ namespace WebsitePanel.EnterpriseServer Guid token; - var passwordResetUrl = OrganizationController.GenerateUserPasswordResetLink(account.ItemId, account.AccountId,out token); + passwordResetUrl = OrganizationController.GenerateUserPasswordResetLink(account.ItemId, account.AccountId, out token, string.Empty, passwordResetUrl); + if (!string.IsNullOrEmpty(passwordResetUrl)) { items["PswResetUrl"] = passwordResetUrl; @@ -2696,8 +2696,8 @@ namespace WebsitePanel.EnterpriseServer if (to == null) to = user.Email; - subject = EvaluateMailboxTemplate(itemId, accountId, false, true, signup, subject); - body = EvaluateMailboxTemplate(itemId, accountId, false, true, signup, body); + subject = EvaluateMailboxTemplate(itemId, accountId, false, true, signup, subject, string.Empty); + body = EvaluateMailboxTemplate(itemId, accountId, false, true, signup, body, string.Empty); // send message return MailHelper.SendMessage(from, to, cc, subject, body, priority, isHtml); diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/HostedSolution/OrganizationController.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/HostedSolution/OrganizationController.cs index 53e1527e..13d20ed1 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/HostedSolution/OrganizationController.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/HostedSolution/OrganizationController.cs @@ -1858,18 +1858,23 @@ namespace WebsitePanel.EnterpriseServer return SystemController.GetSystemSettingsInternal(SystemSettings.WEBDAV_PORTAL_SETTINGS, false); } - public static string GenerateUserPasswordResetLink(int itemId, int accountId, out Guid tokenGuid, string pincode = null) + public static string GenerateUserPasswordResetLink(int itemId, int accountId, out Guid tokenGuid, string pincode = null, string resetUrl = null) { - string passwordResetUrlFormat = string.IsNullOrEmpty(pincode) ? "account/password-reset/step-2" : "account/password-reset/step-final"; - var settings = GetWebDavSystemSettings(); + tokenGuid = new Guid(); - if (settings == null || !settings.GetValueOrDefault(SystemSettings.WEBDAV_PASSWORD_RESET_ENABLED_KEY, false) ||!settings.Contains("WebdavPortalUrl")) + if (settings == null || !settings.GetValueOrDefault(SystemSettings.WEBDAV_PASSWORD_RESET_ENABLED_KEY, false) || !settings.Contains("WebdavPortalUrl")) { - tokenGuid = new Guid(); return string.Empty; } + if (string.IsNullOrEmpty(resetUrl) == false) + { + return resetUrl; + } + + string passwordResetUrlFormat = string.IsNullOrEmpty(pincode) ? "account/password-reset/step-2" : "account/password-reset/step-final"; + var webdavPortalUrl = new Uri(settings["WebdavPortalUrl"]); var token = CreateAccessToken(itemId, accountId, AccessTokenTypes.PasswrodReset); diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/esExchangeServer.asmx.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/esExchangeServer.asmx.cs index 7facde41..f3c56160 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/esExchangeServer.asmx.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/esExchangeServer.asmx.cs @@ -315,9 +315,9 @@ namespace WebsitePanel.EnterpriseServer } [WebMethod] - public string GetMailboxSetupInstructions(int itemId, int accountId, bool pmm, bool emailMode, bool signup) + public string GetMailboxSetupInstructions(int itemId, int accountId, bool pmm, bool emailMode, bool signup, string passwordResetUrl) { - return ExchangeServerController.GetMailboxSetupInstructions(itemId, accountId, pmm, emailMode, signup); + return ExchangeServerController.GetMailboxSetupInstructions(itemId, accountId, pmm, emailMode, signup, passwordResetUrl); } [WebMethod] 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 84e1404d..5608b564 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeCreateMailbox.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeCreateMailbox.ascx.cs @@ -51,7 +51,7 @@ namespace WebsitePanel.Portal.ExchangeServer { BindPasswordSettings(); - string instructions = ES.Services.ExchangeServer.GetMailboxSetupInstructions(PanelRequest.ItemID, PanelRequest.AccountID, false, false, false); + string instructions = ES.Services.ExchangeServer.GetMailboxSetupInstructions(PanelRequest.ItemID, PanelRequest.AccountID, false, false, false, " "); if (!string.IsNullOrEmpty(instructions)) { chkSendInstructions.Checked = chkSendInstructions.Visible = sendInstructionEmail.Visible = true; diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeMailboxSetupInstructions.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeMailboxSetupInstructions.ascx.cs index cac46a87..74247673 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeMailboxSetupInstructions.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeMailboxSetupInstructions.ascx.cs @@ -47,7 +47,12 @@ namespace WebsitePanel.Portal.ExchangeServer // load content litContent.Text = ES.Services.ExchangeServer.GetMailboxSetupInstructions( PanelRequest.ItemID, PanelRequest.AccountID, - false, false, false); + false, false, false, + PortalUtils.EditUrl("ItemID", PanelRequest.ItemID.ToString(), + "user_reset_password", + "SpaceID=" + PanelSecurity.PackageId, + "Context=Mailbox", + "AccountID=" + PanelRequest.AccountID).Trim('~')); // bind user details PackageInfo package = ES.Services.Packages.GetPackage(PanelSecurity.PackageId); diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/UserControls/MailboxTabs.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/UserControls/MailboxTabs.ascx.cs index 5dd96f73..adc6e55e 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/UserControls/MailboxTabs.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/UserControls/MailboxTabs.ascx.cs @@ -70,7 +70,7 @@ namespace WebsitePanel.Portal.ExchangeServer.UserControls if (!hideItems) tabsList.Add(CreateTab("mailbox_mailflow", "Tab.Mailflow")); if (!hideItems) tabsList.Add(CreateTab("mailbox_permissions", "Tab.Permissions")); - string instructions = ES.Services.ExchangeServer.GetMailboxSetupInstructions(PanelRequest.ItemID, PanelRequest.AccountID, false, false, false); + string instructions = ES.Services.ExchangeServer.GetMailboxSetupInstructions(PanelRequest.ItemID, PanelRequest.AccountID, false, false, false, " "); if (!string.IsNullOrEmpty(instructions)) tabsList.Add(CreateTab("mailbox_setup", "Tab.Setup"));