Esempio n. 1
0
        private static string CreateConfirmationUrl(ControllerBase controllerBase, long userId, string token)
        {
            string          action          = nameof(UsersController.ConfirmEmail);
            ConfirmEmailDto confirmEmailDto = new ConfirmEmailDto {
                UserId = userId, Token = token
            };
            string protocol = controllerBase.Request.Scheme;

            return(controllerBase.Url.Action(action, null, confirmEmailDto, protocol));
        }
Esempio n. 2
0
        async Task <ActionResult <SwmsUser> > IUserEmailConfirmer.ConfirmEmail(ControllerBase controllerBase,
                                                                               ConfirmEmailDto confirmEmailDto)
        {
            SwmsUser swmsUser = await _userManager.FindByIdAsync(confirmEmailDto.UserId.ToString());

            if (swmsUser == null)
            {
                return(controllerBase.NotFound());
            }

            IdentityResult identityResult = await _userManager.ConfirmEmailAsync(swmsUser, confirmEmailDto.Token);

            if (identityResult.Succeeded)
            {
                return(controllerBase.Ok());
            }

            return(controllerBase.BadRequest());
        }