public override void Execute()
        {
            WriteLiteral("\r\n\r\n");


            WriteLiteral("\r\n");



            Page.Title = AdminResources.SecurityTitle;

            if (AdminSecurity.HasAdminPassword())
            {
                SiteAdmin.RedirectToHome(Response);
                return;
            }

            string url = SiteAdmin.GetRedirectUrl(SiteAdmin.AdminVirtualPath);


            WriteLiteral("\r\n");


            Write(Html.Raw(AdminResources.EnableInstructions));

            WriteLiteral("\r\n<br />\r\n<p>\r\n    ");


            Write(Html.Raw(String.Format(CultureInfo.CurrentCulture, AdminResources.ContinueAfterEnableText, Html.Encode(Href(url)))));

            WriteLiteral("\r\n</p>\r\n\r\n");
        }
        public override void Execute()
        {
            WriteLiteral("\r\n\r\n");



            // Delete the admin auth cookie
            AdminSecurity.DeleteAuthCookie(Response);

            // Redirect home
            SiteAdmin.RedirectToHome(Response);
        }
        public override void Execute()
        {
            WriteLiteral("\r\n\r\n");



            #line 3 "..\..\_pagestart.cshtml"

            // 404 if the admin page isn't available
            if (!SiteAdmin.Available)
            {
                Response.SetStatus(HttpStatusCode.NotFound);
                return;
            }

            AdminSecurity.Authorize(this);



            #line default
            #line hidden
            WriteLiteral("\r\n");



            #line 13 "..\..\_pagestart.cshtml"

            // Set up layout values
            var breadCrumbs = new List <Tuple <string, string> >();
            if (SiteAdmin.Modules.Any())
            {
                breadCrumbs.Add(Tuple.Create(AdminResources.AdminHome, Href(SiteAdmin.AdminVirtualPath)));
            }
            PageData["BreadCrumbs"] = breadCrumbs;
            Layout = "_Layout.cshtml";


            HtmlHelper.ValidationSummaryClass      = "message error";
            HtmlHelper.ValidationInputCssClassName = "validation-error";

            // Force IE9 standards mode rendering
            Response.AddHeader("X-UA-Compatible", "IE=Edge");



            #line default
            #line hidden
            WriteLiteral("\r\n\r\n");
        }
Esempio n. 4
0
        public override void Execute()
        {
            WriteLiteral("\r\n\r\n");



            #line 3 "..\..\Logout.cshtml"

            // Delete the admin auth cookie
            AdminSecurity.DeleteAuthCookie(Response);

            // Redirect home
            SiteAdmin.RedirectToHome(Response);



            #line default
            #line hidden
        }
Esempio n. 5
0
        public override void Execute()
        {
            WriteLiteral("\r\n\r\n");



            #line 4 "..\..\Register.cshtml"

            Page.Title = AdminResources.RegisterTitle;
            var adminPath = SiteAdmin.AdminVirtualPath.TrimStart('~');
            Page.Desc = String.Format(CultureInfo.CurrentCulture, AdminResources.RegisterDesc, Html.Encode(adminPath));

            // If the password is already set the redirect to login
            if (AdminSecurity.HasAdminPassword())
            {
                SiteAdmin.RedirectToLogin(Response);
                return;
            }

            if (IsPost)
            {
                AntiForgery.Validate();

                var password          = Request.Form["password"];
                var reenteredPassword = Request.Form["repassword"];
                if (password.IsEmpty())
                {
                    ModelState.AddError("password", AdminResources.Validation_PasswordRequired);
                }
                else if (password != reenteredPassword)
                {
                    ModelState.AddError("repassword", AdminResources.Validation_PasswordsDoNotMatch);
                }

                if (ModelState.IsValid)
                {
                    // Save the admin password
                    if (AdminSecurity.SaveTemporaryPassword(password))
                    {
                        // Get the return url
                        var returnUrl = SiteAdmin.GetReturnUrl(Request) ?? SiteAdmin.AdminVirtualPath;

                        // Redirect to the return url
                        Response.Redirect(returnUrl);
                    }
                    else
                    {
                        // Add a validation error since creating the password.txt failed
                        ModelState.AddFormError(AdminResources.AdminModuleRequiresAccessToAppData);
                    }
                }
            }



            #line default
            #line hidden
            WriteLiteral("\r\n<br/>\r\n\r\n");



            #line 47 "..\..\Register.cshtml"
            Write(Html.ValidationSummary());


            #line default
            #line hidden
            WriteLiteral("\r\n\r\n<form method=\"post\" action=\"\">\r\n");



            #line 50 "..\..\Register.cshtml"
            Write(AntiForgery.GetHtml());


            #line default
            #line hidden
            WriteLiteral("\r\n<fieldset>\r\n    <ol>\r\n        <li class=\"password\">\r\n            <label for=\"pa" +
                         "ssword\">");



            #line 54 "..\..\Register.cshtml"
            Write(AdminResources.EnterPassword);


            #line default
            #line hidden
            WriteLiteral("</label>\r\n            ");



            #line 55 "..\..\Register.cshtml"
            Write(Html.Password("password"));


            #line default
            #line hidden
            WriteLiteral(" ");



            #line 55 "..\..\Register.cshtml"
            Write(Html.ValidationMessage("password", "*"));


            #line default
            #line hidden
            WriteLiteral("\r\n        </li>\r\n        <li class=\"password\">\r\n            <label>");



            #line 58 "..\..\Register.cshtml"
            Write(AdminResources.ReenterPassword);


            #line default
            #line hidden
            WriteLiteral("</label>\r\n            ");



            #line 59 "..\..\Register.cshtml"
            Write(Html.Password("repassword"));


            #line default
            #line hidden
            WriteLiteral(" ");



            #line 59 "..\..\Register.cshtml"
            Write(Html.ValidationMessage("repassword", "*"));


            #line default
            #line hidden
            WriteLiteral("\r\n        </li>\r\n    </ol>\r\n    <p class=\"form-actions\">\r\n        <input type=\"su" +
                         "bmit\" value=\"");



            #line 63 "..\..\Register.cshtml"
            Write(AdminResources.CreatePassword);


            #line default
            #line hidden
            WriteLiteral("\" class=\"long-input\" />\r\n    </p>\r\n</fieldset>\r\n</form>\r\n");
        }
Esempio n. 6
0
        public override void Execute()
        {
            WriteLiteral("\r\n\r\n");



            #line 4 "..\..\Login.cshtml"

            Page.Title = AdminResources.LoginTitle;

            // No admin password has been registered so redirect
            if (!AdminSecurity.HasAdminPassword())
            {
                SiteAdmin.RedirectToRegister(Response);
                return;
            }

            if (IsPost)
            {
                AntiForgery.Validate();
                var password = Request.Form["password"];

                if (AdminSecurity.CheckPassword(password))
                {
                    // Get the return url
                    var returnUrl = SiteAdmin.GetReturnUrl(Request) ?? SiteAdmin.AdminVirtualPath;

                    // Set the admin auth cookie
                    AdminSecurity.SetAuthCookie(Response);

                    // Redirect to the return url
                    Response.Redirect(returnUrl);
                }
                else
                {
                    ModelState.AddError("password", AdminResources.Validation_PasswordIncorrect);
                }
            }



            #line default
            #line hidden
            WriteLiteral("\r\n");


            DefineSection("Head", () => {
                WriteLiteral("\r\n    <script type=\"text/javascript\">\r\n    function showForgotPasswordInfo(){\r\n  " +
                             "      document.getElementById(\'forgotPasswordInfo\').style.display = \'\';\r\n    }\r\n" +
                             "    </script>\r\n");
            });

            WriteLiteral("\r\n\r\n");



            #line 41 "..\..\Login.cshtml"
            Write(Html.ValidationSummary());


            #line default
            #line hidden
            WriteLiteral("\r\n<br />\r\n\r\n<form method=\"post\" action=\"\">\r\n    ");



            #line 45 "..\..\Login.cshtml"
            Write(AntiForgery.GetHtml());


            #line default
            #line hidden
            WriteLiteral("\r\n    <fieldset>\r\n    <ol>\r\n        <li class=\"password\">\r\n            <label for" +
                         "=\"password\">");



            #line 49 "..\..\Login.cshtml"
            Write(AdminResources.Password);


            #line default
            #line hidden
            WriteLiteral(":</label>\r\n            ");



            #line 50 "..\..\Login.cshtml"
            Write(Html.Password("password"));


            #line default
            #line hidden
            WriteLiteral(" ");



            #line 50 "..\..\Login.cshtml"
            Write(Html.ValidationMessage("password", "*"));


            #line default
            #line hidden
            WriteLiteral("\r\n    </ol>\r\n    <p class=\"form-actions\">\r\n        <input type=\"submit\" value=\"");



            #line 53 "..\..\Login.cshtml"
            Write(AdminResources.Login);


            #line default
            #line hidden
            WriteLiteral("\" />\r\n    </p>\r\n    </fieldset>\r\n    <p>\r\n        <a href=\"#\" onclick=\"showForgot" +
                         "PasswordInfo(); return false;\">");



            #line 57 "..\..\Login.cshtml"
            Write(AdminResources.ForgotPassword);


            #line default
            #line hidden
            WriteLiteral("</a>\r\n    </p>\r\n</form>\r\n<br />\r\n");



            #line 61 "..\..\Login.cshtml"

            var passwordFileLocation = AdminSecurity.AdminPasswordFile.TrimStart('~', '/');
            var forgotPasswordHelp   = String.Format(CultureInfo.CurrentCulture, AdminResources.AdminPasswordChangeInstructions, Html.Encode(passwordFileLocation));



            #line default
            #line hidden
            WriteLiteral("<span id=\"forgotPasswordInfo\" style=\"display: none\">");



            #line 65 "..\..\Login.cshtml"
            Write(Html.Raw(forgotPasswordHelp));


            #line default
            #line hidden
            WriteLiteral("</span>");
        }
Esempio n. 7
0
        public override void Execute()
        {
            WriteLiteral("\r\n\r\n");



            string title = Page.Title;


            WriteLiteral("\r\n<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/" +
                         "xhtml1/DTD/xhtml1-strict.dtd\">\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\">\r\n   " +
                         "<head>\r\n      <title>");


            Write(AdminResources.AdminModuleTitle);


            if (!title.IsEmpty())
            {
                WriteLiteral(" ");

                WriteLiteral("- ");


                Write(title);

                WriteLiteral(" ");

                WriteLiteral(" ");
            }
            WriteLiteral("</title>\r\n      <link href=\"");


            Write(Href("Site.css"));

            WriteLiteral("\" rel=\"stylesheet\" type=\"text/css\" />\r\n      ");


            Write(RenderSection("Head", required: false));

            WriteLiteral("\r\n   </head>\r\n   <body>\r\n      <div id=\"page\">\r\n         <div id=\"header\" class=\"" +
                         "group\">\r\n            <h1 class=\"site-title\">\r\n                <img src=\"");


            Write(Href("images/aspLogo.gif"));

            WriteLiteral("\" alt=\"");


            Write(AdminResources.LogoLabel);

            WriteLiteral("\" />\r\n                <span class=\"aspnet\">ASP.NET</span>&nbsp;");


            Write(AdminResources.AdminModuleDisplayTitle);

            WriteLiteral("\r\n            </h1>\r\n             <div id=\"settings\">\r\n                <span>\r\n  " +
                         "                  ");


            Write(RenderSection("PageSettings", required: false));

            WriteLiteral("\r\n                    &nbsp;\r\n");


            if (AdminSecurity.IsAuthenticated(Request))
            {
                WriteLiteral("                        <a href=\"");


                Write(Href("Logout"));

                WriteLiteral("\">");


                Write(AdminResources.Logout);

                WriteLiteral("</a>\r\n");
            }

            WriteLiteral("                </span>\r\n             </div>\r\n           </div>\r\n           <div " +
                         "class=\"clear\"></div>\r\n           <div id=\"breadcrumbs\" class=\"group\">\r\n         " +
                         "  <ul>\r\n");



            var firstCrumb = true;
            int current    = 0;



            foreach (var item in Page.BreadCrumbs)
            {
                current++;
                if (firstCrumb)
                {
                    firstCrumb = false;
                }
                else
                {
                    WriteLiteral("                    <li><span>&gt;</span></li>\r\n");
                }

                WriteLiteral("                <li ");


                Write((current == Page.BreadCrumbs.Count) ? @Html.Raw("class=\"selected\"") : null);

                WriteLiteral(">\r\n                <a href=\"");


                Write(item.Item2);

                WriteLiteral("\" title=\"");


                Write(item.Item1);

                WriteLiteral("\">");


                Write(item.Item1);

                WriteLiteral("</a>\r\n                </li>\r\n");
            }

            WriteLiteral("           </ul>\r\n\r\n        </div>\r\n        <div id=\"main\">\r\n");



            string sectionTitle = Page.SectionTitle ?? title;



            if (!sectionTitle.IsEmpty())
            {
                WriteLiteral("                <div class=\"page-title\">\r\n                    <h1>");


                Write(sectionTitle);

                WriteLiteral("</h1>\r\n");


                if (!String.IsNullOrEmpty(Page.Desc))
                {
                    WriteLiteral("                        <span>");


                    Write(Page.Desc);

                    WriteLiteral("</span>\r\n");
                }

                WriteLiteral("                </div>\r\n");
            }

            WriteLiteral("            ");


            Write(RenderBody());

            WriteLiteral("\r\n            <p />\r\n        </div>\r\n        <div id=\"footer\">\r\n            ");


            Write(RenderSection("Footer", required: false));

            WriteLiteral("\r\n        </div>\r\n      </div>\r\n   </body>\r\n</html>");
        }