Newer
Older
/*
* Copyright (C) 2017 Kevin Whitaker <eyecreate@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
*/
#include "LoginInterface.h"
LoginInterface::LoginInterface(WebInterface* app)
{
Kevin Whitaker
committed
this->app = app;
loginContainer = new Wt::WContainerWidget();
loginLayout = new Wt::WVBoxLayout();
loginContainer->setLayout(loginLayout);
usernameArea = new Wt::WHBoxLayout();
passwordArea = new Wt::WHBoxLayout();
usernameContainer = new Wt::WContainerWidget();
passwordContainer = new Wt::WContainerWidget();
usernameContainer->setLayout(usernameArea);
passwordContainer->setLayout(passwordArea);
usernameField = new Wt::WLineEdit();
passwordField = new Wt::WLineEdit();
passwordField->setEchoMode(Wt::WLineEdit::EchoMode::Password);
usernameArea->addWidget(new Wt::WText("Username:"));
usernameArea->addWidget(usernameField);
passwordArea->addWidget(new Wt::WText("Password:"));
passwordArea->addWidget(passwordField);
loginLayout->addWidget(new Wt::WText("Please Login to access."));
loginLayout->addWidget(usernameContainer);
loginLayout->addWidget(passwordContainer);
loginButton = new Wt::WPushButton("Login");
loginButton->clicked().connect(app, &WebInterface::loginCompleted);
setContentAlignment(Wt::AlignmentFlag::AlignCenter);
Kevin Whitaker
committed
loginLayout->addWidget(loginButton);
addChild(loginContainer);
loginContainer->setWidth(Wt::WLength(50, Wt::WLength::Percentage));