YAFLogo

Posted by: bllue78 - Wednesday, 8 May 2013 06:41:47
I'm using YAF version 1.9.6.1 currently and getting some very strange issue on suspending user. When I suspended the user 2 minutes it shows for example: [b]User Suspension Ends: [color=red]Wednesday, May 08, 2013 1:22:39 PM[/color][/b] When I try to login with the suspended user after 2 minutes it gives me following message: [b]Suspended Your account has been temporarily suspended. This suspension is due to end on [color=red]Wednesday, May 08, 2013 1:26:50 PM.[/color][/b] it actually added 2 minutes on top of current time which means user will be suspended forever! The suspension time on suspend message keeping change everytime I refresh it and every time it adds 2 minutes on top of current time. I've searched the forum but unfortunately it looks only me got this issue. Any idea on this issue? Thanks!

Posted by: bllue78 - Friday, 17 May 2013 07:50:41
Eventually I found the root: in YAF.Core\Context\UserPageBase.cs Line 560 public DateTime SuspendedUntil { get { return this.Page == null || this.Page["Suspended"] != null ? DateTime.UtcNow : Convert.ToDateTime(this.Page["Suspended"]); } } Compare to 1.9.5 public DateTime SuspendedUntil { get { if (Page == null || Page["Suspended"] == DBNull.Value) { return DateTime.UtcNow; } else { return Convert.ToDateTime(Page["Suspended"]); } } } The logic to determine suspend time is wrong. When I change to return this.Page == null || this.Page["Suspended"] == null ? DateTime.UtcNow : Convert.ToDateTime(this.Page["Suspended"]); It shows the correct suspend expire time but I got werid problem when user login after suspend time: The webpage is reporting following error message: Error 310 (net::ERR_TOO_MANY_REDIRECTS): There were too many redirects. The suspend time has been cleared but when it comes to HttpContext.Current.Response.Redirect(General.GetSafeRawUrl()); It goes into a infinite redirect loop. Any idea?