public async Task <ActionResult> Index(string button) { var ctx = Request.GetOwinContext(); var partial_user = await ctx.Environment.GetIdentityServerPartialLoginAsync(); if (partial_user == null) { return(View("Error")); } if (button == "yes") { // update the "database" for our users with the outcome var subject = partial_user.GetSubjectId(); //var user = EulaAtLoginUserService.Users.Single(x => x.Id.ToString() == subject); var user = _context.Users.Single(x => x.Id.ToString() == subject); user.AcceptedEula = true; _context.SaveChanges(); // find the URL to continue with the process to the issue the token to the RP var resumeUrl = await ctx.Environment.GetPartialLoginResumeUrlAsync(); return(Redirect(resumeUrl)); } ViewBag.Message = "Well, until you accept you can't continue."; return(View()); }
public ActionResult Create([Bind(Include = "Id,Username,Password,AcceptedEula")] User user) { if (ModelState.IsValid) { var plainPW = user.Password; //Encrypt PW var encryptedPW = General.AesEncrypt(plainPW, ConstantVars.IISAesSalt, ConstantVars.IISAesPassword); user.Password = encryptedPW; db.Users.Add(user); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(user)); }