// GET: Home
        public ActionResult Index()
        {
            ViewBag.Title     = "Beth Castillo";
            ViewBag.Recaptcha = ReCaptcha.GetHtml(ConfigurationManager.AppSettings["ReCaptcha:SiteKey"], theme: "blackglass");

            return(View());
        }
Example #2
0
 public ActionResult Login(string returnUrl)
 {
     ViewBag.ReturnUrl = returnUrl;
     ViewBag.Recaptcha = ReCaptcha.GetHtml(ConfigurationManager.AppSettings["ReCaptcha:SiteKey"]);
     ViewBag.publicKey = ConfigurationManager.AppSettings["ReCaptcha:SiteKey"];
     return(View());
 }
 public ActionResult Register()
 {
     ViewBag.Recaptcha = ReCaptcha.GetHtml(ConfigurationManager.AppSettings["ReCaptcha:SiteKey"]);
     ViewBag.publicKey = ConfigurationManager.AppSettings["ReCaptcha:SiteKey"];
     ViewBag.IPAddress = Server.HtmlEncode(Request.UserHostAddress);
     return(View());
 }
Example #4
0
        public ActionResult Create()
        {
            ViewBag.Recaptcha = ReCaptcha.GetHtml(ConfigurationManager.AppSettings["ReCaptcha:SiteKey"]);
            ViewBag.publicKey = ConfigurationManager.AppSettings["ReCaptcha:SiteKey"];
            CVModel model = (CVModel)TempData["CVModel"] ?? new CVModel();

            return(View(model));
        }
Example #5
0
        public ActionResult Index()
        {
            var item = new DatBao();

            ViewBag.Recaptcha = ReCaptcha.GetHtml(ConfigurationManager.AppSettings["ReCaptcha:SiteKey"]);
            ViewBag.publicKey = ConfigurationManager.AppSettings["ReCaptcha:SiteKey"];
            return(View("Create", item));
        }
Example #6
0
        public ActionResult Login()
        {
            ViewBag.Recaptcha = ReCaptcha.GetHtml(ConfigurationManager.AppSettings["ReCaptcha:SiteKey"]);
            ViewBag.publicKey = ConfigurationManager.AppSettings["ReCaptcha:SiteKey"];
            UserModel viewModel;

            viewModel = (UserModel)TempData["userModel"] ?? new UserModel();
            return(View(viewModel));
        }
Example #7
0
        public ActionResult Register(string returnUrl)
        {
            var model = new RegisterViewModel {
                UserRoleList = GetUserTypeList()
            };

            ViewBag.Recaptcha = ReCaptcha.GetHtml(ConfigurationManager.AppSettings["ReCaptcha:SiteKey"]);
            ViewBag.publicKey = ConfigurationManager.AppSettings["ReCaptcha:SiteKey"];
            ViewBag.ReturnUrl = returnUrl;
            return(View(model));
        }
Example #8
0
        public void ReCaptchaOptionsMissingWhenNoOptionsAndDefaultRendering()
        {
            var html = ReCaptcha.GetHtml(GetContext(), "PUBLIC_KEY");

            AssertEqualsIgnoreLineBreaks(
                @"<script src=""http://api.recaptcha.net/challenge?k=PUBLIC_KEY"" type=""text/javascript""></script>" +
                @"<noscript>" +
                @"<iframe frameborder=""0"" height=""300"" src=""http://api.recaptcha.net/noscript?k=PUBLIC_KEY"" width=""500""></iframe><br></br>" +
                @"<textarea cols=""40"" name=""recaptcha_challenge_field"" rows=""3""></textarea>" +
                @"<input name=""recaptcha_response_field"" type=""hidden"" value=""manual_challenge""></input>" +
                @"</noscript>",
                html);
        }
        public ActionResult Login()
        {
            ViewBag.Recaptcha = ReCaptcha.GetHtml(ConfigurationManager.AppSettings["ReCaptcha:SiteKey"]);
            ViewBag.publicKey = ConfigurationManager.AppSettings["ReCaptcha:SiteKey"];

            if (Session["userToken"] == null)
            {
                return(View());
            }
            else
            {
                return(RedirectToAction("Home", "User"));
            }
        }
Example #10
0
        public void ReCaptchaOptionsMissingWhenNoOptionsAndDefaultRendering()
        {
            var html = ReCaptcha.GetHtml(GetContext(), "PUBLIC_KEY");

            UnitTestHelper.AssertEqualsIgnoreWhitespace(
                @"<script src=""http://www.google.com/recaptcha/api/challenge?k=PUBLIC_KEY"" type=""text/javascript""></script>" +
                @"<noscript>" +
                @"<iframe frameborder=""0"" height=""300px"" src=""http://www.google.com/recaptcha/api/noscript?k=PUBLIC_KEY"" width=""500px""></iframe><br/><br/>" +
                @"<textarea cols=""40"" name=""recaptcha_challenge_field"" rows=""3""></textarea>" +
                @"<input name=""recaptcha_response_field"" type=""hidden"" value=""manual_challenge""/>" +
                @"</noscript>",
                html.ToString());
            XhtmlAssert.Validate1_0(html, addRoot: true);
        }
Example #11
0
        public ActionResult Index()
        {
            //var items = GopYManager.Instance.GetItems();

            //ViewBag.DanhMucList = DanhMucManager.Instance.GetItems().ToList();

            var item = new GopY {
            };

            ViewBag.Recaptcha = ReCaptcha.GetHtml(ConfigurationManager.AppSettings["ReCaptcha:SiteKey"]);
            ViewBag.publicKey = ConfigurationManager.AppSettings["ReCaptcha:SiteKey"];

            return(View("Create", item));
        }
Example #12
0
        public void RenderUsesLastError()
        {
            HttpContextBase context = GetContext();

            ReCaptcha.HandleValidateResponse(context, "false\nincorrect-captcha-sol");
            var html = ReCaptcha.GetHtml(context, "PUBLIC_KEY");

            AssertEqualsIgnoreLineBreaks(
                @"<script src=""http://api.recaptcha.net/challenge?k=PUBLIC_KEY&amp;error=incorrect-captcha-sol"" type=""text/javascript""></script>" +
                @"<noscript>" +
                @"<iframe frameborder=""0"" height=""300"" src=""http://api.recaptcha.net/noscript?k=PUBLIC_KEY"" width=""500""></iframe><br></br>" +
                @"<textarea cols=""40"" name=""recaptcha_challenge_field"" rows=""3""></textarea>" +
                @"<input name=""recaptcha_response_field"" type=""hidden"" value=""manual_challenge""></input>" +
                @"</noscript>",
                html);
        }
Example #13
0
        public void RenderUsesLastError()
        {
            HttpContextBase context = GetContext();

            ReCaptcha.HandleValidateResponse(context, "false\nincorrect-captcha-sol");
            var html = ReCaptcha.GetHtml(context, "PUBLIC_KEY");

            UnitTestHelper.AssertEqualsIgnoreWhitespace(
                @"<script src=""http://www.google.com/recaptcha/api/challenge?k=PUBLIC_KEY&amp;error=incorrect-captcha-sol"" type=""text/javascript""></script>" +
                @"<noscript>" +
                @"<iframe frameborder=""0"" height=""300px"" src=""http://www.google.com/recaptcha/api/noscript?k=PUBLIC_KEY"" width=""500px""></iframe><br/><br/>" +
                @"<textarea cols=""40"" name=""recaptcha_challenge_field"" rows=""3""></textarea>" +
                @"<input name=""recaptcha_response_field"" type=""hidden"" value=""manual_challenge""/>" +
                @"</noscript>",
                html.ToString());
            XhtmlAssert.Validate1_0(html, addRoot: true);
        }
Example #14
0
        public void ReCaptchaOptionsWhenMultipleOptionsFromDictionaryAndDefaultRendering()
        {
            // verifies that a dictionary will serialize the same as a projection
            var options = new Dictionary <string, object> {
                { "theme", "white" }, { "tabindex", 5 }
            };
            var html = ReCaptcha.GetHtml(GetContext(), "PUBLIC_KEY", options: options);

            UnitTestHelper.AssertEqualsIgnoreWhitespace(
                @"<script type=""text/javascript"">var RecaptchaOptions={""theme"":""white"",""tabindex"":5};</script>" +
                @"<script src=""http://www.google.com/recaptcha/api/challenge?k=PUBLIC_KEY"" type=""text/javascript""></script>" +
                @"<noscript>" +
                @"<iframe frameborder=""0"" height=""300px"" src=""http://www.google.com/recaptcha/api/noscript?k=PUBLIC_KEY"" width=""500px""></iframe><br/><br/>" +
                @"<textarea cols=""40"" name=""recaptcha_challenge_field"" rows=""3""></textarea>" +
                @"<input name=""recaptcha_response_field"" type=""hidden"" value=""manual_challenge""/>" +
                @"</noscript>",
                html.ToString());
            XhtmlAssert.Validate1_0(html, addRoot: true);
        }
Example #15
0
        public void ReCaptchaOptionsWhenMultipleOptionsFromDictionaryAndDefaultRendering()
        {
            // verifies that a dictionary will serialize the same as a projection
            var options = new Dictionary <string, object>()
            {
                { "theme", "white" }, { "tabindex", 5 }
            };
            var html = ReCaptcha.GetHtml(GetContext(), "PUBLIC_KEY", options: options);

            AssertEqualsIgnoreLineBreaks(
                @"<script type=""text/javascript"">var RecaptchaOptions={""theme"":""white"",""tabindex"":5}</script>" +
                @"<script src=""http://api.recaptcha.net/challenge?k=PUBLIC_KEY"" type=""text/javascript""></script>" +
                @"<noscript>" +
                @"<iframe frameborder=""0"" height=""300"" src=""http://api.recaptcha.net/noscript?k=PUBLIC_KEY"" width=""500""></iframe><br></br>" +
                @"<textarea cols=""40"" name=""recaptcha_challenge_field"" rows=""3""></textarea>" +
                @"<input name=""recaptcha_response_field"" type=""hidden"" value=""manual_challenge""></input>" +
                @"</noscript>",
                html);
        }
        public async Task <ActionResult> Create(UserViewModel user)
        {
            if (ModelState.IsValid && ReCaptcha.Validate(ConfigurationManager.AppSettings["ReCaptcha:SecretKey"]))
            {
                // создаем переменную типа AppUser
                AppUser _user = new AppUser()
                {
                    UserName = user.Name, Email = user.Email
                };
                // Сохраняем в базу
                IdentityResult _result = await UserManager.CreateAsync(_user, user.Password);

                if (_result.Succeeded)
                {
                    // Создаем корневую директорию пользователя
                    _user.CreateMainFolder();
                    // Сохраняем это
                    IdentityResult _res = await UserManager.UpdateAsync(_user);

                    return(RedirectToAction("Index", "File"));
                }
                else
                {
                    AddErrors(_result);
                }
            }

            var captchaLastErrors = ReCaptcha.GetLastErrors(this.HttpContext);

            if (captchaLastErrors == null)
            {
                ViewBag.Recaptcha = ReCaptcha.GetHtml(ConfigurationManager.AppSettings["ReCaptcha:SiteKey"]);
            }
            else
            {
                ViewBag.RecaptchaLastErrors = captchaLastErrors;
            }

            ViewBag.publicKey = ConfigurationManager.AppSettings["ReCaptcha:SiteKey"];
            return(View(user));
        }
 public ActionResult Create()
 {
     ViewBag.Recaptcha = ReCaptcha.GetHtml(ConfigurationManager.AppSettings["ReCaptcha:SiteKey"]);
     ViewBag.publicKey = ConfigurationManager.AppSettings["ReCaptcha:SiteKey"];
     return(View());
 }