password reset fixes

This commit is contained in:
vfedosevich 2015-04-22 03:27:29 -07:00
parent 6f06614e8f
commit 0287c26f95
6 changed files with 87 additions and 16 deletions

View file

@ -47,7 +47,7 @@ namespace WebsitePanel.EnterpriseServer
public const string PACKAGE_DISPLAY_SETTINGS = "PackageDisplaySettings"; public const string PACKAGE_DISPLAY_SETTINGS = "PackageDisplaySettings";
public const string RDS_SETTINGS = "RdsSettings"; public const string RDS_SETTINGS = "RdsSettings";
public const string WEBDAV_PORTAL_SETTINGS = "WebdavPortalSettings"; public const string WEBDAV_PORTAL_SETTINGS = "WebdavPortalSettings";
public const string WEBDAV_PASSWORD_RESET_ENABLED_KEY = "WebdavPasswordResetEnabled"; public const string WEBDAV_PASSWORD_RESET_ENABLED_KEY = "WebdavPswResetEnabled";
// key to access to wpi main & custom feed in wpi settings // key to access to wpi main & custom feed in wpi settings
public const string WPI_MAIN_FEED_KEY = "WpiMainFeedUrl"; public const string WPI_MAIN_FEED_KEY = "WpiMainFeedUrl";

View file

@ -50,6 +50,8 @@ namespace WebsitePanel.EnterpriseServer.HostedSolution {
private System.Threading.SendOrPostCallback UpdateOrganizationPasswordSettingsOperationCompleted; private System.Threading.SendOrPostCallback UpdateOrganizationPasswordSettingsOperationCompleted;
private System.Threading.SendOrPostCallback GetWebDavSystemSettingsOperationCompleted;
private System.Threading.SendOrPostCallback GetOrganizationPasswordSettingsOperationCompleted; private System.Threading.SendOrPostCallback GetOrganizationPasswordSettingsOperationCompleted;
private System.Threading.SendOrPostCallback CheckOrgIdExistsOperationCompleted; private System.Threading.SendOrPostCallback CheckOrgIdExistsOperationCompleted;
@ -182,6 +184,9 @@ namespace WebsitePanel.EnterpriseServer.HostedSolution {
/// <remarks/> /// <remarks/>
public event UpdateOrganizationPasswordSettingsCompletedEventHandler UpdateOrganizationPasswordSettingsCompleted; public event UpdateOrganizationPasswordSettingsCompletedEventHandler UpdateOrganizationPasswordSettingsCompleted;
/// <remarks/>
public event GetWebDavSystemSettingsCompletedEventHandler GetWebDavSystemSettingsCompleted;
/// <remarks/> /// <remarks/>
public event GetOrganizationPasswordSettingsCompletedEventHandler GetOrganizationPasswordSettingsCompleted; public event GetOrganizationPasswordSettingsCompletedEventHandler GetOrganizationPasswordSettingsCompleted;
@ -635,6 +640,44 @@ namespace WebsitePanel.EnterpriseServer.HostedSolution {
} }
} }
/// <remarks/>
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://tempuri.org/GetWebDavSystemSettings", RequestNamespace="http://tempuri.org/", ResponseNamespace="http://tempuri.org/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
public SystemSettings GetWebDavSystemSettings() {
object[] results = this.Invoke("GetWebDavSystemSettings", new object[0]);
return ((SystemSettings)(results[0]));
}
/// <remarks/>
public System.IAsyncResult BeginGetWebDavSystemSettings(System.AsyncCallback callback, object asyncState) {
return this.BeginInvoke("GetWebDavSystemSettings", new object[0], callback, asyncState);
}
/// <remarks/>
public SystemSettings EndGetWebDavSystemSettings(System.IAsyncResult asyncResult) {
object[] results = this.EndInvoke(asyncResult);
return ((SystemSettings)(results[0]));
}
/// <remarks/>
public void GetWebDavSystemSettingsAsync() {
this.GetWebDavSystemSettingsAsync(null);
}
/// <remarks/>
public void GetWebDavSystemSettingsAsync(object userState) {
if ((this.GetWebDavSystemSettingsOperationCompleted == null)) {
this.GetWebDavSystemSettingsOperationCompleted = new System.Threading.SendOrPostCallback(this.OnGetWebDavSystemSettingsOperationCompleted);
}
this.InvokeAsync("GetWebDavSystemSettings", new object[0], this.GetWebDavSystemSettingsOperationCompleted, userState);
}
private void OnGetWebDavSystemSettingsOperationCompleted(object arg) {
if ((this.GetWebDavSystemSettingsCompleted != null)) {
System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
this.GetWebDavSystemSettingsCompleted(this, new GetWebDavSystemSettingsCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
}
}
/// <remarks/> /// <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)] [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) { public OrganizationPasswordSettings GetOrganizationPasswordSettings(int itemId) {
@ -3405,6 +3448,32 @@ namespace WebsitePanel.EnterpriseServer.HostedSolution {
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
public delegate void UpdateOrganizationPasswordSettingsCompletedEventHandler(object sender, System.ComponentModel.AsyncCompletedEventArgs e); public delegate void UpdateOrganizationPasswordSettingsCompletedEventHandler(object sender, System.ComponentModel.AsyncCompletedEventArgs e);
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
public delegate void GetWebDavSystemSettingsCompletedEventHandler(object sender, GetWebDavSystemSettingsCompletedEventArgs e);
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
public partial class GetWebDavSystemSettingsCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
private object[] results;
internal GetWebDavSystemSettingsCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) :
base(exception, cancelled, userState) {
this.results = results;
}
/// <remarks/>
public SystemSettings Result {
get {
this.RaiseExceptionIfNecessary();
return ((SystemSettings)(this.results[0]));
}
}
}
/// <remarks/> /// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
public delegate void GetOrganizationPasswordSettingsCompletedEventHandler(object sender, GetOrganizationPasswordSettingsCompletedEventArgs e); public delegate void GetOrganizationPasswordSettingsCompletedEventHandler(object sender, GetOrganizationPasswordSettingsCompletedEventArgs e);

View file

@ -1673,18 +1673,18 @@ namespace WebsitePanel.EnterpriseServer
DataProvider.DeleteExpiredAccessTokens(); DataProvider.DeleteExpiredAccessTokens();
} }
public static SystemSettings GetWebDavSystemSettings()
{
return SystemController.GetSystemSettingsInternal(SystemSettings.WEBDAV_PORTAL_SETTINGS, false);
}
public static string GenerateUserPasswordResetLink(int itemId, int accountId) public static string GenerateUserPasswordResetLink(int itemId, int accountId)
{ {
string passwordResetUrlFormat = "account/password-reset/step-2"; string passwordResetUrlFormat = "account/password-reset/step-2";
var settings = SystemController.GetSystemSettings(SystemSettings.WEBDAV_PORTAL_SETTINGS); var settings = GetWebDavSystemSettings();
if (settings == null) if (settings == null || !settings.GetValueOrDefault(SystemSettings.WEBDAV_PASSWORD_RESET_ENABLED_KEY, false) ||!settings.Contains("WebdavPortalUrl"))
{
throw new Exception("Webdav portal system settings are not set");
}
if (!settings.GetValueOrDefault(SystemSettings.WEBDAV_PASSWORD_RESET_ENABLED_KEY, false) ||!settings.Contains("WebdavPortalUrl"))
{ {
return string.Empty; return string.Empty;
} }

View file

@ -90,6 +90,12 @@ namespace WebsitePanel.EnterpriseServer
OrganizationController.UpdateOrganizationPasswordSettings(itemId, settings); OrganizationController.UpdateOrganizationPasswordSettings(itemId, settings);
} }
[WebMethod]
public SystemSettings GetWebDavSystemSettings()
{
return OrganizationController.GetWebDavSystemSettings();
}
[WebMethod] [WebMethod]
public OrganizationPasswordSettings GetOrganizationPasswordSettings(int itemId) public OrganizationPasswordSettings GetOrganizationPasswordSettings(int itemId)
{ {

View file

@ -221,13 +221,9 @@ namespace WebsitePanel.Portal.HostedSolution
password.ValidationEnabled = true; password.ValidationEnabled = true;
password.Password = string.Empty; password.Password = string.Empty;
var settings = ES.Services.System.GetSystemSettings(EnterpriseServer.SystemSettings.WEBDAV_PORTAL_SETTINGS); var settings = ES.Services.Organizations.GetWebDavSystemSettings();
if (settings != null) btnResetUserPassword.Visible = settings != null && Utils.ParseBool(settings[EnterpriseServer.SystemSettings.WEBDAV_PASSWORD_RESET_ENABLED_KEY], false);
{
btnResetUserPassword.Visible = Utils.ParseBool(settings[EnterpriseServer.SystemSettings.WEBDAV_PASSWORD_RESET_ENABLED_KEY], false);
}
chkUserMustChangePassword.Checked = user.UserMustChangePassword; chkUserMustChangePassword.Checked = user.UserMustChangePassword;
} }

View file

@ -164,7 +164,7 @@ namespace WebsitePanel.Portal
if (settings != null) if (settings != null)
{ {
chkEnablePasswordReset.Checked = Utils.ParseBool(settings[WEBDAV_PASSWORD_RESET_ENABLED], false); chkEnablePasswordReset.Checked = Utils.ParseBool(settings[WSP.SystemSettings.WEBDAV_PASSWORD_RESET_ENABLED_KEY], false);
txtWebdavPortalUrl.Text = settings[WEBDAV_PORTAL_URL]; txtWebdavPortalUrl.Text = settings[WEBDAV_PORTAL_URL];
} }
} }
@ -250,7 +250,7 @@ namespace WebsitePanel.Portal
settings = new WSP.SystemSettings(); settings = new WSP.SystemSettings();
settings[WEBDAV_PORTAL_URL] = txtWebdavPortalUrl.Text; settings[WEBDAV_PORTAL_URL] = txtWebdavPortalUrl.Text;
settings[WEBDAV_PASSWORD_RESET_ENABLED] = chkEnablePasswordReset.Checked.ToString(); settings[WSP.SystemSettings.WEBDAV_PASSWORD_RESET_ENABLED_KEY] = chkEnablePasswordReset.Checked.ToString();
result = ES.Services.System.SetSystemSettings(WSP.SystemSettings.WEBDAV_PORTAL_SETTINGS, settings); result = ES.Services.System.SetSystemSettings(WSP.SystemSettings.WEBDAV_PORTAL_SETTINGS, settings);
if (result < 0) if (result < 0)