Hello, Attached is a patch for ChangePassword control. The ProcessChangePasswordEvent is calling MembershipProviderInternal.ChangePassword method which is throwing ArgumentException in different situations - "Password too short", "Password does not match regular expresion" etc. Instead of allowing the exception to propagate, the ProcessChangePasswordEvent should catch it, call the OnChangePasswordError and set the failure message according to the exception message.
Best regards, Dumi.
Index: mcs/class/System.Web/System.Web.UI.WebControls/ChangePassword.cs =================================================================== --- mcs/class/System.Web/System.Web.UI.WebControls/ChangePassword.cs (revision 75341) +++ mcs/class/System.Web/System.Web.UI.WebControls/ChangePassword.cs (working copy) @@ -756,23 +756,32 @@ if (loginCancelEventArgs.Cancel) return; - if (MembershipProviderInternal.ChangePassword (UserName, CurrentPassword, NewPassword)) { + try { + if (MembershipProviderInternal.ChangePassword (UserName, CurrentPassword, NewPassword)) { + + OnChangedPassword (args); + _showContinue = true; - OnChangedPassword (args); - _showContinue = true; + if (_mailDefinition != null) + SendMail (UserName, NewPassword); + } + else { + OnChangePasswordError (EventArgs.Empty); + string lastError = string.Format ( + "Password incorrect or New Password invalid. New Password length minimum: {0}. Non-alphanumeric characters required: {1}.", + MembershipProviderInternal.MinRequiredPasswordLength, + MembershipProviderInternal.MinRequiredNonAlphanumericCharacters); - if (_mailDefinition != null) - SendMail (UserName, NewPassword); + ChangePasswordContainer container = (ChangePasswordContainer) ChangePasswordTemplateContainer; + container.FailureTextLiteral.Text = lastError; + _showContinue = false; + } } - else { + catch (Exception e) { OnChangePasswordError (EventArgs.Empty); - string lastError = string.Format ( - "Password incorrect or New Password invalid. New Password length minimum: {0}. Non-alphanumeric characters required: {1}.", - MembershipProviderInternal.MinRequiredPasswordLength, - MembershipProviderInternal.MinRequiredNonAlphanumericCharacters); ChangePasswordContainer container = (ChangePasswordContainer) ChangePasswordTemplateContainer; - container.FailureTextLiteral.Text = lastError; + container.FailureTextLiteral.Text = e.Message; _showContinue = false; }
_______________________________________________ Mono-devel-list mailing list Mono-devel-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-devel-list