Add server password to config UI

This commit is contained in:
Brant Martin
2018-08-23 06:38:20 -04:00
parent 355375e9db
commit 74b00d3ab1
2 changed files with 23 additions and 0 deletions

View File

@@ -99,5 +99,26 @@ namespace Torch.Server.ViewModels
public int SteamPort { get => _config.SteamPort; set => SetValue(x => _config.SteamPort = x, value); } public int SteamPort { get => _config.SteamPort; set => SetValue(x => _config.SteamPort = x, value); }
public string WorldName { get => _config.WorldName; set => SetValue(x => _config.WorldName = x, value); } public string WorldName { get => _config.WorldName; set => SetValue(x => _config.WorldName = x, value); }
//this is a damn server password. I don't care if this is insecure. Bite me.
private string _password;
public string Password
{
get
{
if (string.IsNullOrEmpty(_password))
{
if (string.IsNullOrEmpty(_config.ServerPasswordHash))
return string.Empty;
return "**********";
}
return _password;
}
set
{
_password = value;
_config.SetPassword(value);
}
}
} }
} }

View File

@@ -84,6 +84,8 @@
<Label Content=":" Width="12" /> <Label Content=":" Width="12" />
<TextBox Text="{Binding Port}" Width="48" Height="20" /> <TextBox Text="{Binding Port}" Width="48" Height="20" />
</StackPanel> </StackPanel>
<Label Content="Server Password"/>
<TextBox Text="{Binding Password}" Width="160"/>
<CheckBox IsChecked="{Binding PauseGameWhenEmpty}" Content="Pause When Empty" Margin="3" /> <CheckBox IsChecked="{Binding PauseGameWhenEmpty}" Content="Pause When Empty" Margin="3" />
</StackPanel> </StackPanel>
<StackPanel Grid.Column="1" Margin="3"> <StackPanel Grid.Column="1" Margin="3">