wsp-10318 Smart mail shows not detailed error on simple password

This commit is contained in:
me 2015-02-21 10:44:17 +04:00
parent 66507c8384
commit 1220a131a4
5 changed files with 41 additions and 9 deletions

View file

@ -151,6 +151,7 @@ namespace WebsitePanel.EnterpriseServer
public const int ERROR_MAIL_LICENSE_USERS_QUOTA = -724; public const int ERROR_MAIL_LICENSE_USERS_QUOTA = -724;
public const int ERROR_MAIL_ACCOUNT_MAX_MAILBOX_SIZE_LIMIT = -725; public const int ERROR_MAIL_ACCOUNT_MAX_MAILBOX_SIZE_LIMIT = -725;
public const int ERROR_MAIL_ACCOUNT_PASSWORD_NOT_COMPLEXITY = -726;
#endregion #endregion
#region FTP #region FTP

View file

@ -159,7 +159,11 @@ namespace WebsitePanel.EnterpriseServer
{ {
return BusinessErrorCodes.ERROR_MAIL_LICENSE_DOMAIN_QUOTA; return BusinessErrorCodes.ERROR_MAIL_LICENSE_DOMAIN_QUOTA;
} }
if (ex.Message != null && ex.Message.Contains("The maximum number of users for the server has been reached")) if (ex.Message.Contains("Password doesn't meet complexity"))
{
return BusinessErrorCodes.ERROR_MAIL_ACCOUNT_PASSWORD_NOT_COMPLEXITY;
}
if (ex.Message.Contains("The maximum number of users for the server has been reached"))
{ {
return BusinessErrorCodes.ERROR_MAIL_LICENSE_USERS_QUOTA; return BusinessErrorCodes.ERROR_MAIL_LICENSE_USERS_QUOTA;
} }
@ -224,6 +228,11 @@ namespace WebsitePanel.EnterpriseServer
} }
catch (Exception ex) catch (Exception ex)
{ {
if (ex.Message.Contains("Password doesn't meet complexity"))
{
return BusinessErrorCodes.ERROR_MAIL_ACCOUNT_PASSWORD_NOT_COMPLEXITY;
}
throw TaskManager.WriteError(ex); throw TaskManager.WriteError(ex);
} }
finally finally

View file

@ -1171,8 +1171,13 @@ namespace WebsitePanel.Providers.Mail
mailbox.IsDomainAdmin // domain admin is false mailbox.IsDomainAdmin // domain admin is false
); );
if (!result.Result) if (!result.Result)
throw new Exception(result.Message); {
if (result.ResultCode == -21)
throw new Exception("Password doesn't meet complexity", new Exception(result.Message));
throw new Exception(result.Message);
}
// set forwarding settings // set forwarding settings
result = users.UpdateUserForwardingInfo(AdminUsername, AdminPassword, result = users.UpdateUserForwardingInfo(AdminUsername, AdminPassword,
@ -1232,10 +1237,15 @@ namespace WebsitePanel.Providers.Mail
GenericResult result = users.UpdateUser( GenericResult result = users.UpdateUser(
AdminUsername, AdminPassword, mailbox.Name, strPassword, mailbox.FirstName, mailbox.LastName, mailbox.IsDomainAdmin); AdminUsername, AdminPassword, mailbox.Name, strPassword, mailbox.FirstName, mailbox.LastName, mailbox.IsDomainAdmin);
if (!result.Result) if (!result.Result)
throw new Exception(result.Message); {
if (result.ResultCode == -21)
throw new Exception("Password doesn't meet complexity", new Exception(result.Message));
// set forwarding settings throw new Exception(result.Message);
}
// set forwarding settings
result = users.UpdateUserForwardingInfo(AdminUsername, AdminPassword, result = users.UpdateUserForwardingInfo(AdminUsername, AdminPassword,
mailbox.Name, mailbox.DeleteOnForward, mailbox.Name, mailbox.DeleteOnForward,
(mailbox.ForwardingAddresses != null ? String.Join(", ", mailbox.ForwardingAddresses) : "")); (mailbox.ForwardingAddresses != null ? String.Join(", ", mailbox.ForwardingAddresses) : ""));

View file

@ -402,6 +402,9 @@
<data name="Error.MAIL_UPDATE_ACCOUNT" xml:space="preserve"> <data name="Error.MAIL_UPDATE_ACCOUNT" xml:space="preserve">
<value>Error updating mail account</value> <value>Error updating mail account</value>
</data> </data>
<data name="Error.MAIL_ACCOUNT_PASSWORD_NOT_COMPLEXITY" xml:space="preserve">
<value>Password doesn't meet complexity. Perhaps the password length is less 5 characters.</value>
</data>
<data name="Error.MAIL_UPDATE_DOMAIN" xml:space="preserve"> <data name="Error.MAIL_UPDATE_DOMAIN" xml:space="preserve">
<value>Error updating mail domain</value> <value>Error updating mail domain</value>
</data> </data>

View file

@ -235,9 +235,9 @@ namespace WebsitePanel.Portal
try try
{ {
int result = ES.Services.MailServers.AddMailAccount(item); int result = ES.Services.MailServers.AddMailAccount(item);
if (result < 0) if (result == BusinessErrorCodes.ERROR_MAIL_ACCOUNT_PASSWORD_NOT_COMPLEXITY)
{ {
ShowResultMessage(result); ShowErrorMessage("MAIL_ACCOUNT_PASSWORD_NOT_COMPLEXITY");
return; return;
} }
if (result == BusinessErrorCodes.ERROR_MAIL_LICENSE_DOMAIN_QUOTA) if (result == BusinessErrorCodes.ERROR_MAIL_LICENSE_DOMAIN_QUOTA)
@ -250,7 +250,11 @@ namespace WebsitePanel.Portal
ShowResultMessage(result); ShowResultMessage(result);
return; return;
} }
if (result < 0)
{
ShowResultMessage(result);
return;
}
} }
catch (Exception ex) catch (Exception ex)
{ {
@ -264,6 +268,11 @@ namespace WebsitePanel.Portal
try try
{ {
int result = ES.Services.MailServers.UpdateMailAccount(item); int result = ES.Services.MailServers.UpdateMailAccount(item);
if (result == BusinessErrorCodes.ERROR_MAIL_ACCOUNT_PASSWORD_NOT_COMPLEXITY)
{
ShowErrorMessage("MAIL_ACCOUNT_PASSWORD_NOT_COMPLEXITY");
return;
}
if (result < 0) if (result < 0)
{ {
ShowResultMessage(result); ShowResultMessage(result);