protected void btnOpenIdLogin_LoggedIn(object sender, OpenIdEventArgs e) { e.Cancel = true; if (e.Response.Status == AuthenticationStatus.Authenticated && SecurityHelper.Authenticate(e.ClaimedIdentifier, btnOpenIdLogin.RememberMe)) { ReturnToUrl(AdminUrl.Home()); } else { openIdMessage.Text = Resources.Login_AuthenticationFailed; } }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); if (Context != null) { if (HomeLink != null) { HomeLink.NavigateUrl = Url.BlogUrl(); ControlHelper.SetTitleIfNone(HomeLink, "Link to the home page."); } if (ContactLink != null) { ContactLink.NavigateUrl = Url.ContactFormUrl(); ControlHelper.SetTitleIfNone(ContactLink, "Contact form."); } if (Archives != null) { Archives.NavigateUrl = Url.ArchivesUrl(); ControlHelper.SetTitleIfNone(Archives, "View Archives."); } if (Admin != null) { if (Request.IsAuthenticated && SecurityHelper.IsAdmin) { Admin.Text = "Admin"; Admin.NavigateUrl = AdminUrl.Home(); ControlHelper.SetTitleIfNone(Admin, "Admin Section."); } else { Admin.Text = "Login"; Admin.NavigateUrl = Url.LoginUrl(); ControlHelper.SetTitleIfNone(Admin, "Login Form."); } } if (Syndication != null) { Syndication.NavigateUrl = Url.RssUrl(Blog).ToString(); if (Syndication.ImageUrl.StartsWith("~/")) { Syndication.ImageUrl = Url.ResolveUrl(Syndication.ImageUrl); } ControlHelper.SetTitleIfNone(Syndication, "Subscribe to this feed."); } } }
protected void btnLogin_Click(object sender, EventArgs e) { string returnUrl = Request.QueryString["ReturnURL"]; string username = tbUserName.Text; string password = tbPassword.Text; bool persist = chkRememberMe.Checked; bool isAdmin = false; var blog = Blog; if (blog == null || blog.Password == null) { blog = null; } if (blog != null) { isAdmin = blog.IsValidUser(username, password); returnUrl = String.IsNullOrEmpty(returnUrl) ? (string)AdminUrl.Home() : returnUrl; } else { returnUrl = String.IsNullOrEmpty(returnUrl) ? "~/HostAdmin/Default.aspx" : returnUrl; } bool isHostAdmin = HostInfo.ValidateHostAdminPassword(username, password); if (!isAdmin && !isHostAdmin) { Message.Text = LoginFailedMessage; return; } var roles = new string[2]; if (isAdmin) { roles[0] = "Admins"; SubtextContext.HttpContext.SetAuthenticationTicket(blog, username, persist, roles.Where(s => s != null).ToArray()); } if (isHostAdmin) { roles[1] = "HostAdmins"; SubtextContext.HttpContext.SetAuthenticationTicket(null, username, persist, forceHostAdmin: true, roles: roles.Where(s => s != null).ToArray()); } ReturnToUrl(returnUrl); }
protected void Page_Load(object sender, EventArgs e) { if (!Config.Settings.AllowImages) { Response.Redirect(AdminUrl.Home()); } if (!IsPostBack) { HideImages(); ShowResults(); BindList(); ckbIsActiveImage.Checked = Preferences.AlwaysCreateIsActive; ckbNewIsActive.Checked = Preferences.AlwaysCreateIsActive; if (null != Request.QueryString[Keys.QRYSTR_CATEGORYID]) { CategoryId = Convert.ToInt32(Request.QueryString[Keys.QRYSTR_CATEGORYID]); BindGallery(CategoryId); } } }
protected void Page_Load(object sender, EventArgs e) { InstallationManager.ResetInstallationStatusCache(); if (paraBlogLink != null) { paraBlogLink.Visible = false; } if (paraBlogAdminLink != null) { paraBlogAdminLink.Visible = false; } if (paraBlogmlImport != null) { paraBlogmlImport.Visible = false; } if (Config.CurrentBlog != null) { if (lnkBlog != null && paraBlogLink != null) { paraBlogLink.Visible = true; lnkBlog.HRef = Url.BlogUrl(); } if (lnkBlogAdmin != null && paraBlogAdminLink != null) { paraBlogAdminLink.Visible = true; lnkBlogAdmin.HRef = AdminUrl.Home(); } if (lnkBlogMl != null && paraBlogmlImport != null) { paraBlogmlImport.Visible = true; lnkBlogMl.HRef = AdminUrl.ImportExport(); } } }
protected void btnLogin_Click(object sender, EventArgs e) { string returnUrl = Request.QueryString["ReturnURL"]; if (Blog == null || (returnUrl != null && returnUrl.Contains("HostAdmin", StringComparison.OrdinalIgnoreCase))) { if (!AuthenticateHostAdmin()) { Log.Warn("HostAdmin login failure for " + tbUserName.Text); Message.Text = LoginFailedMessage; return; } ReturnToUrl("~/HostAdmin/Default.aspx"); return; } if (SubtextContext.HttpContext.Authenticate(Blog, tbUserName.Text, tbPassword.Text, chkRememberMe.Checked)) { ReturnToUrl(AdminUrl.Home()); return; } Log.Warn("Admin login failure for " + tbUserName.Text); Message.Text = LoginFailedMessage; }