#region Using
using System;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using BlogEngine.Core;
#endregion
public partial class login : BlogEngine.Core.Web.Controls.BlogBasePage
{
///
/// Handles the Load event of the Page control.
///
/// The source of the event.
/// The instance containing the event data.
protected void Page_Load(object sender, EventArgs e)
{
if (Request.QueryString.ToString() == "logoff")
{
FormsAuthentication.SignOut();
if (Request.UrlReferrer != null && Request.UrlReferrer != Request.Url)
{
Response.Redirect(Request.UrlReferrer.ToString(), true);
}
else
{
Response.Redirect("login.aspx");
}
}
if (Page.User.Identity.IsAuthenticated)
{
changepassword1.Visible = true;
changepassword1.ContinueButtonClick += new EventHandler(changepassword1_ContinueButtonClick);
lsLogout.Visible = true;
Login1.Visible = false;
Page.Title = Resources.labels.changePassword;
}
else
{
Login1.LoggedIn += new EventHandler(Login1_LoggedIn);
Login1.FindControl("username").Focus();
}
}
///
/// Handles the ContinueButtonClick event of the changepassword1 control.
///
/// The source of the event.
/// The instance containing the event data.
void changepassword1_ContinueButtonClick(object sender, EventArgs e)
{
Response.Redirect(BlogEngine.Core.Utils.RelativeWebRoot, true);
}
///
/// Handles the LoggedIn event of the Login1 control.
///
/// The source of the event.
/// The instance containing the event data.
void Login1_LoggedIn(object sender, EventArgs e)
{
if (!Roles.IsUserInRole(Login1.UserName, BlogEngine.Core.BlogSettings.Instance.AdministratorRole))
Response.Redirect(BlogEngine.Core.Utils.RelativeWebRoot, true);
}
}