public async Task ConfirmEmailTokenAsync(ConfirmEmailTokenRequest request)
        {
            var AcceptedEmail = jwtAuthManager.ConfirmEmailToken(request.UserName, request.Token, DateTime.Now);

            if (AcceptedEmail == null)
            {
                throw new Exception($"User with {AcceptedEmail} not found.");
            }
            var CurrentUser = await userServices.GetUserByEmailAsync(AcceptedEmail);

            CurrentUser.IsEmailConfirmed = true;
            await userServices.EditAsync(CurrentUser);
        }
Exemple #2
0
        public ActionResult ConfirmEmailToken(string UserName, string token)
        {
            var AcceptedEmail = _jwtAuthManager.ConfirmEmailToken(UserName, token, DateTime.Now);

            if (AcceptedEmail == null)
            {
                return(BadRequest());
            }
            var CurrentUser = _userService.GetUserByEmail(AcceptedEmail);

            CurrentUser.IsEmailConfirmed = true;
            _userService.Edit(CurrentUser);
            return(Ok());
        }