internal void LoadConfigurations() { ApplicationConfiguration = _configService.GetOrDefault <ApplicationConfigModel>(); ToolbarConfiguration = _configService.GetOrDefault <ToolbarConfigModel>(); PaneConfiguration = _configService.GetOrDefault <PaneConfigModel>(); UpdateConfiguration = _configService.GetOrDefault <UpdateConfigModel>(); }
public ActionResult Manage(String error = "") { var config = _context.AuthentificationConfigs.First(); var loginConfig = _context.LoginConfigs.First(); ViewBag.Error = error; var updateConfigModel = new UpdateConfigModel() { TimeOutSession = config.TimeOutSession, IsLowerCase = config.IsLowerCase, IsNumber = config.IsNumber, IsPeriodic = config.IsPeriodic, IsSpecialCase = config.IsSpecialCase, IsUpperCase = config.IsUpperCase, MaxLenght = config.MaxLenght, MinLenght = config.MinLenght, PeriodPeriodic = config.PeriodPeriodic, NbrLastPasswords = config.NbrLastPasswords, DelayBetweenBlocks = loginConfig.DelayBetweenBlocks, DelayBetweenFailedAuthentication = loginConfig.DelayBetweenFailedAuthentication, MaxBlocksBeforeAdmin = loginConfig.MaxBlocksBeforeAdmin, NbAttemptsBeforeBlocking = loginConfig.NbAttemptsBeforeBlocking, StrongAuthentication = config.StrongAuthentication }; return(View(updateConfigModel)); }
/// <summary> /// 获取服务器版本 /// </summary> /// <returns></returns> private string GetServiceVersion() { string serverConfig = _local.UpdateConfig; UpdateConfigModel model = new UpdateConfigModel(); _model = model.GetRemoteModel(serverConfig); return(_model.Version); }
public IActionResult Update(int id, UpdateConfigModel model) { var entity = _service.Configs.Id(id).FirstOrDefault(); if (entity == null) { return(NotFound(new AppResultBuilder().NotFound())); } var validationResult = _service.ValidateUpdateConfig(User, entity, model); if (!validationResult.Valid) { return(BadRequest(validationResult.Result)); } _service.UpdateConfig(entity, model); context.SaveChanges(); return(NoContent()); }
public void UpdateConfig(Config entity, UpdateConfigModel model) { if (model.Info != null) { model.Info.CopyTo(entity); } if (model.SSP != null) { UpdateScreenSaverPlaylist(entity, model.SSP); } if (model.HomePage != null) { UpdateHomePageConfig(entity, model.HomePage); } if (model.ProgramEvent != null) { UpdateProgramEventConfig(entity, model.ProgramEvent); } if (model.Contact != null) { UpdateContactConfig(entity, model.Contact); } }
public ActionResult UpdateConfig(UpdateConfigModel model) { var user = UserManager.Find(User.Identity.Name, model.Password == null ? "" : model.Password); var config = _context.AuthentificationConfigs.First(); var loginConfig = _context.LoginConfigs.First(); if (user == null) { return(RedirectToAction("Manage", new { error = "Password invalide!" })); } else { config.TimeOutSession = model.TimeOutSession; config.IsLowerCase = model.IsLowerCase; config.IsNumber = model.IsNumber; config.IsPeriodic = model.IsPeriodic; config.IsSpecialCase = model.IsSpecialCase; config.IsUpperCase = model.IsUpperCase; config.MaxLenght = model.MaxLenght; config.MinLenght = model.MinLenght; config.PeriodPeriodic = model.PeriodPeriodic; config.NbrLastPasswords = model.NbrLastPasswords; config.StrongAuthentication = model.StrongAuthentication; loginConfig.DelayBetweenBlocks = model.DelayBetweenBlocks; loginConfig.DelayBetweenFailedAuthentication = model.DelayBetweenFailedAuthentication; loginConfig.MaxBlocksBeforeAdmin = model.MaxBlocksBeforeAdmin; loginConfig.NbAttemptsBeforeBlocking = model.NbAttemptsBeforeBlocking; _context.Entry(config).State = System.Data.Entity.EntityState.Modified; _context.Entry(loginConfig).State = System.Data.Entity.EntityState.Modified; _context.SaveChanges(); } return(RedirectToAction("Manage")); }
public async Task <IActionResult> SaveConfig(UpdateConfigModel model) { await BotClient.Instance.SaveConfig(model.Name, model.Definition, CancellationToken.None); return(this.Ok()); }
public ValidationResult ValidateUpdateConfig(ClaimsPrincipal principal, Config entity, UpdateConfigModel model) { return(ValidationResult.Pass()); }