Hi
i checked this method Login1_LoggedIn and isnt hit if password incorrect, so couldn't find where to trim password.
only hits Login1_LoggingIn.
I retrieved password field by:
TextBox txt = (TextBox)Login1.FindControl("Password");
but not sure how to proceed.
Please advise.
void Login1_LoggedIn(object sender, EventArgs e)
{
// Ensure response cookie
CookieHelper.EnsureResponseCookie(FormsAuthentication.FormsCookieName);
// Set cookie expiration
if (Login1.RememberMeSet)
{
CookieHelper.ChangeCookieExpiration(FormsAuthentication.FormsCookieName, DateTime.Now.AddYears(1), false);
}
else
{
// Extend the expiration of the authentication cookie if required
if (!UserInfoProvider.UseSessionCookies && (HttpContext.Current != null) && (HttpContext.Current.Session != null))
{
CookieHelper.ChangeCookieExpiration(FormsAuthentication.FormsCookieName, DateTime.Now.AddMinutes(Session.Timeout), false);
}
}
// Redirect user to the return url, or if is not defined redirect to the default target url
if (ValidationHelper.GetString(Request.QueryString["ReturnURL"], "") != "")
{
UrlHelper.Redirect(ResolveUrl(ValidationHelper.GetString(Request.QueryString["ReturnURL"], "")));
}
else
{
if (this.DefaultTargetUrl != "")
{
UrlHelper.Redirect(ResolveUrl(this.DefaultTargetUrl));
}
else
{
UrlHelper.Redirect(URLRewriter.CurrentURL);
}
}
}
/// <summary>
/// Ligging in handler
/// </summary>
void Login1_LoggingIn(object sender, LoginCancelEventArgs e)
{
TextBox txt = (TextBox)Login1.FindControl("Password");
// Ban IP addresses which are blocked for login
if (!BannedIPInfoProvider.IsAllowed(CMSContext.CurrentSiteName, BanControlEnum.Login))
{
e.Cancel = true;
LocalizedLiteral failureLit = Login1.FindControl("FailureText") as LocalizedLiteral;
if (failureLit != null)
{
failureLit.Visible = true;
failureLit.Text = ResHelper.GetString("banip.ipisbannedlogin");
}
}
if (((CheckBox)Login1.FindControl("chkRememberMe")).Checked)
{
Login1.RememberMeSet = true;
}
else
{
Login1.RememberMeSet = false;
}
}
Thanks