Пример #1
0
        public async Task <IActionResult> CheckUserPassword([FromBody] CheckPasswordViewModel model)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    var user = await _userManager.FindByIdAsync(model.UserId.ToString());

                    if (user != null && await _userManager.CheckPasswordAsync(user, model.Password))
                    {
                        return(Ok("Password matches"));
                    }
                    else
                    {
                        return(NotFound($"Cannot found user with id: {model.UserId}"));
                    }
                }
                else
                {
                    return(BadRequest());
                }
            }
            catch (Exception e)
            {
                _logger.LogError("Failed to check user password {0}", e);
                return(BadRequest(e));
            }
        }
        public CheckPasswordView(string windowToOpenAction)
        {
            InitializeComponent();

            var vm = new CheckPasswordViewModel(windowToOpenAction)
            {
                Close = () => Close(),
                Hide  = () => Hide()
            };

            DataContext = vm;

            PasswordBox.Focus();
        }
 public CheckPasswordPage()
 {
     InitializeComponent();
     NavigationPage.SetBackButtonTitle(this, "");
     BindingContext = checkPasswordViewModel = new CheckPasswordViewModel(this.Navigation);
 }