Project

General

Profile

Actions

Support #6931

closed

Server instantly stops

Added by Dmytro Tristan about 5 years ago. Updated over 4 years ago.

Status:
Closed
Priority:
Normal
Target version:
Start date:
02/28/2019
Due date:
% Done:

0%

Estimated time:

Description

Hi Guys,

I'm new with Wt and trying to remake Hello example but with another widgets.

Project is build without any issues. but server instantly stops.

Here is my code

Authentification.h

#ifndef AUTHENTIFICATION_H

#define AUTHENTIFICATION_H

#include <Wt/WApplication.h>

#include <Wt/WLabel.h>

#include <Wt/WLineEdit.h>

#include <Wt/WPushButton.h>

class Authentification : public Wt::WApplication

{

public:

Authentification(const Wt::WEnvironment &env);

private:

Wt::WLabel *loginLabel;

Wt::WLabel *passwordLabel;

Wt::WLineEdit *login;

Wt::WLineEdit *password;

Wt::WPushButton *loginButton;

bool loginCheck(const Wt::WString &login);

bool passwordCheck(const Wt::WString &password);

bool generalCheck();

};

#endif // AUTHENTIFICATION_H

Authentification.cpp

#include "authentification.h"

Authentification::Authentification(const Wt::WEnvironment &env) : Wt::WApplication(env)

{

setTitle("Authentification");

loginLabel = root()->addWidget(std::make_uniqueWt::WLabel("Login"));

login = root()->addWidget(std::make_uniqueWt::WLineEdit());

passwordLabel = root()->addWidget(std::make_uniqueWt::WLabel("Password"));

password = root()->addWidget(std::unique_ptrWt::WLineEdit());

loginButton = root()->addWidget(std::make_uniqueWt::WPushButton("Sign in"));

}

bool Authentification::loginCheck(const Wt::WString &login)

{

bool result = false;

if (login \"Admin\" || login "admin")

result = true;

return result;

}

bool Authentification::passwordCheck(const Wt::WString &password)

{

bool result = false;

if (password \"Admin\" || password "admin")

result = true;

return result;

}

bool Authentification::generalCheck()

{

bool result = false;

if (loginCheck(login~~text()) && passwordCheck(password~~>text()))

result = true;

return result;

}

main.cpp

pro file for just in case

TEMPLATE = app

CONFIG += console c++17

CONFIG -= app_bundle

CONFIG -= qt

LIBS += \

-lwthttp\

-lwt

SOURCES += \

main.cpp \

authentification.cpp

HEADERS += \

authentification.h

and the main part

Server starts without a problem but when i try to connect shell writes the next

[2019-Feb-28 22:32:10.877] 16536 - [info] "config: reading Wt config file: /etc/wt/wt_config.xml (location = '/home/mitya/Projects/build-WtAutentification-Desktop_Qt_5_12_0_GCC_64bit-Debug/WtAutentification')"

[2019-Feb-28 22:32:10.878] 16536 - [info] "WServer/wthttp: initializing built-in wthttpd"

[2019-Feb-28 22:32:10.878] 16536 - [info] "wthttp: started server: http://0.0.0.0:9091"

[2019-Feb-28 22:32:16.688] 16536 - [info] "Wt: session created (#sessions = 1)"

[2019-Feb-28 22:32:16.688] 16536 [/ tLmC2a2dH3ClT8Ak] [info] "WEnvironment: UserAgent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.119 Safari/537.36"

127.0.0.1 - - [2019-Feb-28 22:32:16.689] "GET / HTTP/1.1" 200 2285

[2019-Feb-28 22:32:16.689] 16536 - [info] "WebRequest: took 1.624 ms"

Press to close this window...

Browser is empty.

Hello example runs fine without any problems.

Thank for help and time.

Actions #1

Updated by Dmytro Tristan about 5 years ago

Mistakenly put it in the Bug. Please replace this issue in Support. Sorry.

Actions #2

Updated by Roel Standaert over 4 years ago

  • Tracker changed from Bug to Support
  • Status changed from New to Closed

I'm going around cleaning up older issues. I can't really tell what was going wrong, because it got all garbled up when you posted your code, and I don't think it's all of your code, either. Maybe attach your code as files, instead?

You likely don't have this issue anymore, or moved on by now, so I'll close this. Feel free to reopen if you're still having issues.

Actions

Also available in: Atom PDF