Added first connection wizard to create the administrator account

This commit is contained in:
emeric
2018-03-08 22:57:56 +01:00
parent db0fe53aa3
commit 86fc1415d5
15 changed files with 287 additions and 132 deletions
-33
View File
@@ -1,33 +0,0 @@
/*
* Copyright (C) 2013 Emeric Poupon
*
* This file is part of LMS.
*
* LMS 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 3 of the License, or
* (at your option) any later version.
*
* LMS 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 LMS. If not, see <http://www.gnu.org/licenses/>.
*/
#include <Wt/WValidator>
namespace UserInterface {
class DirectoryValidator : public Wt::WValidator
{
public:
DirectoryValidator(Wt::WObject *parent = 0);
Wt::WValidator::Result validate(const Wt::WString& input) const;
};
} // namespace UserInterface
@@ -19,16 +19,31 @@
#include <boost/filesystem.hpp>
#include "DirectoryValidator.hpp"
#include "Validators.hpp"
namespace UserInterface {
Wt::WValidator* createNameValidator()
{
Wt::WLengthValidator *v = new Wt::WLengthValidator();
v->setMandatory(true);
v->setMinimumLength(::Database::User::MinNameLength);
v->setMaximumLength(::Database::User::MaxNameLength);
return v;
}
Wt::WValidator* createMandatoryValidator()
{
auto v = new Wt::WValidator();
v->setMandatory(true);
return v;
}
DirectoryValidator::DirectoryValidator(Wt::WObject *parent)
: Wt::WValidator(parent)
{
}
Wt::WValidator::Result
DirectoryValidator::validate(const Wt::WString& input) const
{
+11 -14
View File
@@ -19,26 +19,23 @@
#pragma once
#include <Wt/WRegExpValidator>
#include <Wt/WLengthValidator>
#include "database/User.hpp"
namespace UserInterface {
static inline Wt::WValidator *createEmailValidator()
{
Wt::WValidator *res = new Wt::WRegExpValidator("[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,4}");
res->setMandatory(true);
return res;
}
Wt::WValidator* createNameValidator();
Wt::WValidator* createMandatoryValidator();
static inline Wt::WValidator *createNameValidator() {
Wt::WLengthValidator *v = new Wt::WLengthValidator();
v->setMandatory(true);
v->setMinimumLength(3);
v->setMaximumLength(::Database::User::MaxNameLength);
return v;
}
class DirectoryValidator : public Wt::WValidator
{
public:
DirectoryValidator(Wt::WObject *parent = 0);
Wt::WValidator::Result validate(const Wt::WString& input) const override;
};
} // namespace UserInterface