-
Notifications
You must be signed in to change notification settings - Fork 0
/
UnitFormPassWord.cpp
57 lines (50 loc) · 1.51 KB
/
UnitFormPassWord.cpp
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
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "UnitFormPassWord.h"
#include "UnitFormMain.h"
#include "UnitFormConfigEquipos.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
#define PASS1 "arduinomola"
#define PASS2 "adminadmin"
TFormPassword *FormPassword;
bool loged = false;
//---------------------------------------------------------------------------
__fastcall TFormPassword::TFormPassword(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TFormPassword::OKBtnClick(TObject *Sender)
{
UnicodeString pass = Password->Text;
if(pass == PASS1 | pass == PASS2)
{
if (pass == PASS1) //Usuario normal
{
//Desbloquear botones normales
FormMain->ButtonConfigEq->Enabled = true;
}
if (pass == PASS2) //Usuario Admin
{
//Desbloquear botones normales
FormConfigEquipos->ButtonInitEquipos->Enabled = true;
}
loged = true;
Password->Text = "";
FormMain->Button_loguear->Caption = "Log out";
Close();
}else{
ShowMessage("¡Contraseña Incorrecta!");
Password->Text = "";
//MessageDlg("Contraseña Incorrecta", mtWarning, mbOK);
}
}
//---------------------------------------------------------------------------
void __fastcall TFormPassword::CancelBtnClick(TObject *Sender)
{
Close();
}
//---------------------------------------------------------------------------