public async Task <IActionResult> SendVerificationEmail(IndexViewModel model) { if (!ModelState.IsValid) { return(View(model)); } var user = await _userManager.GetUserAsync(User); if (user == null) { throw new ApplicationException($"Unable to load user with ID '{_userManager.GetUserId(User)}'."); } var code = await _userManager.GenerateEmailConfirmationTokenAsync(user); var callbackUrl = Url.EmailConfirmationLink(user.Id, code, Request.Scheme); var email = user.Email; var evt = new UserVerified { Email = email, CallbackUrl = callbackUrl }; _queue.QueueBroadcast(evt); StatusMessage = "Verification email sent. Please check your email."; return(RedirectToAction(nameof(MyAccount))); }
public ActionResult DeleteConfirmed(int id) { UserVerified userverified = db.UserVerifieds.Find(id); db.UserVerifieds.Remove(userverified); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "Id,UserId,DateTime,Ip")] UserVerified userverified) { if (ModelState.IsValid) { db.Entry(userverified).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.UserId = new SelectList(db.Userses, "Id", "Name", userverified.UserId); return(View(userverified)); }
// GET: /UserVerified/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } UserVerified userverified = db.UserVerifieds.Find(id); if (userverified == null) { return(HttpNotFound()); } return(View(userverified)); }
public async Task SetVerifiedAsync(IGuildUser guildUser, long forumUserId) { using var uow = _db.UnitOfWork; if (!uow.VerifiedUsers.SetVerified(guildUser.GuildId, guildUser.Id, forumUserId)) { throw new UserCannotVerifyException(); } await uow.SaveChangesAsync().ConfigureAwait(false); await AddVerifiedRoleAsync(guildUser).ConfigureAwait(false); await UserVerified.Invoke(guildUser, forumUserId).ConfigureAwait(false); }
private async Task HandleAsync(UserVerified @event, CancellationToken cancellationToken = default) { if (cancellationToken.IsCancellationRequested) { _logger.LogInformation($"{nameof(DocumentProjectionManager)}.{nameof(HandleAsync)} was cancelled before execution"); cancellationToken.ThrowIfCancellationRequested(); } await Task.WhenAll(_projectionWriters.Select(pw => pw.AddAsync(@event.Subject, () => new UserDocuments { UserId = @event.Subject, Documents = new List <UserDocument>() }, cancellationToken))); }
// GET: /UserVerified/Delete/5 public ActionResult Delete(int?id) { if (Session["type"] == null || Session["type"] == "") { Session["dv"] = "Delete"; Session["dc"] = "UserVerified"; return(RedirectToAction("Login", "Users")); } if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } UserVerified userverified = db.UserVerifieds.Find(id); if (userverified == null) { return(HttpNotFound()); } return(View(userverified)); }
// GET: /UserVerified/Edit/5 public ActionResult Edit(int?id) { if (Session["type"] == null || Session["type"] == "") { Session["dv"] = "Edit"; Session["dc"] = "UserVerified"; return(RedirectToAction("Login", "Users")); } if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } UserVerified userverified = db.UserVerifieds.Find(id); if (userverified == null) { return(HttpNotFound()); } ViewBag.UserId = new SelectList(db.Userses, "Id", "Name", userverified.UserId); return(View(userverified)); }
private void Handle(UserVerified @event) { _state.IsVerified = true; Version = @event.Version; }