Esempio n. 1
0
        public bool ResetPassword(ResetPassParams passParams)
        {
            var command = new DatabaseCommand <ResetPassParams, bool>()
            {
                CallingInfo = passParams
            };

            this.ProxyCalling(ResetPasswordProxy, command);
            return(command.ReturnValue);
        }
Esempio n. 2
0
        public async Task <IActionResult> ResetPassword(ResetPassParams passes)
        {
            if (!_tokenizer.ValidateToken(passes.Token))
            {
                return(BadRequest());
            }

            var username = _tokenizer.DecodeToken(passes.Token).ToDictionary(x => x.Key, x => x.Value)[ClaimTypes.Email];

            GlobalHelpers.CurrentUser = await _dbService.FindByUsernameAsync(username);

            if (await _dbService.TryChangePasswordAsync(passes.NewPassword))
            {
                return(Ok());
            }

            return(BadRequest());
        }