-
Notifications
You must be signed in to change notification settings - Fork 0
/
Pin.cpp
46 lines (42 loc) · 902 Bytes
/
Pin.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
#include <QString>
#include <string>
#include <Pin.h>
#include <QMessageBox>
#include <mainwindow.h>
QString Pin::getPin() const
{
return pin;
}
void Pin::setPin(QString value)
{
this->pin = value;
}
Pin::Pin(QString pinValue, int retryCount)
{
this->pin = pinValue;
this->retryCounter = retryCount;
}
bool Pin::verifyPin(QString pinToCompare)
{
if(this->pin == pinToCompare)
{
if(this->retryCounter != RETRY_COUNT)
this->retryCounter =RETRY_COUNT;
return true;
}
else
{
this->retryCounter--;
QMessageBox::information(0,QString("Error Window"),"Pin verification failed!");
return false;
}
}
bool Pin::changePin(QString oldPin,QString newPin)
{
if(this->verifyPin(oldPin))
{
this->setPin(newPin);
return true;
}
return false;
}