Skip to content
This repository has been archived by the owner on May 6, 2020. It is now read-only.

Commit

Permalink
Added base64 password storage
Browse files Browse the repository at this point in the history
  • Loading branch information
StephaneL committed Aug 30, 2014
1 parent 5b22bd0 commit f44a9eb
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions MainWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@ public MainWindow()
serviceUrl.Text = Properties.Settings.Default.ServiceURL;
domain.Text = Properties.Settings.Default.Domain;
username.Text = Properties.Settings.Default.Username;
password.Text = Properties.Settings.Default.Password;
password.Text = FromBase64(Properties.Settings.Default.Password);
updateInterval.Value = Properties.Settings.Default.UpdateInterval;

updater.ServiceUrl = Properties.Settings.Default.ServiceURL;
updater.Domain = Properties.Settings.Default.Domain;
updater.Username = Properties.Settings.Default.Username;
updater.Password = Properties.Settings.Default.Password;
updater.Password = FromBase64(Properties.Settings.Default.Password);
updater.UpdateInterval = (int)Properties.Settings.Default.UpdateInterval;

updater.ErrorCallback = new EventHandler(this.ErrorCallback);
Expand Down Expand Up @@ -73,7 +73,7 @@ private void validateButton_Click(object sender, EventArgs e)
Properties.Settings.Default.ServiceURL = serviceUrl.Text;
Properties.Settings.Default.Domain = domain.Text;
Properties.Settings.Default.Username = username.Text;
Properties.Settings.Default.Password = password.Text;
Properties.Settings.Default.Password = ToBase64(password.Text);
Properties.Settings.Default.UpdateInterval = updateInterval.Value;
Properties.Settings.Default.Save();

Expand Down Expand Up @@ -113,5 +113,15 @@ private void trayIcon_DoubleClick(object sender, EventArgs e)
{
Show();
}

private string FromBase64(string input)
{
return System.Text.Encoding.UTF8.GetString(System.Convert.FromBase64String(input));
}

private string ToBase64(string input)
{
return System.Convert.ToBase64String(System.Text.Encoding.UTF8.GetBytes(input));
}
}
}

0 comments on commit f44a9eb

Please # to comment.