Files
2026-09-03 10:50:01 +02:00

45 lines
1.5 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 ChangePassword : Form
{
public ChangePassword()
{
InitializeComponent();
}
private void buttonSave_Click(object sender, EventArgs e)
{
if (mySqlFunctions.sqlIntValue("select count(1) from sys_users where USR_PASSWORD= md5('"+textBoxOldPass.Text+"') and USR_ID="+vGlobal.tst_usr_id.ToString())>0)
{
if (String.Compare(textBoxNewPass.Text, textBoxRePass.Text, false) == 0)
{
mySqlFunctions.Insert("update sys_users set USR_PASSWORD=md5('" + textBoxNewPass.Text + "') where USR_ID=" + vGlobal.tst_usr_id.ToString());
this.Close();
}
else MessageBox.Show("Podano dwa różne hasła!");
}
else MessageBox.Show("Stare hasło jest niepoprawne!");
}
private void ChangePassword_Load(object sender, EventArgs e)
{
textBoxOldPass.MaxLength = 32;
textBoxOldPass.PasswordChar = '*';
textBoxNewPass.MaxLength = 32;
textBoxNewPass.PasswordChar = '*';
textBoxRePass.MaxLength = 32;
textBoxRePass.PasswordChar = '*';
}
}
}