Skip to content

Commit 357bc3a

Browse files
authored
Add files via upload
1 parent 06bbd77 commit 357bc3a

16 files changed

+169
-80
lines changed

SafeNotes/AppManager.cs

Lines changed: 54 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,32 @@ private async void MainForm_Load(object sender, EventArgs e)
2828

2929
// Sets the minimum size of the form
3030
this.MinimumSize = new Size(960, 600);
31+
// If the user screen is 1280x720 set the size to 960x600
32+
if (Screen.PrimaryScreen.WorkingArea.Width <= 1280 || Screen.PrimaryScreen.WorkingArea.Height <= 720)
33+
{
34+
this.Size = new Size(960, 600);
35+
}
36+
else if (Screen.PrimaryScreen.WorkingArea.Width >= 1920 || Screen.PrimaryScreen.WorkingArea.Height >= 1080)
37+
{
38+
this.Size = new Size(1200, 750);
39+
}
40+
else if (Screen.PrimaryScreen.WorkingArea.Width >= 2560 || Screen.PrimaryScreen.WorkingArea.Height >= 1440)
41+
{
42+
this.Size = new Size(1400, 850);
43+
}
44+
else if (Screen.PrimaryScreen.WorkingArea.Width >= 3840 || Screen.PrimaryScreen.WorkingArea.Height >= 2160)
45+
{
46+
this.Size = new Size(1600, 950);
47+
} else
48+
{
49+
// set the size 20% larger than 1600, 950
50+
this.Size = new Size(1920, 1140);
51+
}
52+
53+
// Start in the middle of the screen (manually with math)
54+
this.StartPosition = FormStartPosition.Manual;
55+
this.Location = new Point((Screen.PrimaryScreen.WorkingArea.Width - this.Width) / 2,
56+
(Screen.PrimaryScreen.WorkingArea.Height - this.Height) / 2);
3157

3258
// Reset the IsRestartingForUpdate flag on application start
3359
if (_settings.IsRestartingForUpdate)
@@ -39,11 +65,13 @@ private async void MainForm_Load(object sender, EventArgs e)
3965
if (_settings.UserPassword == String.Empty)
4066
{
4167
PasswordStrength.Visible = true;
68+
PasswordLengthDisclaimer.Visible = true;
4269
PasswordStrength.Text = "Strength: 0/5\nTime to crack: Unknown";
4370
}
4471
else
4572
{
4673
PasswordStrength.Visible = false;
74+
PasswordLengthDisclaimer.Visible = false;
4775
}
4876

4977
NotepadTitle.Text = null;
@@ -130,6 +158,28 @@ await Task.Run(async () =>
130158
});
131159
}
132160

161+
private void PasswordDisclaimer_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
162+
{
163+
MessageBox.Show("Your password is used to encrypt and decrypt your entries locally on your device. It is not stored or " +
164+
"transmitted anywhere online, ensuring that only you have access to your data. Please remember your password, as losing " +
165+
"it means losing access to SafeNotes.", "Password Disclaimer", MessageBoxButtons.OK, MessageBoxIcon.Information);
166+
}
167+
168+
private void PinDisclaimer_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
169+
{
170+
MessageBox.Show("Your PIN is an additional layer of security that allows you to help increase SafeNotes security by requiring " +
171+
"two forms of verification at login. It is stored securely on your device and is only used for authentication purposes. " +
172+
"Please remember your PIN, as it is required for logging in if enabled.", "PIN Disclaimer", MessageBoxButtons.OK,
173+
MessageBoxIcon.Information);
174+
}
175+
176+
private void PasswordLengthDisclaimer_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
177+
{
178+
MessageBox.Show("SafeNotes recommends a password length of at least 14 characters for optimal security. Longer passwords are " +
179+
"generally more secure, as they are harder to guess or brute-force.", "Password Length Recommendation",
180+
MessageBoxButtons.OK, MessageBoxIcon.Information);
181+
}
182+
133183
private void RequirePenToLogin_CheckedChanged(object sender, EventArgs e)
134184
{
135185
if (RequirePinToLogin.Checked == true)
@@ -166,11 +216,6 @@ private void UserPassword_TextChanged(object sender, EventArgs e)
166216
UpdatePasswordStrength(UserPassword.Text);
167217
}
168218

169-
private void PasswordGenBox_TextChanged(object sender, EventArgs e)
170-
{
171-
UpdatePasswordStrength(PasswordGenBox.Text);
172-
}
173-
174219
private void UpdatePasswordStrength(string password)
175220
{
176221
int score = CalculatePasswordStrength(password);
@@ -753,6 +798,7 @@ private void UserLoginButton_Click(object sender, EventArgs e)
753798
//}
754799

755800
PasswordStrength.Visible = false;
801+
PasswordLengthDisclaimer.Visible = false;
756802

757803
// Checks if any of the supported password managers are installed
758804
string[] supportedManagers = { "Bitwarden", "KeePass Password Safe 2", "1Password", "LastPass", "ProtonPass", "NordPass" };
@@ -1153,7 +1199,7 @@ private void UsePassButton_Click(object sender, EventArgs e)
11531199
{
11541200
if (string.IsNullOrWhiteSpace(PasswordGenBox.Text))
11551201
{
1156-
MessageBox.Show("There is no password that has been generated, please generate a password first.", "No Password", MessageBoxButtons.OK, MessageBoxIcon.Error);
1202+
MessageBox.Show("There is no cryptographically secure password that has been generated, please generate a cryptographically secure password first.", "No Password", MessageBoxButtons.OK, MessageBoxIcon.Error);
11571203
return;
11581204
}
11591205

@@ -1172,7 +1218,7 @@ private void UsePassButton_Click(object sender, EventArgs e)
11721218

11731219
if (managerToOpen != null)
11741220
{
1175-
DialogResult savePassword = MessageBox.Show("Do you want to save your password to " + managerToOpen + "?", "Save Password", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
1221+
DialogResult savePassword = MessageBox.Show("Do you want to save your cryptographically secure password to " + managerToOpen + "?", "Save Password", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
11761222
if (savePassword == DialogResult.Yes)
11771223
{
11781224
string managerPath = FindManagerPath(managerToOpen);
@@ -1196,7 +1242,7 @@ private void UsePassButton_Click(object sender, EventArgs e)
11961242
}
11971243
else
11981244
{
1199-
MessageBox.Show("None of the supported password managers are installed.\n\nRemember to save your password!", "Password Manager Not Found", MessageBoxButtons.OK, MessageBoxIcon.Information);
1245+
MessageBox.Show("None of the supported password managers are installed.\n\nRemember to save your cryptographically secure password!", "Password Manager Not Found", MessageBoxButtons.OK, MessageBoxIcon.Information);
12001246
UserPassword.Text = PasswordGenBox.Text;
12011247
UserConfirmPassword.Text = PasswordGenBox.Text;
12021248
}

0 commit comments

Comments
 (0)