Implements login tools.
예제 #1
0
 /// <summary>
 /// Performs the logout.
 /// </summary>
 private void Logout()
 {
     Users.NotifyLogout(SessionFacade.CurrentUsername);
     LoginTools.SetLoginCookie("", "", DateTime.Now.AddYears(-1));
     Log.LogEntry("User " + SessionFacade.CurrentUsername + " logged out", EntryType.General, Log.SystemUsername);
     Session.Abandon();
 }
예제 #2
0
		protected void Page_Load(object sender, EventArgs e) {
			Page.Title = Properties.Messages.NavPathTitle + " - " + Settings.WikiTitle;

			LoginTools.VerifyReadPermissionsForCurrentNamespace();

			PrintNavPaths();
		}
예제 #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Page.Title = Properties.Messages.CategoryTitle + " - " + Settings.WikiTitle;

            LoginTools.VerifyReadPermissionsForCurrentNamespace();

            currentNamespace = DetectNamespaceInfo();

            PrintCat();
        }
예제 #4
0
        protected void Application_AcquireRequestState(object sender, EventArgs e)
        {
            if (HttpContext.Current.Session != null)
            {
                // This should be performed on EndRequest, but Session is not available there
                SessionCache.ClearData(HttpContext.Current.Session.SessionID);

                // Try to automatically login the user through the cookie
                LoginTools.TryAutoLogin( );
            }
        }
예제 #5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string currentWiki = DetectWiki();

            PageSize = Settings.GetListSize(currentWiki);
            rangeEnd = PageSize - 1;

            LoginTools.VerifyReadPermissionsForCurrentNamespace(currentWiki);

            if (Request["Cat"] != null)
            {
                if (Request["Cat"].Equals("-"))
                {
                    lblPages.Text = Properties.Messages.UncategorizedPages;
                }
                else
                {
                    lblPages.Text = Properties.Messages.PagesOfCategory + " <i>" + Request["Cat"] + "</i>";
                }
            }

            if (!Page.IsPostBack)
            {
                lnkCategories.NavigateUrl = UrlTools.BuildUrl(currentWiki, "Category.aspx");
                lnkSearch.NavigateUrl     = UrlTools.BuildUrl(currentWiki, "Search.aspx");

                currentPages           = GetAllPages();
                pageSelector.ItemCount = currentPages.Count;
                pageSelector.PageSize  = PageSize;

                string p = Request["Page"];
                if (!int.TryParse(p, out selectedPage))
                {
                    selectedPage = 0;
                }
                pageSelector.SelectPage(selectedPage);
            }

            Page.Title = Properties.Messages.AllPagesTitle + " (" + (rangeBegin + 1).ToString() + "-" + (rangeEnd + 1).ToString() + ") - " + Settings.GetWikiTitle(currentWiki);

            // Important note
            // This page cannot use a repeater because the page list has particular elements used for grouping pages

            PrintPages();
        }
예제 #6
0
        protected void btnLogin_Click(object sender, EventArgs e)
        {
            UserInfo user = Users.TryLogin(txtUsername.Text, txtPassword.Text);

            if (user != null)
            {
                string loginKey = Users.ComputeLoginKey(user.Username, user.Email, user.DateTime);
                if (chkRemember.Checked)
                {
                    LoginTools.SetLoginCookie(user.Username, loginKey,
                                              DateTime.Now.AddYears(1));
                }
                LoginTools.SetupSession(user);
                Log.LogEntry("User " + user.Username + " logged in", EntryType.General, Log.SystemUsername);
                LoginTools.TryRedirect(true);
            }
            else
            {
                lblResult.CssClass = "resulterror";
                lblResult.Text     = Properties.Messages.WrongUsernamePassword;
            }
        }