add debugging to check before disrbute

This commit is contained in:
Liran BN 2014-06-18 21:42:46 +03:00
parent a887f5c211
commit f3d6ec7059
7 changed files with 26 additions and 8 deletions

View file

@ -10,7 +10,7 @@ greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = jceGrade
TEMPLATE = app
RC_FILE = appConfigure.rc
CONFIG += c++11 static
CONFIG += c++11 static console
SOURCES += main/coursestablemanager.cpp \
main/loginhandler.cpp \

View file

@ -46,6 +46,7 @@ bool loginHandler::makeConnection()
}
else if (a == jceLogin::ERROR_ON_VALIDATION_USER_BLOCKED)
{
std::cout << "error!!!!!!" << (jceLog->getPage()) << std::endl;
popMessage("You were blocked, please wait couple of minutes or contact JCE");
jceLog->closeAll();

View file

@ -34,7 +34,6 @@ MainScreen::MainScreen(QWidget *parent) :QMainWindow(parent), ui(new Ui::MainScr
updateDates();
std::cout << "hello world" << std::endl;
}
@ -166,6 +165,8 @@ void MainScreen::uiSetDisconnectMode()
void MainScreen::uiSetConnectMode()
{
std::string page;
if (this->jceLog != NULL)
delete jceLog;
@ -188,12 +189,19 @@ void MainScreen::uiSetConnectMode()
userLoginSetting->setPassword(password);
this->repaint();
page = "connecting with username ";
page = username;
page += "and password: ";
page += password;
ui->textEdit->setText(ui->textEdit->toPlainText() + QString::fromStdString(page));
jceLog = new jceLogin(userLoginSetting);
this->loginHandel = new loginHandler(jceLog,statusLabel,ui->pswdLineEdit,ui->usrnmLineEdit);
if (loginHandel->makeConnection() == true)
{
page = this->jceLog->getPage();
ui->textEdit->setText(ui->textEdit->toPlainText() + QString::fromStdString(page));
setLabelConnectionStatus(jceLogin::jceStatus::JCE_YOU_ARE_IN);
ui->loginButton->setText("&Logout");
this->ui->ratesButton->setEnabled(true);

View file

@ -299,6 +299,9 @@ font-size: 15px;
</layout>
</widget>
</item>
<item row="1" column="0">
<widget class="QTextEdit" name="textEdit"/>
</item>
</layout>
</widget>
<widget class="QWidget" name="CoursesTab">

View file

@ -17,8 +17,9 @@ bool qtsslsocket::isCon()
bool qtsslsocket::send(std::string str)
{
bool flag = true;
this->socket->write(str.c_str());
bool flag = isCon();
if (flag)
this->socket->write(str.c_str());
return flag;
}

View file

@ -7,7 +7,7 @@
#include <QString>
#include <iostream>
#include <string>
#define milisTimeOut 3000
#define milisTimeOut 5000
class qtsslsocket : public QObject
{

View file

@ -21,19 +21,24 @@ jceLogin::~jceLogin()
*/
void jceLogin::makeConnection() throw (jceStatus)
{
jceStatus status;
jceStatus status = jceStatus::JCE_NOT_CONNECTED;
if (checkConnection() == true) //connected to host
{
if (makeFirstVisit() == true) //requst and send first validation
{
std::cout << "visit 1\n";
std::cout << *(this->recieverPage);
status = jceStatus::JCE_FIRST_VALIDATION_PASSED;
if (checkValidation() == true) //check if username and password are matching
{
std::cout << "visit 2\n";
std::cout << *(this->recieverPage);
status = jceStatus::JCE_SECOND_VALIDATION_PASSED;
if (makeSecondVisit() == true) //siging in the website
{
std::cout << "visit 3\n";
std::cout << *(this->recieverPage);
status = jceStatus::JCE_YOU_ARE_IN;
setLoginFlag(true);
}
@ -91,7 +96,6 @@ int jceLogin::makeFirstVisit()
{
std::string usr = jceA->getUsername();
std::string psw = jceA->getPassword();
if (JceConnector->send(jceLoginHtmlScripts::makeRequest(jceLoginHtmlScripts::getFirstValidationStep(*jceA))))
{
if (!JceConnector->recieve(*recieverPage))
@ -157,6 +161,7 @@ std::string jceLogin::getPage()
bool jceLogin::checkValidation()
{
//finds the hashed password
std::cout << *recieverPage << std::endl;
std::size_t hasspass_position1 = recieverPage->find("-A,-N");
hasspass_position1 += 5;