server disconnection bug 1
This commit is contained in:
parent
ac0973cf11
commit
32e4272f83
4 changed files with 178 additions and 143 deletions
|
@ -26,18 +26,31 @@ jceSSLClient::jceSSLClient() : flag(false), packet(""), networkConf(), reConnect
|
||||||
*/
|
*/
|
||||||
bool jceSSLClient::makeConnect(QString server, int port)
|
bool jceSSLClient::makeConnect(QString server, int port)
|
||||||
{
|
{
|
||||||
qDebug() << Q_FUNC_INFO << "Making connection";
|
if (reConnection) //reset reconnectiong flag
|
||||||
|
{
|
||||||
|
qDebug() << Q_FUNC_INFO << "Making Reconnection";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
qDebug() << Q_FUNC_INFO << "Making Connection";
|
||||||
|
|
||||||
if (isConnected())
|
if (isConnected())
|
||||||
{
|
{
|
||||||
qDebug() << Q_FUNC_INFO << "flag=true, calling makeDisconnect()";
|
qDebug() << Q_FUNC_INFO << "flag=true, calling makeDisconnect()";
|
||||||
makeDiconnect();
|
makeDiconnect();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
qDebug() << Q_FUNC_INFO << "Connection to: " << server << "On Port: " << port;
|
qDebug() << Q_FUNC_INFO << "Connection to: " << server << "On Port: " << port;
|
||||||
connectToHostEncrypted(server.toStdString().c_str(), port);
|
connectToHostEncrypted(server.toStdString().c_str(), port);
|
||||||
|
|
||||||
loop.exec(); //starting connection, waiting to encryption and then it ends
|
loop.exec(); //starting connection, waiting to encryption and then it ends
|
||||||
|
|
||||||
qDebug() << Q_FUNC_INFO << "returning the connection status: " << isConnected();
|
qDebug() << Q_FUNC_INFO << "returning the connection status: " << isConnected();
|
||||||
|
if (reConnection)
|
||||||
|
{
|
||||||
|
reConnection = false;
|
||||||
|
emit serverDisconnectedbyRemote();
|
||||||
|
}
|
||||||
return isConnected();
|
return isConnected();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -205,7 +218,7 @@ void jceSSLClient::setDisconnected()
|
||||||
*/
|
*/
|
||||||
void jceSSLClient::setEncrypted()
|
void jceSSLClient::setEncrypted()
|
||||||
{
|
{
|
||||||
qDebug() << Q_FUNC_INFO << "ENCRYPTED";
|
qDebug() << Q_FUNC_INFO << "ENCRYPTED";
|
||||||
setReadBufferSize(10000);
|
setReadBufferSize(10000);
|
||||||
setSocketOption(QAbstractSocket::KeepAliveOption,true);
|
setSocketOption(QAbstractSocket::KeepAliveOption,true);
|
||||||
flag = true;
|
flag = true;
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
|
|
||||||
#define milisTimeOut 4000
|
#define milisTimeOut 4000
|
||||||
|
|
||||||
class jceSSLClient : QSslSocket
|
class jceSSLClient : public QSslSocket
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -4,20 +4,21 @@
|
||||||
* @brief jceLogin::jceLogin
|
* @brief jceLogin::jceLogin
|
||||||
* @param username pointer to allocated user settings
|
* @param username pointer to allocated user settings
|
||||||
*/
|
*/
|
||||||
jceLogin::jceLogin(user * username)
|
jceLogin::jceLogin(user* username)
|
||||||
{
|
{
|
||||||
this->recieverPage = new QString();
|
this->recieverPage = new QString();
|
||||||
this->jceA = username;
|
this->jceA = username;
|
||||||
this->JceConnector = new jceSSLClient();
|
this->JceConnector = new jceSSLClient();
|
||||||
|
JceConnector->connect(JceConnector,SIGNAL(serverDisconnectedbyRemote()),this,SLOT(reValidation()));
|
||||||
}
|
}
|
||||||
|
|
||||||
jceLogin::~jceLogin()
|
jceLogin::~jceLogin()
|
||||||
{
|
{
|
||||||
this->jceA = NULL;
|
this->jceA = NULL;
|
||||||
delete recieverPage;
|
delete recieverPage;
|
||||||
delete JceConnector;
|
delete JceConnector;
|
||||||
JceConnector = NULL;
|
JceConnector = NULL;
|
||||||
recieverPage = NULL;
|
recieverPage = NULL;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* @brief jceLogin::makeConnection Connecting to JCE student web site with JceA (username object) and validate it.
|
* @brief jceLogin::makeConnection Connecting to JCE student web site with JceA (username object) and validate it.
|
||||||
|
@ -25,69 +26,69 @@ jceLogin::~jceLogin()
|
||||||
*/
|
*/
|
||||||
void jceLogin::makeConnection() throw (jceStatus)
|
void jceLogin::makeConnection() throw (jceStatus)
|
||||||
{
|
{
|
||||||
qDebug() << "jceLogin::makeConnection(); connection to be make";
|
qDebug() << "jceLogin::makeConnection(); connection to be make";
|
||||||
|
|
||||||
if (this->recieverPage == NULL)
|
if (this->recieverPage == NULL)
|
||||||
this->recieverPage = new QString();
|
this->recieverPage = new QString();
|
||||||
|
|
||||||
if (JceConnector->makeConnect(dst_host,dst_port) == false) //couldnt make a connection
|
if (JceConnector->makeConnect(dst_host,dst_port) == false) //couldnt make a connection
|
||||||
throw jceStatus::ERROR_ON_OPEN_SOCKET;
|
throw jceStatus::ERROR_ON_OPEN_SOCKET;
|
||||||
|
|
||||||
int returnMode; //gets status according to called function of validation step
|
int returnMode; //gets status according to called function of validation step
|
||||||
jceStatus status = jceStatus::JCE_NOT_CONNECTED;
|
jceStatus status = jceStatus::JCE_NOT_CONNECTED;
|
||||||
|
|
||||||
returnMode = checkConnection(); //checking socket status. is connected?
|
returnMode = checkConnection(); //checking socket status. is connected?
|
||||||
|
|
||||||
if (returnMode == true) //connected to host
|
if (returnMode == true) //connected to host
|
||||||
{
|
{
|
||||||
returnMode = makeFirstVisit();
|
returnMode = makeFirstVisit();
|
||||||
if (returnMode == true) //requst and send first validation
|
if (returnMode == true) //requst and send first validation
|
||||||
{
|
{
|
||||||
status = jceStatus::JCE_START_VALIDATING_PROGRESS;
|
status = jceStatus::JCE_START_VALIDATING_PROGRESS;
|
||||||
returnMode = checkValidation();
|
returnMode = checkValidation();
|
||||||
if (returnMode == true) //check if username and password are matching
|
if (returnMode == true) //check if username and password are matching
|
||||||
{
|
{
|
||||||
status = jceStatus::JCE_VALIDATION_PASSED;
|
status = jceStatus::JCE_VALIDATION_PASSED;
|
||||||
returnMode = makeSecondVisit();
|
returnMode = makeSecondVisit();
|
||||||
if (returnMode == true) //siging in the website
|
if (returnMode == true) //siging in the website
|
||||||
{
|
{
|
||||||
qDebug() << "jceLogin::makeConnection(); Signed in succeesfully";
|
qDebug() << "jceLogin::makeConnection(); Signed in succeesfully";
|
||||||
status = jceStatus::JCE_YOU_ARE_IN;
|
status = jceStatus::JCE_YOU_ARE_IN;
|
||||||
setLoginFlag(true);
|
setLoginFlag(true);
|
||||||
}
|
}
|
||||||
else if (returnMode == jceLogin::ERROR_ON_GETTING_INFO)
|
else if (returnMode == jceLogin::ERROR_ON_GETTING_INFO)
|
||||||
{
|
{
|
||||||
status = jceLogin::ERROR_ON_GETTING_INFO;
|
status = jceLogin::ERROR_ON_GETTING_INFO;
|
||||||
}
|
}
|
||||||
else if (returnMode == jceLogin::ERROR_ON_SEND_REQUEST)
|
else if (returnMode == jceLogin::ERROR_ON_SEND_REQUEST)
|
||||||
{
|
{
|
||||||
status = jceLogin::ERROR_ON_SEND_REQUEST;
|
status = jceLogin::ERROR_ON_SEND_REQUEST;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
status = jceStatus::ERROR_ON_VALIDATION;
|
status = jceStatus::ERROR_ON_VALIDATION;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
status = jceStatus::ERROR_ON_VALIDATION;
|
status = jceStatus::ERROR_ON_VALIDATION;
|
||||||
|
|
||||||
}
|
}
|
||||||
else if (returnMode == jceLogin::ERROR_ON_GETTING_INFO)
|
else if (returnMode == jceLogin::ERROR_ON_GETTING_INFO)
|
||||||
{
|
{
|
||||||
status = jceLogin::ERROR_ON_GETTING_INFO;
|
status = jceLogin::ERROR_ON_GETTING_INFO;
|
||||||
}
|
}
|
||||||
else if (returnMode == jceLogin::ERROR_ON_SEND_REQUEST)
|
else if (returnMode == jceLogin::ERROR_ON_SEND_REQUEST)
|
||||||
{
|
{
|
||||||
status = jceLogin::ERROR_ON_SEND_REQUEST;
|
status = jceLogin::ERROR_ON_SEND_REQUEST;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
status = jceStatus::ERROR_ON_VALIDATION_USER_BLOCKED;
|
status = jceStatus::ERROR_ON_VALIDATION_USER_BLOCKED;
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
status = jceStatus::JCE_NOT_CONNECTED;
|
status = jceStatus::JCE_NOT_CONNECTED;
|
||||||
|
|
||||||
//we throw status even if we are IN!
|
//we throw status even if we are IN!
|
||||||
qDebug() << "jceLogin::makeConnection(); throw status: " << status;
|
qDebug() << "jceLogin::makeConnection(); throw status: " << status;
|
||||||
throw status;
|
throw status;
|
||||||
|
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
@ -96,10 +97,10 @@ void jceLogin::makeConnection() throw (jceStatus)
|
||||||
*/
|
*/
|
||||||
bool jceLogin::checkConnection() const
|
bool jceLogin::checkConnection() const
|
||||||
{
|
{
|
||||||
if (JceConnector->isConnected())
|
if (JceConnector->isConnected())
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* @brief jceLogin::reConnect
|
* @brief jceLogin::reConnect
|
||||||
|
@ -108,29 +109,29 @@ bool jceLogin::checkConnection() const
|
||||||
*/
|
*/
|
||||||
void jceLogin::reConnect() throw (jceStatus)
|
void jceLogin::reConnect() throw (jceStatus)
|
||||||
{
|
{
|
||||||
closeAll();
|
closeAll();
|
||||||
if (this->JceConnector != NULL)
|
if (this->JceConnector != NULL)
|
||||||
delete JceConnector;
|
delete JceConnector;
|
||||||
this->recieverPage = new QString();
|
this->recieverPage = new QString();
|
||||||
this->JceConnector = new jceSSLClient();
|
this->JceConnector = new jceSSLClient();
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
makeConnection();
|
makeConnection();
|
||||||
}
|
}
|
||||||
catch (jceLogin::jceStatus &a)
|
catch (jceLogin::jceStatus &a)
|
||||||
{
|
{
|
||||||
throw a;
|
throw a;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* @brief jceLogin::closeAll
|
* @brief jceLogin::closeAll
|
||||||
*/
|
*/
|
||||||
void jceLogin::closeAll()
|
void jceLogin::closeAll()
|
||||||
{
|
{
|
||||||
JceConnector->makeDiconnect();
|
JceConnector->makeDiconnect();
|
||||||
delete recieverPage;
|
delete recieverPage;
|
||||||
recieverPage = NULL;
|
recieverPage = NULL;
|
||||||
|
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
@ -139,17 +140,17 @@ void jceLogin::closeAll()
|
||||||
*/
|
*/
|
||||||
int jceLogin::makeFirstVisit()
|
int jceLogin::makeFirstVisit()
|
||||||
{
|
{
|
||||||
QString usr = jceA->getUsername();
|
QString usr = jceA->getUsername();
|
||||||
QString psw = jceA->getPassword();
|
QString psw = jceA->getPassword();
|
||||||
if (JceConnector->sendData(jceLoginHtmlScripts::makeRequest(jceLoginHtmlScripts::getFirstValidationStep(*jceA))))
|
if (JceConnector->sendData(jceLoginHtmlScripts::makeRequest(jceLoginHtmlScripts::getFirstValidationStep(*jceA))))
|
||||||
{
|
{
|
||||||
if (!JceConnector->recieveData(*recieverPage,true))
|
if (!JceConnector->recieveData(*recieverPage,true))
|
||||||
return jceLogin::ERROR_ON_GETTING_INFO;
|
return jceLogin::ERROR_ON_GETTING_INFO;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return jceLogin::ERROR_ON_SEND_REQUEST;
|
return jceLogin::ERROR_ON_SEND_REQUEST;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* @brief jceLogin::makeSecondVisit making the second validation step of jce student portal login
|
* @brief jceLogin::makeSecondVisit making the second validation step of jce student portal login
|
||||||
|
@ -157,19 +158,19 @@ int jceLogin::makeFirstVisit()
|
||||||
*/
|
*/
|
||||||
int jceLogin::makeSecondVisit()
|
int jceLogin::makeSecondVisit()
|
||||||
{
|
{
|
||||||
QString usrid=jceA->getUserID();
|
QString usrid=jceA->getUserID();
|
||||||
QString pswid=jceA->getHashedPassword();
|
QString pswid=jceA->getHashedPassword();
|
||||||
if ((JceConnector->sendData(jceLoginHtmlScripts::makeRequest(jceLoginHtmlScripts::getSecondValidationStep(*jceA)))))
|
if ((JceConnector->sendData(jceLoginHtmlScripts::makeRequest(jceLoginHtmlScripts::getSecondValidationStep(*jceA)))))
|
||||||
{
|
{
|
||||||
if (!(JceConnector->recieveData(*recieverPage,true)))
|
if (!(JceConnector->recieveData(*recieverPage,true)))
|
||||||
return jceLogin::ERROR_ON_GETTING_INFO;
|
return jceLogin::ERROR_ON_GETTING_INFO;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return jceLogin::ERROR_ON_SEND_REQUEST;
|
return jceLogin::ERROR_ON_SEND_REQUEST;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* @brief jceLogin::getCalendar according to parameters, we make an HTML request and send it over socket to server
|
* @brief jceLogin::getCalendar according to parameters, we make an HTML request and send it over socket to server
|
||||||
|
@ -179,17 +180,17 @@ int jceLogin::makeSecondVisit()
|
||||||
*/
|
*/
|
||||||
int jceLogin::getCalendar(int year, int semester)
|
int jceLogin::getCalendar(int year, int semester)
|
||||||
{
|
{
|
||||||
if ((JceConnector->sendData(jceLoginHtmlScripts::makeRequest(jceLoginHtmlScripts::getCalendar(*jceA,year,semester)))))
|
if ((JceConnector->sendData(jceLoginHtmlScripts::makeRequest(jceLoginHtmlScripts::getCalendar(*jceA,year,semester)))))
|
||||||
{
|
{
|
||||||
if (!(JceConnector->recieveData(*recieverPage,false)))
|
if (!(JceConnector->recieveData(*recieverPage,false)))
|
||||||
return jceLogin::ERROR_ON_GETTING_GRADES;
|
return jceLogin::ERROR_ON_GETTING_GRADES;
|
||||||
else
|
else
|
||||||
return jceLogin::JCE_GRADE_PAGE_PASSED;
|
return jceLogin::JCE_GRADE_PAGE_PASSED;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return jceLogin::ERROR_ON_SEND_REQUEST;
|
return jceLogin::ERROR_ON_SEND_REQUEST;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
@ -202,17 +203,17 @@ int jceLogin::getCalendar(int year, int semester)
|
||||||
*/
|
*/
|
||||||
int jceLogin::getGrades(int fromYear, int toYear, int fromSemester, int toSemester)
|
int jceLogin::getGrades(int fromYear, int toYear, int fromSemester, int toSemester)
|
||||||
{
|
{
|
||||||
if ((JceConnector->sendData(jceLoginHtmlScripts::makeRequest(jceLoginHtmlScripts::getGradesPath(*jceA,fromYear, toYear, fromSemester, toSemester)))))
|
if ((JceConnector->sendData(jceLoginHtmlScripts::makeRequest(jceLoginHtmlScripts::getGradesPath(*jceA,fromYear, toYear, fromSemester, toSemester)))))
|
||||||
{
|
{
|
||||||
if (!(JceConnector->recieveData(*recieverPage,false)))
|
if (!(JceConnector->recieveData(*recieverPage,false)))
|
||||||
return jceLogin::ERROR_ON_GETTING_GRADES;
|
return jceLogin::ERROR_ON_GETTING_GRADES;
|
||||||
else
|
else
|
||||||
return jceLogin::JCE_GRADE_PAGE_PASSED;
|
return jceLogin::JCE_GRADE_PAGE_PASSED;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return jceLogin::ERROR_ON_SEND_REQUEST;
|
return jceLogin::ERROR_ON_SEND_REQUEST;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
@ -222,43 +223,43 @@ int jceLogin::getGrades(int fromYear, int toYear, int fromSemester, int toSemest
|
||||||
bool jceLogin::checkValidation()
|
bool jceLogin::checkValidation()
|
||||||
{
|
{
|
||||||
|
|
||||||
//finds the hashed password
|
//finds the hashed password
|
||||||
QString constUserID_TAG = "value=\"-N";
|
QString constUserID_TAG = "value=\"-N";
|
||||||
QString constHassID_TAG = "-A,-N";
|
QString constHassID_TAG = "-A,-N";
|
||||||
QString hasspass,hassid;
|
QString hasspass,hassid;
|
||||||
std::size_t hasspass_position1,hasspass_position2;
|
std::size_t hasspass_position1,hasspass_position2;
|
||||||
std::size_t id_position1,id_position2;
|
std::size_t id_position1,id_position2;
|
||||||
|
|
||||||
hasspass_position1 = this->recieverPage->toStdString().find(constHassID_TAG.toStdString()); //looking for hasspass index
|
hasspass_position1 = this->recieverPage->toStdString().find(constHassID_TAG.toStdString()); //looking for hasspass index
|
||||||
if (hasspass_position1 == std::string::npos) //didnt find the tag
|
if (hasspass_position1 == std::string::npos) //didnt find the tag
|
||||||
return false;
|
return false;
|
||||||
else
|
else
|
||||||
hasspass_position1 += constHassID_TAG.length(); //skip the index of tag
|
hasspass_position1 += constHassID_TAG.length(); //skip the index of tag
|
||||||
hasspass_position2 = this->recieverPage->toStdString().find(",-A,-A", hasspass_position1);
|
hasspass_position2 = this->recieverPage->toStdString().find(",-A,-A", hasspass_position1);
|
||||||
//finds the hass pass
|
//finds the hass pass
|
||||||
if (hasspass_position2 != std::string::npos) //found the hasspass! storing it
|
if (hasspass_position2 != std::string::npos) //found the hasspass! storing it
|
||||||
hasspass = recieverPage->mid(hasspass_position1,hasspass_position2-hasspass_position1);
|
hasspass = recieverPage->mid(hasspass_position1,hasspass_position2-hasspass_position1);
|
||||||
else
|
else
|
||||||
return false;
|
return false;
|
||||||
//finds the user id
|
//finds the user id
|
||||||
id_position1 = this->recieverPage->toStdString().find(constUserID_TAG.toStdString(), 0); //looking for hassid index
|
id_position1 = this->recieverPage->toStdString().find(constUserID_TAG.toStdString(), 0); //looking for hassid index
|
||||||
if (id_position1 == std::string::npos) //didnt find the tag
|
if (id_position1 == std::string::npos) //didnt find the tag
|
||||||
return false;
|
return false;
|
||||||
else
|
else
|
||||||
id_position1 += constUserID_TAG.length(); //skip the index of tag
|
id_position1 += constUserID_TAG.length(); //skip the index of tag
|
||||||
id_position2 = this->recieverPage->toStdString().find(",-A", id_position1);
|
id_position2 = this->recieverPage->toStdString().find(",-A", id_position1);
|
||||||
if (id_position2 != std::string::npos) //found the hassid! storing it
|
if (id_position2 != std::string::npos) //found the hassid! storing it
|
||||||
hassid = recieverPage->mid(id_position1,id_position2-id_position1);
|
hassid = recieverPage->mid(id_position1,id_position2-id_position1);
|
||||||
else
|
else
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
//setting user information with given data hassid and hasspass
|
//setting user information with given data hassid and hasspass
|
||||||
jceA->setHashedPassword(hasspass);
|
jceA->setHashedPassword(hasspass);
|
||||||
jceA->setUserID(hassid);
|
jceA->setUserID(hassid);
|
||||||
|
|
||||||
qDebug() << "jceLogin::checkValidation(); Found Hashed: " << hasspass << "And ID: " << hassid;
|
qDebug() << "jceLogin::checkValidation(); Found Hashed: " << hasspass << "And ID: " << hassid;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* @brief jceLogin::setLoginFlag
|
* @brief jceLogin::setLoginFlag
|
||||||
|
@ -266,7 +267,7 @@ bool jceLogin::checkValidation()
|
||||||
*/
|
*/
|
||||||
void jceLogin::setLoginFlag(bool x)
|
void jceLogin::setLoginFlag(bool x)
|
||||||
{
|
{
|
||||||
this->loginFlag = x;
|
this->loginFlag = x;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* @brief jceLogin::isLoginFlag checking if there is a connection, if true - > return if we signed in. otherwise, return not (not connected dough)
|
* @brief jceLogin::isLoginFlag checking if there is a connection, if true - > return if we signed in. otherwise, return not (not connected dough)
|
||||||
|
@ -274,9 +275,9 @@ void jceLogin::setLoginFlag(bool x)
|
||||||
*/
|
*/
|
||||||
bool jceLogin::isLoginFlag() const
|
bool jceLogin::isLoginFlag() const
|
||||||
{
|
{
|
||||||
if (checkConnection())
|
if (checkConnection())
|
||||||
return this->loginFlag;
|
return this->loginFlag;
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
@ -285,5 +286,16 @@ bool jceLogin::isLoginFlag() const
|
||||||
*/
|
*/
|
||||||
QString jceLogin::getPage()
|
QString jceLogin::getPage()
|
||||||
{
|
{
|
||||||
return *recieverPage;
|
return *recieverPage;
|
||||||
|
}
|
||||||
|
|
||||||
|
void jceLogin::reValidation()
|
||||||
|
{
|
||||||
|
qDebug() << Q_FUNC_INFO << "Revalidating user";
|
||||||
|
if (makeFirstVisit())
|
||||||
|
{
|
||||||
|
if (makeSecondVisit())
|
||||||
|
qDebug() << Q_FUNC_INFO << "Validated";
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,11 +5,19 @@
|
||||||
#include "./src/jceSettings/user.h"
|
#include "./src/jceSettings/user.h"
|
||||||
#include "jceLoginHtmlScripts.h"
|
#include "jceLoginHtmlScripts.h"
|
||||||
|
|
||||||
|
#include <QObject>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
|
|
||||||
|
|
||||||
class jceLogin
|
class jceLogin
|
||||||
{
|
{
|
||||||
|
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
jceLogin() {}
|
||||||
|
jceLogin(user* username);
|
||||||
|
~jceLogin();
|
||||||
|
|
||||||
enum jceStatus {
|
enum jceStatus {
|
||||||
JCE_NOT_CONNECTED,
|
JCE_NOT_CONNECTED,
|
||||||
|
@ -26,8 +34,7 @@ public:
|
||||||
JCE_GRADE_PAGE_PASSED
|
JCE_GRADE_PAGE_PASSED
|
||||||
};
|
};
|
||||||
|
|
||||||
jceLogin(user* username);
|
|
||||||
~jceLogin();
|
|
||||||
|
|
||||||
void makeConnection() throw (jceStatus);
|
void makeConnection() throw (jceStatus);
|
||||||
void reConnect() throw (jceStatus);
|
void reConnect() throw (jceStatus);
|
||||||
|
@ -41,6 +48,9 @@ public:
|
||||||
|
|
||||||
QString getPage();
|
QString getPage();
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void reValidation();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
int makeFirstVisit();
|
int makeFirstVisit();
|
||||||
|
|
Loading…
Reference in a new issue