/usr/lib/Wt/examples/planner/Login.C is in witty-examples 3.3.0-1build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 | /*
* Copyright (C) 2010 Emweb bvba, Kessel-Lo, Belgium.
*
* See the LICENSE file for terms of use.
*/
#include "Login.h"
#include <Wt/WLabel>
using namespace Wt;
Login::Login(WContainerWidget* parent)
: WContainerWidget(parent),
loggedIn_(this)
{
setStyleClass("login");
WLabel* userNameL = new WLabel(tr("login.userName"), this);
userNameEdit_ = new WLineEdit(this);
userNameEdit_->setFocus();
userNameEdit_->setValidator(new WValidator(true));
userNameL->setBuddy(userNameEdit_);
userNameEdit_->enterPressed().connect(this, &Login::userNameEnterPressed);
loginButton_ = new WPushButton(tr("login.loginButton"), this);
loginButton_->hide();
loginButton_->clicked().connect(this, &Login::loginClicked);
captcha_ = new MyCaptcha(this, 150, 70);
captcha_->completed().connect(this, &Login::captchaCompleted);
}
void Login::captchaCompleted()
{
if (userNameEdit_->validate() != WValidator::Valid) {
captcha_->hide();
loginButton_->show();
userNameEdit_->setFocus();
} else {
login();
}
}
void Login::userNameEnterPressed()
{
if (userNameEdit_->validate() == WValidator::Valid
&& !loginButton_->isHidden())
login();
}
void Login::loginClicked(const WMouseEvent& me)
{
if (userNameEdit_->validate() == WValidator::Valid)
login();
}
void Login::login()
{
loggedIn_.emit(userNameEdit_->text());
}
|