예제 #1
0
		public User SetupDatabase(SetupVariables setupVariables, out Exception exception)
		{
			exception = null;
			try
			{
				_setupRepository.SetupDatabase();
			}
			catch (Exception exc)
			{
				exception = exc;
				return null;
			}

			var settings = _settingsManager.Current;
			settings.ForumTitle = setupVariables.ForumTitle;
			settings.SmtpServer = setupVariables.SmtpServer;
			settings.SmtpPort = setupVariables.SmtpPort;
			settings.MailerAddress = setupVariables.MailerAddress;
			settings.UseSslSmtp = setupVariables.UseSslSmtp;
			settings.UseEsmtp = setupVariables.UseEsmtp;
			settings.SmtpUser = setupVariables.SmtpUser;
			settings.SmtpPassword = setupVariables.SmtpPassword;
			_settingsManager.SaveCurrent();

			var user = _userService.CreateUser(setupVariables.Name, setupVariables.Email, setupVariables.Password, true, "");
			user.Roles = new List<string> {PermanentRoles.Admin, PermanentRoles.Moderator};
			var profile = new Profile(user.UserID) { IsTos = true, IsSubscribed = true, TimeZone = setupVariables.ServerTimeZone, IsDaylightSaving = setupVariables.ServerDaylightSaving, ShowDetails = true };
			_profileService.Create(profile);
			var edit = new UserEdit(user, profile);
			_userService.EditUser(user, edit, false, false, null, null, "", user);
			PopForumsActivation.StartServicesIfRunningInstance();
			return user;
		}
예제 #2
0
		public ActionResult Index(SetupVariables setupVariables)
		{
			if (_setupService.IsDatabaseSetup())
				return this.Forbidden("Forbidden", null);
			Exception exc;
			var user = _setupService.SetupDatabase(setupVariables, out exc);
			if (exc != null)
				return View("Exception", exc);
			_userService.Login(user, HttpContext);
			return View("Success");
		}
예제 #3
0
		public ActionResult Index()
		{
			if (!_setupService.IsConnectionPossible())
				return View("NoConnection");
			if (_setupService.IsDatabaseSetup())
				return this.Forbidden("Forbidden", null);
			var setupVariables = new SetupVariables
			                     	{
			                     		SmtpPort = 25,
										ServerDaylightSaving = true,
										ServerTimeZone = -5
									};
			ViewData[AdminController.TimeZonesKey] = DataCollections.TimeZones();
			return View(setupVariables);
		}