Exemplo n.º 1
0
        public async Task <IActionResult> ResetClientSecret(ResetClientSecretViewModel resetClientSecretSViewModel)
        {
            if (ModelState.IsValid)
            {
                var updateClient = await HandleResetClientSecret(resetClientSecretSViewModel.id, resetClientSecretSViewModel.ClientSecrets);

                if (updateClient != null)
                {
                    return(RedirectToAction(nameof(Index)));
                }
                else
                {
                    ModelState.AddModelError(String.Empty, "更新Client密码失败!");
                }
            }
            return(View(resetClientSecretSViewModel));
        }
Exemplo n.º 2
0
        public async Task <IActionResult> ResetClientSecret(int?id)
        {
            if (id == null)
            {
                return(BadRequest());
            }
            var client = await _configurationContext.Clients.Where(a => a.Id == id).FirstOrDefaultAsync();

            if (client != null)
            {
                var viewModel = new ResetClientSecretViewModel
                {
                    ClientId   = client.ClientId,
                    id         = client.Id,
                    ClientName = client.ClientName,
                };
                return(View(viewModel));
            }
            else
            {
                return(BadRequest());
            }
        }