public virtual async Task<ActionResult> Post(CreateLocalMembership command, string returnUrl, string emailAddress) { //System.Threading.Thread.Sleep(new Random().Next(5000, 5001)); if (command == null || string.IsNullOrWhiteSpace(emailAddress)) return View(MVC.Errors.Views.BadRequest); if (!ModelState.IsValid) { ViewBag.EmailAddress = emailAddress; ViewBag.Ticket = command.Ticket; ViewBag.Token = command.Token; ViewBag.ReturnUrl = returnUrl; return View(MVC.Security.Views.SignUp.CreateUser, command); } await _commands.Execute(command); var signIn = new SignIn { UserNameOrVerifiedEmail = command.UserName, Password = command.Password }; await _commands.Execute(signIn); Session.VerifyEmailTickets(null); Response.ClientCookie(signIn.SignedIn.Id, _queries); return this.RedirectToLocal(returnUrl, await MVC.UserName.Index()); }
public virtual async Task <ActionResult> Post(CreateLocalMembership command) { if (command == null) { return(View(MVC.Errors.Views.BadRequest)); } if (!ModelState.IsValid) { var userId = User.Identity.GetUserId <int>(); var user = await _queries.Execute(new UserViewBy(userId)); var model = new CreateLocalMembershipModel { UserView = user, Command = command, }; return(View(MVC.Security.Views.User.CreatePassword, model)); } await _commands.Execute(command); TempData.Alerts("**Your password was created successfully.**", AlertFlavor.Success, true); return(RedirectToAction(await MVC.UserPassword.Index())); }
public virtual async Task <ActionResult> Post(CreateLocalMembership command, string returnUrl, string emailAddress) { //System.Threading.Thread.Sleep(new Random().Next(5000, 5001)); if (command == null || string.IsNullOrWhiteSpace(emailAddress)) { return(View(MVC.Errors.Views.BadRequest)); } if (!ModelState.IsValid) { ViewBag.EmailAddress = emailAddress; ViewBag.Ticket = command.Ticket; ViewBag.Token = command.Token; ViewBag.ReturnUrl = returnUrl; return(View(MVC.Security.Views.SignUp.CreateUser, command)); } await _commands.Execute(command); var signIn = new SignIn { UserNameOrVerifiedEmail = command.UserName, Password = command.Password }; await _commands.Execute(signIn); Session.VerifyEmailTickets(null); Response.ClientCookie(signIn.SignedIn.Id, _queries); return(this.RedirectToLocal(returnUrl, await MVC.UserName.Index())); }
public virtual ActionResult Validate(CreateLocalMembership 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.UserName)].Errors.Add("Something went wrong"); //result = new ValidatedFields(ModelState, fieldName); return new CamelCaseJsonResult(result); }
public virtual ActionResult Validate(CreateLocalMembership 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.UserName)].Errors.Add("Something went wrong"); //result = new ValidatedFields(ModelState, fieldName); return(new CamelCaseJsonResult(result)); }
public virtual async Task<ActionResult> Post(CreateLocalMembership command) { if (command == null) return View(MVC.Errors.Views.BadRequest); if (!ModelState.IsValid) { var userId = User.Identity.GetUserId<int>(); var user = await _queries.Execute(new UserViewBy(userId)); var model = new CreateLocalMembershipModel { UserView = user, Command = command, }; return View(MVC.Security.Views.User.CreatePassword, model); } await _commands.Execute(command); TempData.Alerts("**Your password was created successfully.**", AlertFlavor.Success, true); return RedirectToAction(await MVC.UserPassword.Index()); }