コード例 #1
0
        public async Task ResendEmailVerification(IUser user)
        {
            var existing = await _userService.GetById(user.Id);

            if (existing == null)
            {
                throw new NotFoundException();
            }
            var claimType = "ReissueEmailVerification".ToLower();

            foreach (var uc in existing.UserClaims.Where(uc => uc.ClaimType == claimType))
            {
                uc.IsClaimed = true;
            }
            existing.UserClaims.Add(new UserClaim {
                ClaimToken = _encryptionUtil.GetUniqueKey(5),
                CreatedAt  = DateTime.UtcNow,
                ClaimType  = claimType,
            });
            await _userService.Update(existing);

            await _notifyService.ResendEmailVerification(user, existing.UserClaims.Last());
        }