Skip to content

Commit

Permalink
Validation on login form
Browse files Browse the repository at this point in the history
  • Loading branch information
electroly committed Nov 4, 2024
1 parent d1c5e2a commit 69154a7
Showing 1 changed file with 25 additions and 2 deletions.
27 changes: 25 additions & 2 deletions src/J.App/LoginForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -350,8 +350,30 @@ private void SaveButton_Click(object? sender, EventArgs e)
}
}

private AccountSettings GetAccountSettings() =>
new(
private AccountSettings GetAccountSettings()
{
if (string.IsNullOrWhiteSpace(_endpointText.Text))
throw new Exception("Please enter an endpoint.");

if (string.IsNullOrWhiteSpace(_accessKeyIdText.Text))
throw new Exception("Please enter a keyID.");

if (string.IsNullOrWhiteSpace(_secretAccessKeyText.Text))
throw new Exception("Please enter an applicationKey.");

if (string.IsNullOrWhiteSpace(_bucketText.Text))
throw new Exception("Please enter a bucket name.");

if (string.IsNullOrWhiteSpace(_passwordText.Text))
throw new Exception("Please enter an encryption password.");

if (_enableM3u8FolderCheck.Checked)
{
if (string.IsNullOrWhiteSpace(_m3u8FolderText.Text))
throw new Exception("Please enter a folder for .M3U8 files.");
}

return new(
_endpointText.Text,
_accessKeyIdText.Text,
_secretAccessKeyText.Text,
Expand All @@ -361,6 +383,7 @@ private AccountSettings GetAccountSettings() =>
_m3u8FolderText.Text,
_m3u8HostnameText.Text
);
}

private void SetAccountSettings(AccountSettings settings)
{
Expand Down

0 comments on commit 69154a7

Please sign in to comment.