Example #1
0
        public virtual async Task <ActionResult> Post(string ticket, VerifyEmailSecret command, string returnUrl, string emailAddress)
        {
            //System.Threading.Thread.Sleep(new Random().Next(5000, 5001));

            if (command == null)
            {
                return(View(MVC.Errors.Views.BadRequest));
            }

            if (!ModelState.IsValid)
            {
                ViewBag.ReturnUrl = returnUrl;
                ViewBag.ActionUrl = Url.Action(MVC.ResetPasswordVerifySecret.Post());
                ViewBag.Ticket    = ticket;
                ViewBag.Purpose   = EmailVerificationPurpose.ForgotPassword;
                if (Session.VerifyEmailTickets().Contains(ticket))
                {
                    ViewBag.EmailAddress = emailAddress;
                }
                return(View(MVC.Security.Views.ResetPassword.VerifySecret, command));
            }

            await _commands.Execute(command);

            return(RedirectToAction(await MVC.ResetPassword.Index(command.Token, ticket, returnUrl)));
        }
        public virtual ActionResult Validate(VerifyEmailSecret command, string fieldName = null)
        {
            //System.Threading.Thread.Sleep(new Random().Next(5000, 5001));
            if (command == null)
            {
                Response.StatusCode = 400;
                return(Json(null));
            }

            var result = new ValidatedFields(ModelState, fieldName);

            //ModelState[command.PropertyName(x => x.EmailAddress)].Errors.Clear();
            //result = new ValidatedFields(ModelState, fieldName);

            return(new CamelCaseJsonResult(result));
        }
        public virtual ActionResult Validate(VerifyEmailSecret command, string fieldName = null)
        {
            //System.Threading.Thread.Sleep(new Random().Next(5000, 5001));
            if (command == null)
            {
                Response.StatusCode = 400;
                return Json(null);
            }

            var result = new ValidatedFields(ModelState, fieldName);

            //ModelState[command.PropertyName(x => x.EmailAddress)].Errors.Clear();
            //result = new ValidatedFields(ModelState, fieldName);

            return new CamelCaseJsonResult(result);
        }
        public virtual async Task<ActionResult> Post(string ticket, VerifyEmailSecret command, string emailAddress)
        {
            //System.Threading.Thread.Sleep(new Random().Next(5000, 5001));

            if (command == null) return View(MVC.Errors.Views.BadRequest);

            if (!ModelState.IsValid)
            {
                ViewBag.ActionUrl = Url.Action(MVC.UserEmailVerifySecret.Post());
                ViewBag.Ticket = command.Ticket;
                ViewBag.Purpose = EmailVerificationPurpose.AddEmail;
                if (Session.VerifyEmailTickets().Contains(command.Ticket))
                    ViewBag.EmailAddress = emailAddress;
                return View(MVC.Security.Views.User.AddEmailVerifySecret, command);
            }

            await _commands.Execute(command);

            return RedirectToAction(await MVC.UserEmailConfirm.Index(command.Token, command.Ticket));
        }
        public virtual async Task<ActionResult> Post(string ticket, VerifyEmailSecret command, string returnUrl, string emailAddress)
        {
            // todo: make sure we still have a remote login

            //System.Threading.Thread.Sleep(new Random().Next(5000, 5001));

            if (command == null) return View(MVC.Errors.Views.BadRequest);

            if (!ModelState.IsValid)
            {
                ViewBag.ReturnUrl = returnUrl;
                ViewBag.ActionUrl = Url.Action(MVC.SignOnVerifySecret.Post());
                ViewBag.Ticket = ticket;
                ViewBag.Purpose = EmailVerificationPurpose.CreateRemoteUser;
                if (Session.VerifyEmailTickets().Contains(ticket))
                    ViewBag.EmailAddress = emailAddress;
                return View(MVC.Security.Views.SignOn.VerifySecret, command);
            }

            await _commands.Execute(command);

            return RedirectToAction(await MVC.SignOnCreateUser.Index(command.Token, ticket, returnUrl));
        }