Added first connection form
This commit is contained in:
@@ -70,6 +70,7 @@ lms_SOURCES = \
|
|||||||
$(top_srcdir)/ui/settings/SettingsAccountFormView.cpp \
|
$(top_srcdir)/ui/settings/SettingsAccountFormView.cpp \
|
||||||
$(top_srcdir)/ui/settings/SettingsAudioFormView.cpp \
|
$(top_srcdir)/ui/settings/SettingsAudioFormView.cpp \
|
||||||
$(top_srcdir)/ui/settings/SettingsDatabaseFormView.cpp \
|
$(top_srcdir)/ui/settings/SettingsDatabaseFormView.cpp \
|
||||||
|
$(top_srcdir)/ui/settings/SettingsFirstConnectionFormView.cpp \
|
||||||
$(top_srcdir)/ui/settings/SettingsMediaDirectories.cpp \
|
$(top_srcdir)/ui/settings/SettingsMediaDirectories.cpp \
|
||||||
$(top_srcdir)/ui/settings/SettingsMediaDirectoryFormView.cpp \
|
$(top_srcdir)/ui/settings/SettingsMediaDirectoryFormView.cpp \
|
||||||
$(top_srcdir)/ui/settings/SettingsUserFormView.cpp \
|
$(top_srcdir)/ui/settings/SettingsUserFormView.cpp \
|
||||||
|
|||||||
@@ -37,8 +37,8 @@ Handler::configureAuth(void)
|
|||||||
|
|
||||||
Wt::Auth::PasswordStrengthValidator* strengthValidator = new Wt::Auth::PasswordStrengthValidator();
|
Wt::Auth::PasswordStrengthValidator* strengthValidator = new Wt::Auth::PasswordStrengthValidator();
|
||||||
// Reduce some constraints...
|
// Reduce some constraints...
|
||||||
strengthValidator->setMinimumLength( Wt::Auth::PasswordStrengthValidator::TwoCharClass, 11);
|
strengthValidator->setMinimumLength( Wt::Auth::PasswordStrengthValidator::TwoCharClass, 8);
|
||||||
strengthValidator->setMinimumLength( Wt::Auth::PasswordStrengthValidator::ThreeCharClass, 8 );
|
strengthValidator->setMinimumLength( Wt::Auth::PasswordStrengthValidator::ThreeCharClass, 7 );
|
||||||
strengthValidator->setMinimumLength( Wt::Auth::PasswordStrengthValidator::FourCharClass, 6 );
|
strengthValidator->setMinimumLength( Wt::Auth::PasswordStrengthValidator::FourCharClass, 6 );
|
||||||
|
|
||||||
passwordService.setStrengthValidator(strengthValidator);
|
passwordService.setStrengthValidator(strengthValidator);
|
||||||
|
|||||||
+30
-6
@@ -1,9 +1,16 @@
|
|||||||
#include <Wt/WBootstrapTheme>
|
#include <Wt/WBootstrapTheme>
|
||||||
#include "auth/LmsAuth.hpp"
|
#include "auth/LmsAuth.hpp"
|
||||||
|
|
||||||
#include "LmsHome.hpp"
|
#include "LmsHome.hpp"
|
||||||
|
#include "settings/SettingsFirstConnectionFormView.hpp"
|
||||||
|
|
||||||
#include "LmsApplication.hpp"
|
#include "LmsApplication.hpp"
|
||||||
|
|
||||||
|
namespace skeletons {
|
||||||
|
extern const char *AuthStrings_xml1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
namespace UserInterface {
|
namespace UserInterface {
|
||||||
|
|
||||||
Wt::WApplication*
|
Wt::WApplication*
|
||||||
@@ -38,17 +45,34 @@ LmsApplication::LmsApplication(const Wt::WEnvironment& env, boost::filesystem::p
|
|||||||
|
|
||||||
setTitle("LMS"); // application title
|
setTitle("LMS"); // application title
|
||||||
|
|
||||||
_sessionData.getDatabaseHandler().getLogin().changed().connect(this, &LmsApplication::handleAuthEvent);
|
bool firstConnection;
|
||||||
|
{
|
||||||
|
Wt::Dbo::Transaction transaction(_sessionData.getDatabaseHandler().getSession());
|
||||||
|
|
||||||
LmsAuth *authWidget = new LmsAuth(_sessionData.getDatabaseHandler());
|
firstConnection = (Database::User::getAll(_sessionData.getDatabaseHandler().getSession()).size() == 0);
|
||||||
|
}
|
||||||
|
|
||||||
authWidget->model()->addPasswordAuth(&Database::Handler::getPasswordService());
|
// If here is no account in the database, launch the first connection wizard
|
||||||
authWidget->setRegistrationEnabled(false);
|
if (firstConnection)
|
||||||
|
{
|
||||||
|
// Hack, use the auth widget builtin strings
|
||||||
|
builtinLocalizedStrings().useBuiltin(skeletons::AuthStrings_xml1);
|
||||||
|
|
||||||
authWidget->processEnvironment();
|
root()->addWidget( new Settings::FirstConnectionFormView(_sessionData));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_sessionData.getDatabaseHandler().getLogin().changed().connect(this, &LmsApplication::handleAuthEvent);
|
||||||
|
|
||||||
root()->addWidget(authWidget);
|
LmsAuth *authWidget = new LmsAuth(_sessionData.getDatabaseHandler());
|
||||||
|
|
||||||
|
authWidget->model()->addPasswordAuth(&Database::Handler::getPasswordService());
|
||||||
|
authWidget->setRegistrationEnabled(false);
|
||||||
|
|
||||||
|
authWidget->processEnvironment();
|
||||||
|
|
||||||
|
root()->addWidget(authWidget);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
#ifndef LMS_APPLICATION_HPP
|
||||||
|
#define LMS_APPLICATION_HPP
|
||||||
|
|
||||||
#include <Wt/WApplication>
|
#include <Wt/WApplication>
|
||||||
|
|
||||||
@@ -28,3 +30,6 @@ class LmsApplication : public Wt::WApplication
|
|||||||
|
|
||||||
|
|
||||||
} // namespace UserInterface
|
} // namespace UserInterface
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,61 @@
|
|||||||
<messages xmlns:if="Wt.WTemplate.conditions">
|
<messages xmlns:if="Wt.WTemplate.conditions">
|
||||||
<!--FORMS message blocks-->
|
<!--FORMS message blocks-->
|
||||||
|
|
||||||
|
<message id="firstConnectionForm-template">
|
||||||
|
<legend>${title}</legend>
|
||||||
|
<div class="form-horizontal">
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="control-label col-sm-2" for="${id:name}">
|
||||||
|
Name
|
||||||
|
</label>
|
||||||
|
<div class="col-sm-5">
|
||||||
|
${name}
|
||||||
|
</div>
|
||||||
|
<div class="help-block col-sm-5">
|
||||||
|
${name-info}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="control-label col-sm-2" for="${id:email}">
|
||||||
|
e-Mail
|
||||||
|
</label>
|
||||||
|
<div class="col-sm-5">
|
||||||
|
${email}
|
||||||
|
</div>
|
||||||
|
<div class="help-block col-sm-5">
|
||||||
|
${email-info}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="control-label col-sm-2" for="${id:password}">
|
||||||
|
Password
|
||||||
|
</label>
|
||||||
|
<div class="col-sm-5">
|
||||||
|
${password}
|
||||||
|
</div>
|
||||||
|
${password-info}
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="control-label col-sm-2" for="${id:password-confirm}">
|
||||||
|
Confirm password
|
||||||
|
</label>
|
||||||
|
<div class="col-sm-5">
|
||||||
|
${password-confirm}
|
||||||
|
</div>
|
||||||
|
<div class="help-block col-sm-5">
|
||||||
|
${password-confirm-info}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<div class="col-sm-offset-2 col-sm-10">
|
||||||
|
${save-button}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
${apply-info}
|
||||||
|
</div>
|
||||||
|
</message>
|
||||||
|
|
||||||
|
|
||||||
<message id="userForm-template">
|
<message id="userForm-template">
|
||||||
<legend>${title}</legend>
|
<legend>${title}</legend>
|
||||||
<div class="form-horizontal">
|
<div class="form-horizontal">
|
||||||
|
|||||||
Reference in New Issue
Block a user