This repository has been archived by the owner on Aug 3, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Passwordbox.cs
68 lines (60 loc) · 2.02 KB
/
Passwordbox.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
using System;
using System.Windows.Forms;
namespace LanSoft
{
public partial class Passwordbox : Form
{
public bool IsPasswordValid { get; private set; }
public string User { get { return txtUsername.Text; } }
public Passwordbox()
{
this.IsPasswordValid = false;
InitializeComponent();
}
private void Passwordbox_Load(object sender, EventArgs e)
{
this.IsPasswordValid = false;
txtUsername.Focus();
}
private void btnLogin_Click(object sender, EventArgs e)
{
Identification();
}
private void Identification()
{
// TODO: Meilleure façon de stoquer les mots de passe
if (txtUsername.Text.ToLower() == "caisse" && txtPassword.Text == "")
{
this.IsPasswordValid = true;
this.Close();
} else if (txtUsername.Text.ToLower() == "sécurité" && txtPassword.Text == "") {
this.IsPasswordValid = true;
this.Close();
}
else if (txtUsername.Text.ToLower() == "lanets" && txtPassword.Text == "")
{
this.IsPasswordValid = true;
this.Close();
}
else
{
MessageBox.Show("Le mot de passe que vous avez entré est invalide", "Mot de passe invalide", MessageBoxButtons.OK, MessageBoxIcon.Warning);
}
}
private void txtPassword_KeyPress(object sender, KeyPressEventArgs e)
{
if (e.KeyChar == 13) // Si c'est ENTER
{
Identification();
}
}
private void btnForgotPassword_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
System.Diagnostics.Process.Start("http://forums.lanets.ca/ucp.php?mode=sendpassword");
}
private void btnExit_Click(object sender, EventArgs e)
{
this.Close();
}
}
}