Example #1
0
        public async Task <Response <bool> > Handle(ConfirmEmailQuery request, CancellationToken cancellationToken)
        {
            var user = await userManager.FindByEmailAsync(request.Email);

            if (ValidationUser(user))
            {
                await UpdateRequestForConfirmationLinkDateAsync(user);

                await emailSender.EmailConfirmationAsync(user);

                return(Response.Ok());
            }
            return(Response.Fail <bool>("اطلاعات شما معتبر نمیباشد", StatusCodeEnum.NOTAUTHORIZE));
        }
        public async Task <IActionResult> Confirm(string userId, string token, string returnUrl = "")
        {
            var query = new ConfirmEmailQuery
            {
                UserId    = userId,
                Token     = token,
                ReturnUrl = returnUrl
            };
            var result = await _mediator.Send(query);

            var response = _mapper.Map <ConfirmEmailResponse>(result);

            if (response.IsSuccess)
            {
                return(Ok());
            }

            return(NotFound(response.Errors));
        }
Example #3
0
        public async Task <IActionResult> Confirm(string userId, string token, string returnUrl)
        {
            var query = new ConfirmEmailQuery {
                Token = token, UserId = userId, ReturnUrl = returnUrl
            };
            var result = await _mediator.Send(query);

            var response = _mapper.Map <ConfirmEmailResponse>(result);

            if (response.IsSuccess)
            {
                return(View("UpdatePassword", new UpdatePasswordModel
                {
                    Token = token,
                    ReturnUrl = response.ReturnUrl,
                    UserId = userId,
                    ResetPasswordToken = response.ResetPasswordToken
                }));
            }

            return(View("ConfirmError", new ErrorModel {
                Message = string.Join(" ", response.Errors)
            }));
        }