[Mono-dev] Problems with the Session_end event
Hello, I'm having problems with the Session_End event being raised multiple times for the same sessionID. I've also reported a bug related to this issue, bug #81140. Can anybody help me with this? I would work on the problem, but I don't know where to start. Some ideas would be appreciated. Thanks. ___ Mono-devel-list mailing list Mono-devel-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-devel-list
[Mono-dev] ChangePassword patch
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
[Mono-dev] LoggedOut event not raised in LoginStatus
Hi, I started using the LoginStatus control and in the LoggedOut event I was trying to do something, but the event was never raised. I looked in the code and I saw that OnLoggedOut gets called after a Redirect in LogoutClick method. Unfortunatelly this doesn't happen and I think the OnLoggedOut should be called just before the Redirect. Attached is a patch for this issue. Dumi. Index: Mono/mcs/class/System.Web/System.Web.UI.WebControls/LoginStatus.cs === --- Mono/mcs/class/System.Web/System.Web.UI.WebControls/LoginStatus.cs (revision 72287) +++ Mono/mcs/class/System.Web/System.Web.UI.WebControls/LoginStatus.cs (working copy) @@ -283,6 +283,7 @@ return; FormsAuthentication.SignOut (); + OnLoggedOut (e); switch (LogoutAction) { case LogoutAction.Refresh: @@ -298,8 +299,6 @@ HttpContext.Current.Response.Redirect (url); break; } - - OnLoggedOut (e); } private void LoginClick (object sender, CommandEventArgs e) ___ Mono-devel-list mailing list Mono-devel-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-devel-list
[Mono-dev] CreateUserWizard - support for sending mail
Hi, I've added support for sending mail when a new user is created. Everything is in the attached patch. Dumi. Index: Mono/mcs/class/System.Web/System.Web.UI.WebControls/CreateUserWizard.cs === --- Mono/mcs/class/System.Web/System.Web.UI.WebControls/CreateUserWizard.cs (revision 72287) +++ Mono/mcs/class/System.Web/System.Web.UI.WebControls/CreateUserWizard.cs (working copy) @@ -31,8 +31,10 @@ using System.Web.UI; using System.Web.Security; using System.Collections; +using System.Collections.Specialized; using System.ComponentModel; using System.Text; +using System.Net.Mail; namespace System.Web.UI.WebControls { @@ -44,6 +46,7 @@ private string _confirmPassword = ; private MembershipProvider _provider = null; private ITextControl _errorMessageLabel = null; + private MailDefinition _mailDefinition = null; private Style _textBoxStyle = null; private Style _validatorTextStyle = null; @@ -747,11 +750,20 @@ } //[MonoTODO (Sending mail functionality is not implemented)] - //[ThemeableAttribute (false)] - //public MailDefinition MailDefinition - //{ - // get { throw new NotImplementedException (); } - //} + [ThemeableAttribute (false)] + public MailDefinition MailDefinition + { + get + { + if (this._mailDefinition == null) + { + this._mailDefinition = new MailDefinition(); + if (IsTrackingViewState) + ((IStateManager) _mailDefinition).TrackViewState (); + } + return _mailDefinition; + } + } [ThemeableAttribute (false)] public virtual string MembershipProvider @@ -1384,6 +1396,8 @@ ((IStateManager) CreateUserButtonStyle).LoadViewState (states [10]); if (states [11] != null) ((IStateManager) ContinueButtonStyle).LoadViewState (states [11]); + if (states [12] != null) + ((IStateManager) MailDefinition).LoadViewState (states [12]); ((CreateUserStepContainer) CreateUserStep.ContentTemplateContainer).EnsureValidatorsState (); } @@ -1390,7 +1404,7 @@ protected override object SaveViewState () { - object [] state = new object [12]; + object [] state = new object [13]; state [0] = base.SaveViewState (); if (_textBoxStyle != null) @@ -1415,6 +1429,8 @@ state [10] = ((IStateManager) _createUserButtonStyle).SaveViewState (); if (_continueButtonStyle != null) state [11] = ((IStateManager) _continueButtonStyle).SaveViewState (); + if (_mailDefinition != null) + state [12] = ((IStateManager) _mailDefinition).SaveViewState (); for (int n = 0; n state.Length; n++) if (state [n] != null) @@ -1454,6 +1470,8 @@ ((IStateManager) _createUserButtonStyle).TrackViewState (); if (_continueButtonStyle != null) ((IStateManager) _continueButtonStyle).TrackViewState (); + if (_mailDefinition != null) + ((IStateManager) _mailDefinition).TrackViewState (); } #endregion @@ -1518,6 +1536,7 @@ if ((newUser != null) (status == MembershipCreateStatus.Success)) { OnCreatedUser (new EventArgs ()); + SendPasswordByMail(UserName, Password); return true; } @@ -1561,6 +1580,44 @@ return false; } + private void SendPasswordByMail (string username, string password) + { + MembershipUser user = MembershipProviderInternal.GetUser (UserName, false); + if (user == null) + return; + + string messageText = A new account has been created for you. Please go to the site and log in using the following information.\n + +