Skip to content

Commit da919c0

Browse files
committed
Security changes, v2.6
1 parent 2476d10 commit da919c0

9 files changed

Lines changed: 127 additions & 254 deletions

File tree

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
All notable changes to this project will be documented in this file.
44

5+
## [2.6] - 2021-05-03
6+
- Removed: Backup & Restore feature
7+
- Removed: Reset button when locked
8+
59
## [2.5] - 2019-11-21
610
- Bugfix when restoring state
711

Lain/LoginForm.Designer.cs

Lines changed: 21 additions & 56 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Lain/LoginForm.cs

Lines changed: 6 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
using System;
22
using System.IO;
3-
using System.IO.Compression;
43
using System.Windows.Forms;
54

65
namespace Lain
@@ -71,22 +70,6 @@ private void Login()
7170
}
7271
}
7372

74-
private void Reset()
75-
{
76-
try
77-
{
78-
if (Directory.Exists(Required.DataFolder))
79-
{
80-
Directory.Delete(Required.DataFolder, true);
81-
}
82-
}
83-
catch { }
84-
finally
85-
{
86-
Application.Restart();
87-
}
88-
}
89-
9073
private void btnExit_Click(object sender, EventArgs e)
9174
{
9275
switch (_type)
@@ -107,36 +90,28 @@ private void btnOk_Click(object sender, EventArgs e)
10790
Login();
10891
}
10992

110-
private void btnReset_Click(object sender, EventArgs e)
111-
{
112-
if (MessageBox.Show("Do you really want to reset Lain?\nThis will delete everything!", "Reset Lain?", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
113-
{
114-
Reset();
115-
}
116-
}
117-
11893
private void LoginForm_Load(object sender, EventArgs e)
11994
{
12095
CheckForIllegalCrossThreadCalls = false;
12196
switch (_type)
12297
{
12398
case LoginType.Authorize:
12499
btnExit.Text = "Cancel";
125-
btnReset.Visible = false;
126-
btnRestore.Visible = false;
100+
//btnReset.Visible = false;
101+
//btnRestore.Visible = false;
127102
break;
128103

129104
case LoginType.Remove:
130105
btnExit.Text = "Cancel";
131-
btnReset.Visible = false;
132-
btnRestore.Visible = false;
106+
//btnReset.Visible = false;
107+
//btnRestore.Visible = false;
133108
status.Text = "Enter your password\nto delete this account";
134109
break;
135110

136111
case LoginType.RemoveAll:
137112
btnExit.Text = "Cancel";
138-
btnReset.Visible = false;
139-
btnRestore.Visible = false;
113+
//btnReset.Visible = false;
114+
//btnRestore.Visible = false;
140115
status.Text = "Enter your password\nto delete all your accounts";
141116
break;
142117
}
@@ -159,44 +134,5 @@ private void pictureBox1_Click(object sender, EventArgs e)
159134
return;
160135
}
161136
}
162-
163-
private void RestoreBackup()
164-
{
165-
if (MessageBox.Show("Do you really want restore a backup?\nThis will delete your current accounts!", "Restore backup?", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
166-
{
167-
OpenFileDialog dialog = new OpenFileDialog();
168-
dialog.DefaultExt = ".Lain";
169-
dialog.Title = "Restore backup ...";
170-
dialog.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyComputer);
171-
dialog.FileName = string.Empty;
172-
dialog.Filter = "Lain files|*.Lain";
173-
174-
if (dialog.ShowDialog() == DialogResult.OK)
175-
{
176-
try
177-
{
178-
if (Directory.Exists(Required.DataFolder))
179-
{
180-
Directory.Delete(Required.DataFolder, true);
181-
}
182-
}
183-
catch { }
184-
finally
185-
{
186-
try
187-
{
188-
ZipFile.ExtractToDirectory(dialog.FileName, Required.DataFolder);
189-
Application.Restart();
190-
}
191-
catch { }
192-
}
193-
}
194-
}
195-
}
196-
197-
private void button1_Click(object sender, EventArgs e)
198-
{
199-
RestoreBackup();
200-
}
201137
}
202138
}

Lain/MainForm.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -438,7 +438,7 @@ private void LoadAccounts()
438438

439439
AccountView.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells);
440440
AccountView.Sort(AccountView.Columns[0], ListSortDirection.Ascending);
441-
441+
442442
if (AccountView.Rows.Count > 0)
443443
{
444444
AccountView.ClearSelection();

0 commit comments

Comments
 (0)