60 lines
1.8 KiB
C#
60 lines
1.8 KiB
C#
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 StacjaProb
|
|
{
|
|
public partial class ResetUsersPass : Form
|
|
{
|
|
public ResetUsersPass()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
private void ResetUsersPass_Load(object sender, EventArgs e)
|
|
{
|
|
textBoxPass.MaxLength = 32;
|
|
textBoxPass.PasswordChar = '*';
|
|
textBoxRePass.MaxLength = 32;
|
|
textBoxRePass.PasswordChar = '*';
|
|
|
|
mySqlFunctions.initConnection();
|
|
if (mySqlFunctions.OpenConnection())
|
|
{
|
|
int index = 0;
|
|
// Ładuje listę dostępnych silników
|
|
MySql.Data.MySqlClient.MySqlCommand cmd = new MySql.Data.MySqlClient.MySqlCommand("select USR_USERNAME from sys_users order by USR_USERNAME", mySqlFunctions.connection);
|
|
MySql.Data.MySqlClient.MySqlDataReader dataReader = cmd.ExecuteReader();
|
|
while (dataReader.Read())
|
|
{
|
|
|
|
comboBoxUsers.Items.Insert(index, dataReader["USR_USERNAME"].ToString());
|
|
index++;
|
|
}
|
|
dataReader.Close();
|
|
mySqlFunctions.CloseConnection();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
private void buttonSave_Click(object sender, EventArgs e)
|
|
{
|
|
if (String.Compare(textBoxPass.Text, textBoxRePass.Text, false) == 0)
|
|
{
|
|
mySqlFunctions.Insert("update sys_users set USR_PASSWORD=md5('" + textBoxPass.Text + "') where USR_USERNAME='" + comboBoxUsers.Text+"'");
|
|
this.Close();
|
|
}
|
|
else MessageBox.Show("Podano dwa różne hasła!");
|
|
}
|
|
}
|
|
}
|