Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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;
- using System.IO;
- using Hash;
- namespace WindowsFormsApplication1
- {
- public partial class frmLogin : Form
- {
- public string salt = "dfoidfhjo&dfkf%$dfik/";
- public frmLogin()
- {
- InitializeComponent();
- }
- private void frmLogin_Load(object sender, EventArgs e)
- {
- }
- private void textBox1_TextChanged(object sender, EventArgs e)
- {
- }
- private void label1_Click(object sender, EventArgs e)
- {
- }
- private void label1_Click_1(object sender, EventArgs e)
- {
- }
- private void Password_TextChanged(object sender, EventArgs e)
- {
- }
- private void btnLogin_Click(object sender, EventArgs e)
- {
- if (txtUsername.Text.Length < 4 || txtPassword.Text.Length < 4)
- {
- MessageBox.Show(String.Format("The Username or the Password is wrong!", MessageBoxButtons.OK, MessageBoxIcon.Error));
- }
- else
- {
- if (!Directory.Exists($"/data/users/{txtUsername.Text}"))
- {
- MessageBox.Show(String.Format("The Username or the Password is wrong!", MessageBoxButtons.OK, MessageBoxIcon.Error));
- }
- else
- {
- StreamReader sr = new StreamReader($"/data/users/{txtUsername.Text}/data.ls");
- string user = sr.ReadLine();
- string passhash = sr.ReadLine();
- sr.Close();
- string thispass = SHA1.Hashing(SHA1.Hashing(txtPassword.Text + salt));
- if (user = txtUsername.Text && passhash == thispass)
- {
- }
- else
- {
- MessageBox.Show(String.Format("The Username or the Password is wrong!", MessageBoxButtons.OK, MessageBoxIcon.Error));
- }
- }
- string username = txtUsername.Text.Trim();
- string password = txtPassword.Text;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement