コード例 #1
0
        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)));
        }
コード例 #2
0
        public ActionResult DeleteConfirmed(int id)
        {
            UserVerified userverified = db.UserVerifieds.Find(id);

            db.UserVerifieds.Remove(userverified);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
コード例 #3
0
 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));
 }
コード例 #4
0
        // 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));
        }
コード例 #5
0
        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);
        }
コード例 #6
0
        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)));
        }
コード例 #7
0
        // 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));
        }
コード例 #8
0
        // 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));
        }
コード例 #9
0
ファイル: User.cs プロジェクト: sound-it-out/sio-identity
 private void Handle(UserVerified @event)
 {
     _state.IsVerified = true;
     Version           = @event.Version;
 }