first commit
This commit is contained in:
1 parent
a9f02f8595
commit
1f6634add4
83 files changed
+28739
No files matched your search
@@ -0,0 +1,106 @@
|
||||
using MySql.Data.MySqlClient;
|
||||
using PaymentLogs.Domain;
|
||||
using PaymentLogs.Utils;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Data.SqlClient;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace PaymentLogs
|
||||
{
|
||||
public partial class LoginForm : Form
|
||||
{
|
||||
|
||||
|
||||
public LoginForm()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
|
||||
{
|
||||
///Form2 f2 = new Form2();
|
||||
/// f2.ShowDialog();
|
||||
this.Hide();
|
||||
var form2 = new RegisterForm();
|
||||
form2.Closed += (s, args) => this.Close();
|
||||
form2.Show();
|
||||
}
|
||||
|
||||
private void button1_Click(object sender, EventArgs e)
|
||||
{
|
||||
var loginUser = textBoxLogin.Text;
|
||||
var passUser = textBoxPassword.Text;
|
||||
|
||||
try
|
||||
{
|
||||
User user = Program.UserRepository.GetUser(loginUser);
|
||||
string hash = StringUtils.SHA256_hash(passUser);
|
||||
if (hash.Equals(StringUtils.SecureStringToString(user.PasswordHash)))
|
||||
{
|
||||
MessageBox.Show("Вы успешно вошлши!", "Успешно!", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
Program.CurrentUser = user;
|
||||
this.Hide();
|
||||
(new DataForm()).Show();
|
||||
} else MessageBox.Show("Пароль неверный!", "Ошибка!", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
} catch (NullReferenceException ex)
|
||||
{
|
||||
MessageBox.Show("Такого пользователя не существует!", "Пользователя не существует!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void password_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void Form1_Load(object sender, EventArgs e)
|
||||
{
|
||||
pictureBox3.Visible = false;
|
||||
textBoxLogin.MaxLength = 50;
|
||||
textBoxPassword.MaxLength = 50;
|
||||
}
|
||||
|
||||
private void textBox1_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void pictureBoxClear_Click(object sender, EventArgs e)
|
||||
{
|
||||
textBoxLogin.Text = "";
|
||||
textBoxPassword.Text = "";
|
||||
}
|
||||
|
||||
private void pictureBox3_Click(object sender, EventArgs e)
|
||||
{
|
||||
textBoxPassword.UseSystemPasswordChar = !textBoxPassword.UseSystemPasswordChar;
|
||||
pictureBox3.Visible = false;
|
||||
pictureBox4.Visible = true;
|
||||
}
|
||||
|
||||
private void pictureBox4_Click(object sender, EventArgs e)
|
||||
{
|
||||
textBoxPassword.UseSystemPasswordChar = !textBoxPassword.UseSystemPasswordChar;
|
||||
pictureBox3.Visible = true;
|
||||
pictureBox4.Visible = false;
|
||||
}
|
||||
|
||||
private void button2_Click(object sender, EventArgs e)
|
||||
{
|
||||
this.Close();
|
||||
(new LoginForm()).Show();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user