Ejemplo n.º 1
0
        public async Task <bool> CheckExistUserPasswordAsync(int id, UserCheckPasswordRq model)
        {
            var user = await _userManager.FindByIdAsync(id.ToString());

            var passwordOK = await _userManager.CheckPasswordAsync(user, model.Password);

            if (!passwordOK)
            {
                return(false);
            }
            return(true);
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> CheckUserPassword([FromBody] UserCheckPasswordRq model)
        {
            try
            {
                UserIdentity <int> issuer = null;
                issuer = GetCurrentUserIdentity <int>(); var checkPassword = await _authService.CheckExistUserPasswordAsync(issuer.Id, model);

                if (!checkPassword)
                {
                    return(BadRequest("Wrong Password"));
                }
                return(Ok(checkPassword));
            }
            catch (Exception ex)
            {
                return(BadRequest(ex.Message));
            }
        }