public ActionResult Index(string password, string confirmPassword)
        {
            if (string.IsNullOrEmpty(password))
                ModelState.AddModelError("password", "Entry required");
            else if (string.IsNullOrEmpty(confirmPassword))
                ModelState.AddModelError("confirmPassword", "Entry required");
            else if (password != confirmPassword)
                ModelState.AddModelError("password", "Entries did not match; try again");
            if (!ModelState.IsValid)
                return View();
            else
            {
                var configuration = new Configuration
                {
                    AdminPassword = password,
                };
                _configurationRepository.SetConfiguration(configuration);

                // spin up initial bots (new team created for each bot in the /install/bots directory)
                foreach (var f in Directory.EnumerateFiles(Path.Combine(RockPaperAzure.AzureHelper.GetLocalFolder(), "bots")))
                {
                    _teamCommands.New(f);
                }

                _signin.Signin(password);
                return Redirect("~/Home");
            }
        }
示例#2
0
 protected static void SetupConfigurationToShowAStartingRoundOf(int round)
 {
   configurationRepository = MockRepository.GenerateMock<IConfigurationRepository>();
   var config = new Configuration();
   round = round == 0 ? 1 : round;
   while (config.RoundNumber != round)
   {
     config.AdvanceToNextRound();
   }
   configurationRepository.Stub(x => x.GetConfiguration()).Return(config);
 }
 public void SetConfiguration(Configuration configuration)
 {
     _repository.Update(configuration);
 }