Change username and password of other users
This commit is contained in:
@@ -35,12 +35,14 @@ namespace OpenSaveCloudClient.Core
|
||||
{
|
||||
Log log = new()
|
||||
{
|
||||
Timestamp = DateTime.Now,
|
||||
Message = message,
|
||||
Severity = LogSeverity.Error,
|
||||
};
|
||||
messages.Add(log);
|
||||
NewMessageEventArgs args = new()
|
||||
{
|
||||
Timestamp = DateTime.Now,
|
||||
Message = message,
|
||||
Severity = LogSeverity.Error,
|
||||
};
|
||||
@@ -51,12 +53,14 @@ namespace OpenSaveCloudClient.Core
|
||||
{
|
||||
Log log = new()
|
||||
{
|
||||
Timestamp = DateTime.Now,
|
||||
Message = message,
|
||||
Severity = LogSeverity.Information,
|
||||
};
|
||||
messages.Add(log);
|
||||
NewMessageEventArgs args = new()
|
||||
{
|
||||
Timestamp = DateTime.Now,
|
||||
Message = message,
|
||||
Severity = LogSeverity.Information,
|
||||
};
|
||||
@@ -67,12 +71,14 @@ namespace OpenSaveCloudClient.Core
|
||||
{
|
||||
Log log = new()
|
||||
{
|
||||
Timestamp = DateTime.Now,
|
||||
Message = message,
|
||||
Severity = LogSeverity.Warning,
|
||||
};
|
||||
messages.Add(log);
|
||||
NewMessageEventArgs args = new()
|
||||
{
|
||||
Timestamp = DateTime.Now,
|
||||
Message = message,
|
||||
Severity = LogSeverity.Warning,
|
||||
};
|
||||
@@ -110,6 +116,7 @@ namespace OpenSaveCloudClient.Core
|
||||
|
||||
public class NewMessageEventArgs : EventArgs
|
||||
{
|
||||
public DateTime Timestamp { get; set; }
|
||||
public string Message { get; set; }
|
||||
public LogSeverity Severity { get; set; }
|
||||
}
|
||||
|
||||
@@ -203,7 +203,7 @@ namespace OpenSaveCloudClient.Core
|
||||
return JsonSerializer.Deserialize<Game>(responseText);
|
||||
} else
|
||||
{
|
||||
logManager.AddError(String.Format("Received HTTP Status {0} from the server", response.StatusCode.ToString()));
|
||||
LogServerError(response);
|
||||
}
|
||||
taskManager.UpdateTaskStatus(uuidTask, AsyncTaskStatus.Failed);
|
||||
}
|
||||
@@ -365,7 +365,7 @@ namespace OpenSaveCloudClient.Core
|
||||
}
|
||||
else
|
||||
{
|
||||
logManager.AddError(String.Format("Received HTTP Status {0} from the server", response.StatusCode.ToString()));
|
||||
LogServerError(response);
|
||||
}
|
||||
taskManager.UpdateTaskStatus(uuidTask, AsyncTaskStatus.Failed);
|
||||
}
|
||||
@@ -399,7 +399,7 @@ namespace OpenSaveCloudClient.Core
|
||||
}
|
||||
else
|
||||
{
|
||||
logManager.AddError(String.Format("Received HTTP Status {0} from the server", response.StatusCode.ToString()));
|
||||
LogServerError(response);
|
||||
}
|
||||
taskManager.UpdateTaskStatus(uuidTask, AsyncTaskStatus.Failed);
|
||||
}
|
||||
@@ -449,7 +449,7 @@ namespace OpenSaveCloudClient.Core
|
||||
}
|
||||
else
|
||||
{
|
||||
logManager.AddError(String.Format("Received HTTP Status {0} from the server", response.StatusCode.ToString()));
|
||||
LogServerError(response);
|
||||
}
|
||||
taskManager.UpdateTaskStatus(uuidTask, AsyncTaskStatus.Failed);
|
||||
}
|
||||
@@ -518,7 +518,7 @@ namespace OpenSaveCloudClient.Core
|
||||
}
|
||||
else
|
||||
{
|
||||
logManager.AddError(String.Format("Received HTTP Status {0} from the server", response.StatusCode.ToString()));
|
||||
LogServerError(response);
|
||||
taskManager.UpdateTaskStatus(uuidTask, AsyncTaskStatus.Failed);
|
||||
}
|
||||
}
|
||||
@@ -547,7 +547,7 @@ namespace OpenSaveCloudClient.Core
|
||||
}
|
||||
else
|
||||
{
|
||||
logManager.AddError(String.Format("Received HTTP Status {0} from the server", response.StatusCode.ToString()));
|
||||
LogServerError(response);
|
||||
}
|
||||
taskManager.UpdateTaskStatus(uuidTask, AsyncTaskStatus.Failed);
|
||||
}
|
||||
@@ -576,7 +576,7 @@ namespace OpenSaveCloudClient.Core
|
||||
}
|
||||
else
|
||||
{
|
||||
logManager.AddError(String.Format("Received HTTP Status {0} from the server", response.StatusCode.ToString()));
|
||||
LogServerError(response);
|
||||
}
|
||||
taskManager.UpdateTaskStatus(uuidTask, AsyncTaskStatus.Failed);
|
||||
}
|
||||
@@ -608,7 +608,7 @@ namespace OpenSaveCloudClient.Core
|
||||
}
|
||||
else
|
||||
{
|
||||
logManager.AddError(String.Format("Received HTTP Status {0} from the server", response.StatusCode.ToString()));
|
||||
LogServerError(response);
|
||||
}
|
||||
taskManager.UpdateTaskStatus(uuidTask, AsyncTaskStatus.Failed);
|
||||
}
|
||||
@@ -637,7 +637,7 @@ namespace OpenSaveCloudClient.Core
|
||||
}
|
||||
else
|
||||
{
|
||||
logManager.AddError(String.Format("Received HTTP Status {0} from the server", response.StatusCode.ToString()));
|
||||
LogServerError(response);
|
||||
}
|
||||
taskManager.UpdateTaskStatus(uuidTask, AsyncTaskStatus.Failed);
|
||||
}
|
||||
@@ -667,7 +667,7 @@ namespace OpenSaveCloudClient.Core
|
||||
}
|
||||
else
|
||||
{
|
||||
logManager.AddError(String.Format("Received HTTP Status {0} from the server", response.StatusCode.ToString()));
|
||||
LogServerError(response);
|
||||
}
|
||||
taskManager.UpdateTaskStatus(uuidTask, AsyncTaskStatus.Failed);
|
||||
}
|
||||
@@ -696,7 +696,7 @@ namespace OpenSaveCloudClient.Core
|
||||
}
|
||||
else
|
||||
{
|
||||
logManager.AddError(String.Format("Received HTTP Status {0} from the server", response.StatusCode.ToString()));
|
||||
LogServerError(response);
|
||||
}
|
||||
taskManager.UpdateTaskStatus(uuidTask, AsyncTaskStatus.Failed);
|
||||
}
|
||||
@@ -728,7 +728,7 @@ namespace OpenSaveCloudClient.Core
|
||||
}
|
||||
else
|
||||
{
|
||||
logManager.AddError(String.Format("Received HTTP Status {0} from the server", response.StatusCode.ToString()));
|
||||
LogServerError(response);
|
||||
}
|
||||
taskManager.UpdateTaskStatus(uuidTask, AsyncTaskStatus.Failed);
|
||||
}
|
||||
@@ -740,7 +740,7 @@ namespace OpenSaveCloudClient.Core
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool ChangePassword(int userId, NewPassword password)
|
||||
public bool ChangePassword(long userId, NewPassword password)
|
||||
{
|
||||
logManager.AddInformation(string.Format("Changing password of user {0}", userId));
|
||||
string uuidTask = taskManager.StartTask("Changing password", true, 1);
|
||||
@@ -760,7 +760,39 @@ namespace OpenSaveCloudClient.Core
|
||||
}
|
||||
else
|
||||
{
|
||||
logManager.AddError(String.Format("Received HTTP Status {0} from the server", response.StatusCode.ToString()));
|
||||
LogServerError(response);
|
||||
}
|
||||
taskManager.UpdateTaskStatus(uuidTask, AsyncTaskStatus.Failed);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
logManager.AddError(ex);
|
||||
taskManager.UpdateTaskStatus(uuidTask, AsyncTaskStatus.Failed);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool ChangeUsername(UpdateUsername newUserInfo)
|
||||
{
|
||||
logManager.AddInformation(string.Format("Changing username of user {0}", newUserInfo.Id));
|
||||
string uuidTask = taskManager.StartTask("Changing username", true, 1);
|
||||
try
|
||||
{
|
||||
HttpClient client = new();
|
||||
string json = JsonSerializer.Serialize(newUserInfo);
|
||||
HttpContent content = new StringContent(json, Encoding.UTF8, "application/json");
|
||||
client.DefaultRequestHeaders.Add("Authorization", "bearer " + token);
|
||||
HttpResponseMessage response = client.PostAsync(string.Format("{0}:{1}/api/v1/admin/user/username", host, port), content).Result;
|
||||
if (response.IsSuccessStatusCode)
|
||||
{
|
||||
logManager.AddInformation("Username changed");
|
||||
string responseText = response.Content.ReadAsStringAsync().Result;
|
||||
taskManager.UpdateTaskStatus(uuidTask, AsyncTaskStatus.Ended);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
LogServerError(response);
|
||||
}
|
||||
taskManager.UpdateTaskStatus(uuidTask, AsyncTaskStatus.Failed);
|
||||
}
|
||||
@@ -819,7 +851,7 @@ namespace OpenSaveCloudClient.Core
|
||||
}
|
||||
else
|
||||
{
|
||||
logManager.AddError(String.Format("Received HTTP Status {0} from the server", response.StatusCode.ToString()));
|
||||
LogServerError(response);
|
||||
}
|
||||
taskManager.UpdateTaskStatus(uuidTask, AsyncTaskStatus.Failed);
|
||||
}
|
||||
@@ -896,6 +928,19 @@ namespace OpenSaveCloudClient.Core
|
||||
taskManager.UpdateTaskStatus(uuidTask, AsyncTaskStatus.Failed);
|
||||
}
|
||||
|
||||
private void LogServerError(HttpResponseMessage response)
|
||||
{
|
||||
string responseText = response.Content.ReadAsStringAsync().Result;
|
||||
HttpError? error = JsonSerializer.Deserialize<HttpError>(responseText);
|
||||
if (error != null)
|
||||
{
|
||||
logManager.AddError(String.Format("[Server error][{0}] {1}", error.Status, error.Message));
|
||||
} else
|
||||
{
|
||||
logManager.AddError(String.Format("Received HTTP Status {0} from the server", response.StatusCode.ToString()));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// method <c>SaveToConfig</c> save the server connection information to the configuration file
|
||||
/// </summary>
|
||||
|
||||
26
OpenSaveCloudClient/LogsForm.Designer.cs
generated
26
OpenSaveCloudClient/LogsForm.Designer.cs
generated
@@ -34,6 +34,7 @@
|
||||
this.Severity = new System.Windows.Forms.ColumnHeader();
|
||||
this.toolStrip1 = new System.Windows.Forms.ToolStrip();
|
||||
this.toolStripButton1 = new System.Windows.Forms.ToolStripButton();
|
||||
this.Timestamp = new System.Windows.Forms.ColumnHeader();
|
||||
this.toolStrip1.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
@@ -43,15 +44,15 @@
|
||||
| System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.listView1.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
|
||||
this.Timestamp,
|
||||
this.Message,
|
||||
this.Severity});
|
||||
this.listView1.GridLines = true;
|
||||
this.listView1.Location = new System.Drawing.Point(0, 27);
|
||||
this.listView1.Margin = new System.Windows.Forms.Padding(2);
|
||||
this.listView1.Location = new System.Drawing.Point(0, 40);
|
||||
this.listView1.MultiSelect = false;
|
||||
this.listView1.Name = "listView1";
|
||||
this.listView1.ShowGroups = false;
|
||||
this.listView1.Size = new System.Drawing.Size(747, 344);
|
||||
this.listView1.Size = new System.Drawing.Size(1118, 514);
|
||||
this.listView1.TabIndex = 0;
|
||||
this.listView1.UseCompatibleStateImageBehavior = false;
|
||||
this.listView1.View = System.Windows.Forms.View.Details;
|
||||
@@ -69,11 +70,13 @@
|
||||
// toolStrip1
|
||||
//
|
||||
this.toolStrip1.GripStyle = System.Windows.Forms.ToolStripGripStyle.Hidden;
|
||||
this.toolStrip1.ImageScalingSize = new System.Drawing.Size(24, 24);
|
||||
this.toolStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.toolStripButton1});
|
||||
this.toolStrip1.Location = new System.Drawing.Point(0, 0);
|
||||
this.toolStrip1.Name = "toolStrip1";
|
||||
this.toolStrip1.Size = new System.Drawing.Size(746, 26);
|
||||
this.toolStrip1.Padding = new System.Windows.Forms.Padding(0, 0, 3, 0);
|
||||
this.toolStrip1.Size = new System.Drawing.Size(1119, 38);
|
||||
this.toolStrip1.TabIndex = 1;
|
||||
this.toolStrip1.Text = "toolStrip1";
|
||||
//
|
||||
@@ -83,20 +86,24 @@
|
||||
this.toolStripButton1.Font = new System.Drawing.Font("Segoe MDL2 Assets", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
|
||||
this.toolStripButton1.ImageTransparentColor = System.Drawing.Color.Magenta;
|
||||
this.toolStripButton1.Name = "toolStripButton1";
|
||||
this.toolStripButton1.Size = new System.Drawing.Size(32, 23);
|
||||
this.toolStripButton1.Size = new System.Drawing.Size(46, 33);
|
||||
this.toolStripButton1.Text = "";
|
||||
this.toolStripButton1.Click += new System.EventHandler(this.toolStripButton1_Click);
|
||||
//
|
||||
// Timestamp
|
||||
//
|
||||
this.Timestamp.Text = "Timestamp";
|
||||
this.Timestamp.Width = 140;
|
||||
//
|
||||
// LogsForm
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(144F, 144F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
|
||||
this.ClientSize = new System.Drawing.Size(746, 369);
|
||||
this.ClientSize = new System.Drawing.Size(1119, 554);
|
||||
this.Controls.Add(this.toolStrip1);
|
||||
this.Controls.Add(this.listView1);
|
||||
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
|
||||
this.Margin = new System.Windows.Forms.Padding(2);
|
||||
this.MinimumSize = new System.Drawing.Size(507, 205);
|
||||
this.MinimumSize = new System.Drawing.Size(750, 280);
|
||||
this.Name = "LogsForm";
|
||||
this.Text = "Logs";
|
||||
this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.LogForm_FormClosed);
|
||||
@@ -115,5 +122,6 @@
|
||||
private ColumnHeader Severity;
|
||||
private ToolStrip toolStrip1;
|
||||
private ToolStripButton toolStripButton1;
|
||||
private ColumnHeader Timestamp;
|
||||
}
|
||||
}
|
||||
@@ -33,7 +33,8 @@ namespace OpenSaveCloudClient
|
||||
{
|
||||
this.Invoke((MethodInvoker)delegate
|
||||
{
|
||||
ListViewItem lvi = listView1.Items.Add(e.Message);
|
||||
ListViewItem lvi = listView1.Items.Add(e.Timestamp.ToString());
|
||||
lvi.SubItems.Add(e.Message);
|
||||
lvi.SubItems.Add(e.Severity.ToString());
|
||||
});
|
||||
}
|
||||
@@ -47,7 +48,8 @@ namespace OpenSaveCloudClient
|
||||
{
|
||||
foreach (Log l in logManager.Messages)
|
||||
{
|
||||
ListViewItem lvi = listView1.Items.Add(l.Message);
|
||||
ListViewItem lvi = listView1.Items.Add(l.Timestamp.ToString());
|
||||
lvi.SubItems.Add(l.Message);
|
||||
lvi.SubItems.Add(l.Severity.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ namespace OpenSaveCloudClient.Models
|
||||
|
||||
public class Log
|
||||
{
|
||||
|
||||
public DateTime Timestamp { get; set; }
|
||||
public string Message { get; set; }
|
||||
public LogSeverity Severity { get; set; }
|
||||
}
|
||||
|
||||
23
OpenSaveCloudClient/Models/Remote/HttpError.cs
Normal file
23
OpenSaveCloudClient/Models/Remote/HttpError.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.Json.Serialization;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace OpenSaveCloudClient.Models.Remote
|
||||
{
|
||||
public class HttpError
|
||||
{
|
||||
[JsonPropertyName("status")]
|
||||
public int Status { get; set; }
|
||||
[JsonPropertyName("timestamp")]
|
||||
public string Timestamp { get; set; }
|
||||
[JsonPropertyName("error")]
|
||||
public string Error { get; set; }
|
||||
[JsonPropertyName("message")]
|
||||
public string Message { get; set; }
|
||||
[JsonPropertyName("path")]
|
||||
public string Path { get; set; }
|
||||
}
|
||||
}
|
||||
17
OpenSaveCloudClient/Models/Remote/UpdateUsername.cs
Normal file
17
OpenSaveCloudClient/Models/Remote/UpdateUsername.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.Json.Serialization;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace OpenSaveCloudClient.Models.Remote
|
||||
{
|
||||
public class UpdateUsername
|
||||
{
|
||||
[JsonPropertyName("id")]
|
||||
public long Id { get; set; }
|
||||
[JsonPropertyName("username")]
|
||||
public string Username { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -58,6 +58,16 @@ namespace OpenSaveCloudClient
|
||||
LockControls(false);
|
||||
return;
|
||||
}
|
||||
if (!PasswordTool.CheckRequirements(NewPasswordBox.Text))
|
||||
{
|
||||
MessageBox.Show(
|
||||
"Passwords need at least 6 characters",
|
||||
"Change password",
|
||||
MessageBoxButtons.OK,
|
||||
MessageBoxIcon.Error);
|
||||
LockControls(false);
|
||||
return;
|
||||
}
|
||||
ThreadPool.QueueUserWorkItem(delegate
|
||||
{
|
||||
serverConnector.ChangePassword(new NewPassword { Password = NewPasswordBox.Text, VerifyPassword = PasswordAgainBox.Text });
|
||||
@@ -87,6 +97,10 @@ namespace OpenSaveCloudClient
|
||||
{
|
||||
valid = false;
|
||||
}
|
||||
else if (!PasswordTool.CheckRequirements(NewPasswordBox.Text))
|
||||
{
|
||||
valid = false;
|
||||
}
|
||||
SavePasswordButton.Enabled = valid;
|
||||
}
|
||||
}
|
||||
|
||||
516
OpenSaveCloudClient/UserManagementForm.Designer.cs
generated
516
OpenSaveCloudClient/UserManagementForm.Designer.cs
generated
@@ -28,262 +28,266 @@
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(UserManagementForm));
|
||||
this.listView1 = new System.Windows.Forms.ListView();
|
||||
this.name = new System.Windows.Forms.ColumnHeader();
|
||||
this.panel1 = new System.Windows.Forms.Panel();
|
||||
this.label2 = new System.Windows.Forms.Label();
|
||||
this.DeleteButton = new System.Windows.Forms.Button();
|
||||
this.UserSettingsButton = new System.Windows.Forms.Button();
|
||||
this.AddButton = new System.Windows.Forms.Button();
|
||||
this.groupBox1 = new System.Windows.Forms.GroupBox();
|
||||
this.saveUsernameButton = new System.Windows.Forms.Button();
|
||||
this.groupBox2 = new System.Windows.Forms.GroupBox();
|
||||
this.SavePasswordButton = new System.Windows.Forms.Button();
|
||||
this.label3 = new System.Windows.Forms.Label();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.PasswordAgainBox = new System.Windows.Forms.TextBox();
|
||||
this.NewPasswordBox = new System.Windows.Forms.TextBox();
|
||||
this.UsernameBox = new System.Windows.Forms.TextBox();
|
||||
this.label4 = new System.Windows.Forms.Label();
|
||||
this.panel1.SuspendLayout();
|
||||
this.groupBox1.SuspendLayout();
|
||||
this.groupBox2.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// listView1
|
||||
//
|
||||
this.listView1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.listView1.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
|
||||
this.name});
|
||||
this.listView1.Location = new System.Drawing.Point(12, 86);
|
||||
this.listView1.Name = "listView1";
|
||||
this.listView1.Size = new System.Drawing.Size(234, 352);
|
||||
this.listView1.TabIndex = 0;
|
||||
this.listView1.UseCompatibleStateImageBehavior = false;
|
||||
this.listView1.View = System.Windows.Forms.View.Details;
|
||||
this.listView1.SelectedIndexChanged += new System.EventHandler(this.listView1_SelectedIndexChanged);
|
||||
//
|
||||
// name
|
||||
//
|
||||
this.name.Text = "Name";
|
||||
this.name.Width = 220;
|
||||
//
|
||||
// panel1
|
||||
//
|
||||
this.panel1.Controls.Add(this.label2);
|
||||
this.panel1.Controls.Add(this.DeleteButton);
|
||||
this.panel1.Controls.Add(this.UserSettingsButton);
|
||||
this.panel1.Controls.Add(this.AddButton);
|
||||
this.panel1.Dock = System.Windows.Forms.DockStyle.Top;
|
||||
this.panel1.Location = new System.Drawing.Point(0, 0);
|
||||
this.panel1.MaximumSize = new System.Drawing.Size(0, 80);
|
||||
this.panel1.MinimumSize = new System.Drawing.Size(0, 80);
|
||||
this.panel1.Name = "panel1";
|
||||
this.panel1.Size = new System.Drawing.Size(800, 80);
|
||||
this.panel1.TabIndex = 6;
|
||||
//
|
||||
// label2
|
||||
//
|
||||
this.label2.AutoSize = true;
|
||||
this.label2.Font = new System.Drawing.Font("Segoe UI", 18F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
|
||||
this.label2.ForeColor = System.Drawing.Color.LightGray;
|
||||
this.label2.Location = new System.Drawing.Point(138, 22);
|
||||
this.label2.Name = "label2";
|
||||
this.label2.Size = new System.Drawing.Size(20, 32);
|
||||
this.label2.TabIndex = 9;
|
||||
this.label2.Text = "|";
|
||||
//
|
||||
// DeleteButton
|
||||
//
|
||||
this.DeleteButton.Enabled = false;
|
||||
this.DeleteButton.FlatAppearance.BorderSize = 0;
|
||||
this.DeleteButton.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
||||
this.DeleteButton.Font = new System.Drawing.Font("Segoe MDL2 Assets", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
|
||||
this.DeleteButton.Location = new System.Drawing.Point(75, 3);
|
||||
this.DeleteButton.Name = "DeleteButton";
|
||||
this.DeleteButton.Size = new System.Drawing.Size(57, 74);
|
||||
this.DeleteButton.TabIndex = 1;
|
||||
this.DeleteButton.Text = "\r\n\r\nDelete";
|
||||
this.DeleteButton.UseVisualStyleBackColor = true;
|
||||
this.DeleteButton.Click += new System.EventHandler(this.DeleteButton_Click);
|
||||
//
|
||||
// UserSettingsButton
|
||||
//
|
||||
this.UserSettingsButton.FlatAppearance.BorderSize = 0;
|
||||
this.UserSettingsButton.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
||||
this.UserSettingsButton.Font = new System.Drawing.Font("Segoe MDL2 Assets", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
|
||||
this.UserSettingsButton.Location = new System.Drawing.Point(164, 3);
|
||||
this.UserSettingsButton.Name = "UserSettingsButton";
|
||||
this.UserSettingsButton.Size = new System.Drawing.Size(57, 74);
|
||||
this.UserSettingsButton.TabIndex = 8;
|
||||
this.UserSettingsButton.Text = "\r\n\r\nMe";
|
||||
this.UserSettingsButton.UseVisualStyleBackColor = true;
|
||||
this.UserSettingsButton.Click += new System.EventHandler(this.UserSettingsButton_Click);
|
||||
//
|
||||
// AddButton
|
||||
//
|
||||
this.AddButton.FlatAppearance.BorderSize = 0;
|
||||
this.AddButton.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
||||
this.AddButton.Font = new System.Drawing.Font("Segoe MDL2 Assets", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
|
||||
this.AddButton.Location = new System.Drawing.Point(12, 3);
|
||||
this.AddButton.Name = "AddButton";
|
||||
this.AddButton.Size = new System.Drawing.Size(57, 74);
|
||||
this.AddButton.TabIndex = 0;
|
||||
this.AddButton.Text = "\r\n\r\nAdd";
|
||||
this.AddButton.UseVisualStyleBackColor = true;
|
||||
this.AddButton.Click += new System.EventHandler(this.AddButton_Click);
|
||||
//
|
||||
// groupBox1
|
||||
//
|
||||
this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.groupBox1.Controls.Add(this.saveUsernameButton);
|
||||
this.groupBox1.Controls.Add(this.groupBox2);
|
||||
this.groupBox1.Controls.Add(this.UsernameBox);
|
||||
this.groupBox1.Controls.Add(this.label4);
|
||||
this.groupBox1.Location = new System.Drawing.Point(252, 86);
|
||||
this.groupBox1.Name = "groupBox1";
|
||||
this.groupBox1.Size = new System.Drawing.Size(536, 352);
|
||||
this.groupBox1.TabIndex = 7;
|
||||
this.groupBox1.TabStop = false;
|
||||
this.groupBox1.Text = "Detail";
|
||||
//
|
||||
// saveUsernameButton
|
||||
//
|
||||
this.saveUsernameButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.saveUsernameButton.Enabled = false;
|
||||
this.saveUsernameButton.Location = new System.Drawing.Point(444, 83);
|
||||
this.saveUsernameButton.Margin = new System.Windows.Forms.Padding(2);
|
||||
this.saveUsernameButton.Name = "saveUsernameButton";
|
||||
this.saveUsernameButton.Size = new System.Drawing.Size(75, 23);
|
||||
this.saveUsernameButton.TabIndex = 4;
|
||||
this.saveUsernameButton.Text = "Save";
|
||||
this.saveUsernameButton.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// groupBox2
|
||||
//
|
||||
this.groupBox2.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.groupBox2.Controls.Add(this.SavePasswordButton);
|
||||
this.groupBox2.Controls.Add(this.label3);
|
||||
this.groupBox2.Controls.Add(this.label1);
|
||||
this.groupBox2.Controls.Add(this.PasswordAgainBox);
|
||||
this.groupBox2.Controls.Add(this.NewPasswordBox);
|
||||
this.groupBox2.Location = new System.Drawing.Point(5, 135);
|
||||
this.groupBox2.Margin = new System.Windows.Forms.Padding(2);
|
||||
this.groupBox2.Name = "groupBox2";
|
||||
this.groupBox2.Padding = new System.Windows.Forms.Padding(2);
|
||||
this.groupBox2.Size = new System.Drawing.Size(526, 158);
|
||||
this.groupBox2.TabIndex = 8;
|
||||
this.groupBox2.TabStop = false;
|
||||
this.groupBox2.Text = "Change password";
|
||||
//
|
||||
// SavePasswordButton
|
||||
//
|
||||
this.SavePasswordButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.SavePasswordButton.Enabled = false;
|
||||
this.SavePasswordButton.Location = new System.Drawing.Point(439, 124);
|
||||
this.SavePasswordButton.Margin = new System.Windows.Forms.Padding(2);
|
||||
this.SavePasswordButton.Name = "SavePasswordButton";
|
||||
this.SavePasswordButton.Size = new System.Drawing.Size(75, 23);
|
||||
this.SavePasswordButton.TabIndex = 2;
|
||||
this.SavePasswordButton.Text = "Save";
|
||||
this.SavePasswordButton.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// label3
|
||||
//
|
||||
this.label3.AutoSize = true;
|
||||
this.label3.Location = new System.Drawing.Point(14, 72);
|
||||
this.label3.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
|
||||
this.label3.Name = "label3";
|
||||
this.label3.Size = new System.Drawing.Size(136, 15);
|
||||
this.label3.TabIndex = 3;
|
||||
this.label3.Text = "The new password again";
|
||||
//
|
||||
// label1
|
||||
//
|
||||
this.label1.AutoSize = true;
|
||||
this.label1.Location = new System.Drawing.Point(14, 24);
|
||||
this.label1.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(84, 15);
|
||||
this.label1.TabIndex = 2;
|
||||
this.label1.Text = "New password";
|
||||
//
|
||||
// PasswordAgainBox
|
||||
//
|
||||
this.PasswordAgainBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.PasswordAgainBox.Enabled = false;
|
||||
this.PasswordAgainBox.Location = new System.Drawing.Point(14, 89);
|
||||
this.PasswordAgainBox.Margin = new System.Windows.Forms.Padding(2);
|
||||
this.PasswordAgainBox.Name = "PasswordAgainBox";
|
||||
this.PasswordAgainBox.Size = new System.Drawing.Size(500, 23);
|
||||
this.PasswordAgainBox.TabIndex = 1;
|
||||
this.PasswordAgainBox.UseSystemPasswordChar = true;
|
||||
//
|
||||
// NewPasswordBox
|
||||
//
|
||||
this.NewPasswordBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.NewPasswordBox.Enabled = false;
|
||||
this.NewPasswordBox.Location = new System.Drawing.Point(14, 41);
|
||||
this.NewPasswordBox.Margin = new System.Windows.Forms.Padding(2);
|
||||
this.NewPasswordBox.Name = "NewPasswordBox";
|
||||
this.NewPasswordBox.Size = new System.Drawing.Size(500, 23);
|
||||
this.NewPasswordBox.TabIndex = 0;
|
||||
this.NewPasswordBox.UseSystemPasswordChar = true;
|
||||
//
|
||||
// UsernameBox
|
||||
//
|
||||
this.UsernameBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.UsernameBox.CausesValidation = false;
|
||||
this.UsernameBox.Enabled = false;
|
||||
this.UsernameBox.Location = new System.Drawing.Point(19, 44);
|
||||
this.UsernameBox.Margin = new System.Windows.Forms.Padding(2);
|
||||
this.UsernameBox.Name = "UsernameBox";
|
||||
this.UsernameBox.Size = new System.Drawing.Size(500, 23);
|
||||
this.UsernameBox.TabIndex = 9;
|
||||
//
|
||||
// label4
|
||||
//
|
||||
this.label4.AutoSize = true;
|
||||
this.label4.Location = new System.Drawing.Point(19, 27);
|
||||
this.label4.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
|
||||
this.label4.Name = "label4";
|
||||
this.label4.Size = new System.Drawing.Size(60, 15);
|
||||
this.label4.TabIndex = 10;
|
||||
this.label4.Text = "Username";
|
||||
//
|
||||
// UserManagementForm
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
|
||||
this.BackColor = System.Drawing.SystemColors.Window;
|
||||
this.ClientSize = new System.Drawing.Size(800, 450);
|
||||
this.Controls.Add(this.groupBox1);
|
||||
this.Controls.Add(this.panel1);
|
||||
this.Controls.Add(this.listView1);
|
||||
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
|
||||
this.MaximumSize = new System.Drawing.Size(816, 489);
|
||||
this.MinimumSize = new System.Drawing.Size(816, 489);
|
||||
this.Name = "UserManagementForm";
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
|
||||
this.Text = "Management";
|
||||
this.Load += new System.EventHandler(this.UserManagementForm_Load);
|
||||
this.panel1.ResumeLayout(false);
|
||||
this.panel1.PerformLayout();
|
||||
this.groupBox1.ResumeLayout(false);
|
||||
this.groupBox1.PerformLayout();
|
||||
this.groupBox2.ResumeLayout(false);
|
||||
this.groupBox2.PerformLayout();
|
||||
this.ResumeLayout(false);
|
||||
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(UserManagementForm));
|
||||
this.listView1 = new System.Windows.Forms.ListView();
|
||||
this.name = new System.Windows.Forms.ColumnHeader();
|
||||
this.panel1 = new System.Windows.Forms.Panel();
|
||||
this.label2 = new System.Windows.Forms.Label();
|
||||
this.DeleteButton = new System.Windows.Forms.Button();
|
||||
this.UserSettingsButton = new System.Windows.Forms.Button();
|
||||
this.AddButton = new System.Windows.Forms.Button();
|
||||
this.groupBox1 = new System.Windows.Forms.GroupBox();
|
||||
this.saveUsernameButton = new System.Windows.Forms.Button();
|
||||
this.groupBox2 = new System.Windows.Forms.GroupBox();
|
||||
this.SavePasswordButton = new System.Windows.Forms.Button();
|
||||
this.label3 = new System.Windows.Forms.Label();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.PasswordAgainBox = new System.Windows.Forms.TextBox();
|
||||
this.NewPasswordBox = new System.Windows.Forms.TextBox();
|
||||
this.UsernameBox = new System.Windows.Forms.TextBox();
|
||||
this.label4 = new System.Windows.Forms.Label();
|
||||
this.panel1.SuspendLayout();
|
||||
this.groupBox1.SuspendLayout();
|
||||
this.groupBox2.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// listView1
|
||||
//
|
||||
this.listView1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.listView1.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
|
||||
this.name});
|
||||
this.listView1.Location = new System.Drawing.Point(18, 129);
|
||||
this.listView1.Margin = new System.Windows.Forms.Padding(4);
|
||||
this.listView1.Name = "listView1";
|
||||
this.listView1.Size = new System.Drawing.Size(349, 503);
|
||||
this.listView1.TabIndex = 0;
|
||||
this.listView1.UseCompatibleStateImageBehavior = false;
|
||||
this.listView1.View = System.Windows.Forms.View.Details;
|
||||
this.listView1.SelectedIndexChanged += new System.EventHandler(this.listView1_SelectedIndexChanged);
|
||||
//
|
||||
// name
|
||||
//
|
||||
this.name.Text = "Name";
|
||||
this.name.Width = 220;
|
||||
//
|
||||
// panel1
|
||||
//
|
||||
this.panel1.Controls.Add(this.label2);
|
||||
this.panel1.Controls.Add(this.DeleteButton);
|
||||
this.panel1.Controls.Add(this.UserSettingsButton);
|
||||
this.panel1.Controls.Add(this.AddButton);
|
||||
this.panel1.Dock = System.Windows.Forms.DockStyle.Top;
|
||||
this.panel1.Location = new System.Drawing.Point(0, 0);
|
||||
this.panel1.Margin = new System.Windows.Forms.Padding(4);
|
||||
this.panel1.MaximumSize = new System.Drawing.Size(0, 120);
|
||||
this.panel1.MinimumSize = new System.Drawing.Size(0, 120);
|
||||
this.panel1.Name = "panel1";
|
||||
this.panel1.Size = new System.Drawing.Size(1191, 120);
|
||||
this.panel1.TabIndex = 6;
|
||||
//
|
||||
// label2
|
||||
//
|
||||
this.label2.AutoSize = true;
|
||||
this.label2.Font = new System.Drawing.Font("Segoe UI", 18F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
|
||||
this.label2.ForeColor = System.Drawing.Color.LightGray;
|
||||
this.label2.Location = new System.Drawing.Point(207, 33);
|
||||
this.label2.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
||||
this.label2.Name = "label2";
|
||||
this.label2.Size = new System.Drawing.Size(29, 48);
|
||||
this.label2.TabIndex = 9;
|
||||
this.label2.Text = "|";
|
||||
//
|
||||
// DeleteButton
|
||||
//
|
||||
this.DeleteButton.Enabled = false;
|
||||
this.DeleteButton.FlatAppearance.BorderSize = 0;
|
||||
this.DeleteButton.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
||||
this.DeleteButton.Font = new System.Drawing.Font("Segoe MDL2 Assets", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
|
||||
this.DeleteButton.Location = new System.Drawing.Point(112, 4);
|
||||
this.DeleteButton.Margin = new System.Windows.Forms.Padding(4);
|
||||
this.DeleteButton.Name = "DeleteButton";
|
||||
this.DeleteButton.Size = new System.Drawing.Size(86, 111);
|
||||
this.DeleteButton.TabIndex = 1;
|
||||
this.DeleteButton.Text = "\r\n\r\nDelete";
|
||||
this.DeleteButton.UseVisualStyleBackColor = true;
|
||||
this.DeleteButton.Click += new System.EventHandler(this.DeleteButton_Click);
|
||||
//
|
||||
// UserSettingsButton
|
||||
//
|
||||
this.UserSettingsButton.FlatAppearance.BorderSize = 0;
|
||||
this.UserSettingsButton.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
||||
this.UserSettingsButton.Font = new System.Drawing.Font("Segoe MDL2 Assets", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
|
||||
this.UserSettingsButton.Location = new System.Drawing.Point(246, 4);
|
||||
this.UserSettingsButton.Margin = new System.Windows.Forms.Padding(4);
|
||||
this.UserSettingsButton.Name = "UserSettingsButton";
|
||||
this.UserSettingsButton.Size = new System.Drawing.Size(86, 111);
|
||||
this.UserSettingsButton.TabIndex = 8;
|
||||
this.UserSettingsButton.Text = "\r\n\r\nMe";
|
||||
this.UserSettingsButton.UseVisualStyleBackColor = true;
|
||||
this.UserSettingsButton.Click += new System.EventHandler(this.UserSettingsButton_Click);
|
||||
//
|
||||
// AddButton
|
||||
//
|
||||
this.AddButton.FlatAppearance.BorderSize = 0;
|
||||
this.AddButton.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
||||
this.AddButton.Font = new System.Drawing.Font("Segoe MDL2 Assets", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
|
||||
this.AddButton.Location = new System.Drawing.Point(18, 4);
|
||||
this.AddButton.Margin = new System.Windows.Forms.Padding(4);
|
||||
this.AddButton.Name = "AddButton";
|
||||
this.AddButton.Size = new System.Drawing.Size(86, 111);
|
||||
this.AddButton.TabIndex = 0;
|
||||
this.AddButton.Text = "\r\n\r\nAdd";
|
||||
this.AddButton.UseVisualStyleBackColor = true;
|
||||
this.AddButton.Click += new System.EventHandler(this.AddButton_Click);
|
||||
//
|
||||
// groupBox1
|
||||
//
|
||||
this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.groupBox1.Controls.Add(this.saveUsernameButton);
|
||||
this.groupBox1.Controls.Add(this.groupBox2);
|
||||
this.groupBox1.Controls.Add(this.UsernameBox);
|
||||
this.groupBox1.Controls.Add(this.label4);
|
||||
this.groupBox1.Location = new System.Drawing.Point(378, 129);
|
||||
this.groupBox1.Margin = new System.Windows.Forms.Padding(4);
|
||||
this.groupBox1.Name = "groupBox1";
|
||||
this.groupBox1.Padding = new System.Windows.Forms.Padding(4);
|
||||
this.groupBox1.Size = new System.Drawing.Size(804, 503);
|
||||
this.groupBox1.TabIndex = 7;
|
||||
this.groupBox1.TabStop = false;
|
||||
this.groupBox1.Text = "Detail";
|
||||
//
|
||||
// saveUsernameButton
|
||||
//
|
||||
this.saveUsernameButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.saveUsernameButton.Enabled = false;
|
||||
this.saveUsernameButton.Location = new System.Drawing.Point(666, 99);
|
||||
this.saveUsernameButton.Name = "saveUsernameButton";
|
||||
this.saveUsernameButton.Size = new System.Drawing.Size(112, 34);
|
||||
this.saveUsernameButton.TabIndex = 4;
|
||||
this.saveUsernameButton.Text = "Save";
|
||||
this.saveUsernameButton.UseVisualStyleBackColor = true;
|
||||
this.saveUsernameButton.Click += new System.EventHandler(this.saveUsernameButton_Click);
|
||||
//
|
||||
// groupBox2
|
||||
//
|
||||
this.groupBox2.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.groupBox2.Controls.Add(this.SavePasswordButton);
|
||||
this.groupBox2.Controls.Add(this.label3);
|
||||
this.groupBox2.Controls.Add(this.label1);
|
||||
this.groupBox2.Controls.Add(this.PasswordAgainBox);
|
||||
this.groupBox2.Controls.Add(this.NewPasswordBox);
|
||||
this.groupBox2.Location = new System.Drawing.Point(8, 202);
|
||||
this.groupBox2.Name = "groupBox2";
|
||||
this.groupBox2.Size = new System.Drawing.Size(789, 212);
|
||||
this.groupBox2.TabIndex = 8;
|
||||
this.groupBox2.TabStop = false;
|
||||
this.groupBox2.Text = "Change password";
|
||||
//
|
||||
// SavePasswordButton
|
||||
//
|
||||
this.SavePasswordButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.SavePasswordButton.Enabled = false;
|
||||
this.SavePasswordButton.Location = new System.Drawing.Point(658, 170);
|
||||
this.SavePasswordButton.Name = "SavePasswordButton";
|
||||
this.SavePasswordButton.Size = new System.Drawing.Size(112, 34);
|
||||
this.SavePasswordButton.TabIndex = 2;
|
||||
this.SavePasswordButton.Text = "Save";
|
||||
this.SavePasswordButton.UseVisualStyleBackColor = true;
|
||||
this.SavePasswordButton.Click += new System.EventHandler(this.SavePasswordButton_Click);
|
||||
//
|
||||
// label3
|
||||
//
|
||||
this.label3.AutoSize = true;
|
||||
this.label3.Location = new System.Drawing.Point(21, 108);
|
||||
this.label3.Name = "label3";
|
||||
this.label3.Size = new System.Drawing.Size(207, 25);
|
||||
this.label3.TabIndex = 3;
|
||||
this.label3.Text = "The new password again";
|
||||
//
|
||||
// label1
|
||||
//
|
||||
this.label1.AutoSize = true;
|
||||
this.label1.Location = new System.Drawing.Point(21, 36);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(129, 25);
|
||||
this.label1.TabIndex = 2;
|
||||
this.label1.Text = "New password";
|
||||
//
|
||||
// PasswordAgainBox
|
||||
//
|
||||
this.PasswordAgainBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.PasswordAgainBox.Enabled = false;
|
||||
this.PasswordAgainBox.Location = new System.Drawing.Point(21, 134);
|
||||
this.PasswordAgainBox.Name = "PasswordAgainBox";
|
||||
this.PasswordAgainBox.Size = new System.Drawing.Size(748, 31);
|
||||
this.PasswordAgainBox.TabIndex = 1;
|
||||
this.PasswordAgainBox.UseSystemPasswordChar = true;
|
||||
this.PasswordAgainBox.TextChanged += new System.EventHandler(this.NewPasswordBox_TextChanged);
|
||||
//
|
||||
// NewPasswordBox
|
||||
//
|
||||
this.NewPasswordBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.NewPasswordBox.Enabled = false;
|
||||
this.NewPasswordBox.Location = new System.Drawing.Point(21, 62);
|
||||
this.NewPasswordBox.Name = "NewPasswordBox";
|
||||
this.NewPasswordBox.Size = new System.Drawing.Size(748, 31);
|
||||
this.NewPasswordBox.TabIndex = 0;
|
||||
this.NewPasswordBox.UseSystemPasswordChar = true;
|
||||
this.NewPasswordBox.TextChanged += new System.EventHandler(this.NewPasswordBox_TextChanged);
|
||||
//
|
||||
// UsernameBox
|
||||
//
|
||||
this.UsernameBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.UsernameBox.CausesValidation = false;
|
||||
this.UsernameBox.Enabled = false;
|
||||
this.UsernameBox.Location = new System.Drawing.Point(28, 66);
|
||||
this.UsernameBox.Name = "UsernameBox";
|
||||
this.UsernameBox.Size = new System.Drawing.Size(748, 31);
|
||||
this.UsernameBox.TabIndex = 9;
|
||||
this.UsernameBox.TextChanged += new System.EventHandler(this.UsernameBox_TextChanged);
|
||||
//
|
||||
// label4
|
||||
//
|
||||
this.label4.AutoSize = true;
|
||||
this.label4.Location = new System.Drawing.Point(28, 40);
|
||||
this.label4.Name = "label4";
|
||||
this.label4.Size = new System.Drawing.Size(91, 25);
|
||||
this.label4.TabIndex = 10;
|
||||
this.label4.Text = "Username";
|
||||
//
|
||||
// UserManagementForm
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(144F, 144F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
|
||||
this.BackColor = System.Drawing.SystemColors.Window;
|
||||
this.ClientSize = new System.Drawing.Size(1191, 650);
|
||||
this.Controls.Add(this.groupBox1);
|
||||
this.Controls.Add(this.panel1);
|
||||
this.Controls.Add(this.listView1);
|
||||
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
|
||||
this.Margin = new System.Windows.Forms.Padding(4);
|
||||
this.MaximumSize = new System.Drawing.Size(1213, 706);
|
||||
this.MinimumSize = new System.Drawing.Size(1213, 706);
|
||||
this.Name = "UserManagementForm";
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
|
||||
this.Text = "Management";
|
||||
this.Load += new System.EventHandler(this.UserManagementForm_Load);
|
||||
this.panel1.ResumeLayout(false);
|
||||
this.panel1.PerformLayout();
|
||||
this.groupBox1.ResumeLayout(false);
|
||||
this.groupBox1.PerformLayout();
|
||||
this.groupBox2.ResumeLayout(false);
|
||||
this.groupBox2.PerformLayout();
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -1,162 +1,278 @@
|
||||
using OpenSaveCloudClient.Core;
|
||||
using OpenSaveCloudClient.Models.Remote;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace OpenSaveCloudClient
|
||||
{
|
||||
public partial class UserManagementForm : Form
|
||||
{
|
||||
|
||||
private ServerConnector serverConnector;
|
||||
|
||||
public UserManagementForm()
|
||||
{
|
||||
InitializeComponent();
|
||||
serverConnector = ServerConnector.GetInstance();
|
||||
}
|
||||
|
||||
private void UserSettingsButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
UserForm frm = new();
|
||||
frm.ShowDialog();
|
||||
}
|
||||
|
||||
private void UserManagementForm_Load(object sender, EventArgs e)
|
||||
{
|
||||
LoadUsers();
|
||||
}
|
||||
|
||||
private void LoadUsers()
|
||||
{
|
||||
ThreadPool.QueueUserWorkItem(delegate
|
||||
{
|
||||
List<User>? users = serverConnector.GetUsers();
|
||||
if (users != null)
|
||||
{
|
||||
this.Invoke((MethodInvoker)delegate {
|
||||
UpdateRemoteList(users);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void UpdateRemoteList(List<User> users)
|
||||
{
|
||||
if (serverConnector.ConnectedUser == null)
|
||||
{
|
||||
Close();
|
||||
return;
|
||||
}
|
||||
foreach (User user in users)
|
||||
{
|
||||
if (user.Username != serverConnector.ConnectedUser.Username)
|
||||
{
|
||||
ListViewItem lvi = listView1.Items.Add(user.Username);
|
||||
lvi.SubItems.Add(Convert.ToString(user.Id));
|
||||
lvi.SubItems.Add(user.Role);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void listView1_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
NewPasswordBox.Text = "";
|
||||
PasswordAgainBox.Text = "";
|
||||
bool singleActivate = (listView1.SelectedItems.Count == 1);
|
||||
bool multiActivate = (listView1.SelectedItems.Count > 0);
|
||||
DeleteButton.Enabled = multiActivate;
|
||||
UsernameBox.Enabled = singleActivate;
|
||||
NewPasswordBox.Enabled = singleActivate;
|
||||
PasswordAgainBox.Enabled = singleActivate;
|
||||
if (singleActivate)
|
||||
{
|
||||
ListViewItem item = listView1.SelectedItems[0];
|
||||
UsernameBox.Text = item.Text;
|
||||
}
|
||||
else
|
||||
{
|
||||
UsernameBox.Text = "";
|
||||
}
|
||||
}
|
||||
|
||||
private void AddButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
AddUser form = new();
|
||||
form.ShowDialog();
|
||||
listView1.Items.Clear();
|
||||
LoadUsers();
|
||||
}
|
||||
|
||||
private void DeleteButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
DialogResult dialogResult = MessageBox.Show("Remove the selected users? This action cannot be undo", "Remove users", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
|
||||
if (dialogResult == DialogResult.Yes)
|
||||
{
|
||||
LockControls(true);
|
||||
List<long> ids = new();
|
||||
foreach (ListViewItem item in listView1.SelectedItems)
|
||||
{
|
||||
long userId = Convert.ToInt64(item.SubItems[1].Text);
|
||||
ids.Add(userId);
|
||||
}
|
||||
ThreadPool.QueueUserWorkItem(delegate
|
||||
{
|
||||
try
|
||||
{
|
||||
foreach (long id in ids)
|
||||
{
|
||||
serverConnector.DeleteUser(id);
|
||||
}
|
||||
this.Invoke((MethodInvoker)delegate
|
||||
{
|
||||
listView1.Items.Clear();
|
||||
LoadUsers();
|
||||
});
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
this.Invoke((MethodInvoker)delegate {
|
||||
MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
});
|
||||
}
|
||||
finally
|
||||
{
|
||||
this.Invoke((MethodInvoker)delegate
|
||||
{
|
||||
LockControls(false);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private void LockControls(bool v)
|
||||
{
|
||||
v = !v;
|
||||
AddButton.Enabled = v;
|
||||
DeleteButton.Enabled = v;
|
||||
UserSettingsButton.Enabled = v;
|
||||
listView1.Enabled = v;
|
||||
UsernameBox.Enabled = v;
|
||||
NewPasswordBox.Enabled = v;
|
||||
PasswordAgainBox.Enabled = v;
|
||||
if (v)
|
||||
{
|
||||
listView1_SelectedIndexChanged(null, null);
|
||||
}
|
||||
if (!v)
|
||||
{
|
||||
saveUsernameButton.Enabled = v;
|
||||
SavePasswordButton.Enabled = v;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
using OpenSaveCloudClient.Core;
|
||||
using OpenSaveCloudClient.Models.Remote;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace OpenSaveCloudClient
|
||||
{
|
||||
public partial class UserManagementForm : Form
|
||||
{
|
||||
|
||||
private ServerConnector serverConnector;
|
||||
|
||||
public UserManagementForm()
|
||||
{
|
||||
InitializeComponent();
|
||||
serverConnector = ServerConnector.GetInstance();
|
||||
}
|
||||
|
||||
private void UserSettingsButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
UserForm frm = new();
|
||||
frm.ShowDialog();
|
||||
}
|
||||
|
||||
private void UserManagementForm_Load(object sender, EventArgs e)
|
||||
{
|
||||
LoadUsers();
|
||||
}
|
||||
|
||||
private void LoadUsers()
|
||||
{
|
||||
ThreadPool.QueueUserWorkItem(delegate
|
||||
{
|
||||
List<User>? users = serverConnector.GetUsers();
|
||||
if (users != null)
|
||||
{
|
||||
this.Invoke((MethodInvoker)delegate {
|
||||
UpdateRemoteList(users);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void UpdateRemoteList(List<User> users)
|
||||
{
|
||||
if (serverConnector.ConnectedUser == null)
|
||||
{
|
||||
Close();
|
||||
return;
|
||||
}
|
||||
foreach (User user in users)
|
||||
{
|
||||
if (user.Username != serverConnector.ConnectedUser.Username)
|
||||
{
|
||||
ListViewItem lvi = listView1.Items.Add(user.Username);
|
||||
lvi.SubItems.Add(Convert.ToString(user.Id));
|
||||
lvi.SubItems.Add(user.Role);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void listView1_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
NewPasswordBox.Text = "";
|
||||
PasswordAgainBox.Text = "";
|
||||
bool singleActivate = (listView1.SelectedItems.Count == 1);
|
||||
bool multiActivate = (listView1.SelectedItems.Count > 0);
|
||||
DeleteButton.Enabled = multiActivate;
|
||||
UsernameBox.Enabled = singleActivate;
|
||||
NewPasswordBox.Enabled = singleActivate;
|
||||
PasswordAgainBox.Enabled = singleActivate;
|
||||
if (singleActivate)
|
||||
{
|
||||
ListViewItem item = listView1.SelectedItems[0];
|
||||
UsernameBox.Text = item.Text;
|
||||
}
|
||||
else
|
||||
{
|
||||
UsernameBox.Text = "";
|
||||
}
|
||||
}
|
||||
|
||||
private void AddButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
AddUser form = new();
|
||||
form.ShowDialog();
|
||||
listView1.Items.Clear();
|
||||
LoadUsers();
|
||||
}
|
||||
|
||||
private void DeleteButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
DialogResult dialogResult = MessageBox.Show("Remove the selected users? This action cannot be undo", "Remove users", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
|
||||
if (dialogResult == DialogResult.Yes)
|
||||
{
|
||||
LockControls(true);
|
||||
List<long> ids = new();
|
||||
foreach (ListViewItem item in listView1.SelectedItems)
|
||||
{
|
||||
long userId = Convert.ToInt64(item.SubItems[1].Text);
|
||||
ids.Add(userId);
|
||||
}
|
||||
ThreadPool.QueueUserWorkItem(delegate
|
||||
{
|
||||
try
|
||||
{
|
||||
foreach (long id in ids)
|
||||
{
|
||||
serverConnector.DeleteUser(id);
|
||||
}
|
||||
this.Invoke((MethodInvoker)delegate
|
||||
{
|
||||
listView1.Items.Clear();
|
||||
LoadUsers();
|
||||
});
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
this.Invoke((MethodInvoker)delegate {
|
||||
MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
});
|
||||
}
|
||||
finally
|
||||
{
|
||||
this.Invoke((MethodInvoker)delegate
|
||||
{
|
||||
LockControls(false);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private void LockControls(bool v)
|
||||
{
|
||||
v = !v;
|
||||
AddButton.Enabled = v;
|
||||
DeleteButton.Enabled = v;
|
||||
UserSettingsButton.Enabled = v;
|
||||
listView1.Enabled = v;
|
||||
UsernameBox.Enabled = v;
|
||||
NewPasswordBox.Enabled = v;
|
||||
PasswordAgainBox.Enabled = v;
|
||||
if (v)
|
||||
{
|
||||
listView1_SelectedIndexChanged(null, null);
|
||||
}
|
||||
if (!v)
|
||||
{
|
||||
saveUsernameButton.Enabled = v;
|
||||
SavePasswordButton.Enabled = v;
|
||||
}
|
||||
}
|
||||
|
||||
private void NewPasswordBox_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (listView1.SelectedItems.Count == 1) {
|
||||
bool valid = true;
|
||||
if (string.IsNullOrEmpty(NewPasswordBox.Text) || string.IsNullOrEmpty(PasswordAgainBox.Text))
|
||||
{
|
||||
valid = false;
|
||||
}
|
||||
else if (NewPasswordBox.Text != PasswordAgainBox.Text)
|
||||
{
|
||||
valid = false;
|
||||
}
|
||||
SavePasswordButton.Enabled = valid;
|
||||
}
|
||||
else
|
||||
{
|
||||
SavePasswordButton.Enabled = false;
|
||||
}
|
||||
}
|
||||
|
||||
private void SavePasswordButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (listView1.SelectedItems.Count != 1)
|
||||
{
|
||||
return;
|
||||
}
|
||||
LockControls(true);
|
||||
if (string.IsNullOrEmpty(NewPasswordBox.Text) || string.IsNullOrEmpty(PasswordAgainBox.Text))
|
||||
{
|
||||
MessageBox.Show(
|
||||
"Password fields are empty",
|
||||
"Change password",
|
||||
MessageBoxButtons.OK,
|
||||
MessageBoxIcon.Error);
|
||||
LockControls(false);
|
||||
return;
|
||||
}
|
||||
if (NewPasswordBox.Text != PasswordAgainBox.Text)
|
||||
{
|
||||
MessageBox.Show(
|
||||
"Passwords not matches",
|
||||
"Change password",
|
||||
MessageBoxButtons.OK,
|
||||
MessageBoxIcon.Error);
|
||||
LockControls(false);
|
||||
return;
|
||||
}
|
||||
if (!PasswordTool.CheckRequirements(NewPasswordBox.Text))
|
||||
{
|
||||
MessageBox.Show(
|
||||
"Passwords need at least 6 characters",
|
||||
"Change password",
|
||||
MessageBoxButtons.OK,
|
||||
MessageBoxIcon.Error);
|
||||
LockControls(false);
|
||||
return;
|
||||
}
|
||||
long userId = Convert.ToInt64(listView1.SelectedItems[0].SubItems[1].Text);
|
||||
ThreadPool.QueueUserWorkItem(delegate
|
||||
{
|
||||
serverConnector.ChangePassword(userId, new NewPassword { Password = NewPasswordBox.Text, VerifyPassword = PasswordAgainBox.Text });
|
||||
this.Invoke((MethodInvoker)delegate {
|
||||
NewPasswordBox.Clear();
|
||||
PasswordAgainBox.Clear();
|
||||
LockControls(false);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
private void saveUsernameButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
LockControls(true);
|
||||
if (UsernameBox.Text.Length < 3)
|
||||
{
|
||||
MessageBox.Show(
|
||||
"Username need at least 3 characters",
|
||||
"Change username",
|
||||
MessageBoxButtons.OK,
|
||||
MessageBoxIcon.Error);
|
||||
LockControls(false);
|
||||
return;
|
||||
}
|
||||
long userId = Convert.ToInt64(listView1.SelectedItems[0].SubItems[1].Text);
|
||||
ThreadPool.QueueUserWorkItem(delegate
|
||||
{
|
||||
serverConnector.ChangeUsername(new UpdateUsername { Id = userId, Username = UsernameBox.Text });
|
||||
this.Invoke((MethodInvoker)delegate {
|
||||
listView1.SelectedItems[0].SubItems[0].Text = UsernameBox.Text;
|
||||
LockControls(false);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
private void UsernameBox_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (listView1.SelectedItems.Count == 1)
|
||||
{
|
||||
string currentUsername = listView1.SelectedItems[0].SubItems[0].Text;
|
||||
bool valid = true;
|
||||
if (UsernameBox.Text.Length < 3)
|
||||
{
|
||||
valid = false;
|
||||
}
|
||||
else if (UsernameBox.Text == currentUsername)
|
||||
{
|
||||
valid = false;
|
||||
}
|
||||
saveUsernameButton.Enabled = valid;
|
||||
}
|
||||
else
|
||||
{
|
||||
saveUsernameButton.Enabled = false;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user