WIP: remove the old database abstraction layer
remove such classes: - DbBase - DbConn - DbTextStream - Db while here: - remove: TextStream, SLog, TexTextStream
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2008-2021, Tomasz Sowa
|
||||
* Copyright (c) 2008-2024, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -69,14 +69,14 @@ return true;
|
||||
|
||||
|
||||
|
||||
bool AddUser::IsLoginCorrect(const std::wstring & login, bool use_ses_log)
|
||||
bool AddUser::IsLoginCorrect(const std::wstring & login)
|
||||
{
|
||||
if( login.empty() )
|
||||
{
|
||||
log << log2 << "AddUser: login can't be empty" << logend;
|
||||
|
||||
if( use_ses_log )
|
||||
slog << logerror << T("adduser_err_login_empty") << logend;
|
||||
// if( use_ses_log )
|
||||
// slog << logerror << T("adduser_err_login_empty") << logend;
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -85,9 +85,9 @@ bool AddUser::IsLoginCorrect(const std::wstring & login, bool use_ses_log)
|
||||
{
|
||||
log << log2 << "AddUser: login can't be longer than: " << WINIX_ACCOUNT_MAX_LOGIN_SIZE << " characters" << logend;
|
||||
|
||||
if( use_ses_log )
|
||||
slog << logerror << T("adduser_err_login_too_big") << " " << WINIX_ACCOUNT_MAX_LOGIN_SIZE
|
||||
<< " " << T("adduser_err_login_too_big2") << logend;
|
||||
// if( use_ses_log )
|
||||
// slog << logerror << T("adduser_err_login_too_big") << " " << WINIX_ACCOUNT_MAX_LOGIN_SIZE
|
||||
// << " " << T("adduser_err_login_too_big2") << logend;
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -96,8 +96,8 @@ bool AddUser::IsLoginCorrect(const std::wstring & login, bool use_ses_log)
|
||||
{
|
||||
log << log2 << "AddUser: incorrect login characters" << logend;
|
||||
|
||||
if( use_ses_log )
|
||||
slog << logerror << T("adduser_err_login_incorrect_chars") << logend;
|
||||
// if( use_ses_log )
|
||||
// slog << logerror << T("adduser_err_login_incorrect_chars") << logend;
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -106,8 +106,8 @@ bool AddUser::IsLoginCorrect(const std::wstring & login, bool use_ses_log)
|
||||
{
|
||||
log << log2 << "AddUser: such user already exists" << logend;
|
||||
|
||||
if( use_ses_log )
|
||||
slog << logerror << T("adduser_err_user_exists") << logend;
|
||||
// if( use_ses_log )
|
||||
// slog << logerror << T("adduser_err_user_exists") << logend;
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -117,15 +117,15 @@ return true;
|
||||
|
||||
|
||||
|
||||
bool AddUser::IsEmailCorrect(const std::wstring & email, bool use_ses_log)
|
||||
bool AddUser::IsEmailCorrect(const std::wstring & email)
|
||||
{
|
||||
if( email.size() > WINIX_ACCOUNT_MAX_EMAIL_SIZE )
|
||||
{
|
||||
log << log2 << "AddUser: email can't be longer than: " << WINIX_ACCOUNT_MAX_EMAIL_SIZE << " characters" << logend;
|
||||
|
||||
if( use_ses_log )
|
||||
slog << logerror << T("adduser_err_email_too_big") << " " << WINIX_ACCOUNT_MAX_EMAIL_SIZE
|
||||
<< " " << T("adduser_err_email_too_big2") << logend;
|
||||
// if( use_ses_log )
|
||||
// slog << logerror << T("adduser_err_email_too_big") << " " << WINIX_ACCOUNT_MAX_EMAIL_SIZE
|
||||
// << " " << T("adduser_err_email_too_big2") << logend;
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -134,8 +134,8 @@ bool AddUser::IsEmailCorrect(const std::wstring & email, bool use_ses_log)
|
||||
{
|
||||
log << log2 << "AddUser: email: " << email << " does not seem to be correct" << logend;
|
||||
|
||||
if( use_ses_log )
|
||||
slog << logerror << T(L"adduser_err_email_incorrect") << logend;
|
||||
// if( use_ses_log )
|
||||
// slog << logerror << T(L"adduser_err_email_incorrect") << logend;
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -210,8 +210,7 @@ bool AddUser::AddNewUser(const std::wstring & login,
|
||||
const std::wstring & pass,
|
||||
const std::wstring & email,
|
||||
bool autoactivate,
|
||||
bool try_login,
|
||||
bool use_ses_log)
|
||||
bool try_login)
|
||||
{
|
||||
user.set_connector(model_connector);
|
||||
user.clear();
|
||||
@@ -248,8 +247,8 @@ bool AddUser::AddNewUser(const std::wstring & login,
|
||||
{
|
||||
system->notify.ActivateAccount(user.login, user.email, code);
|
||||
|
||||
if( use_ses_log )
|
||||
slog << loginfo << T(L"account_email_sent") << logend;
|
||||
// if( use_ses_log )
|
||||
// slog << loginfo << T(L"account_email_sent") << logend;
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -272,9 +271,9 @@ void AddUser::MakePost()
|
||||
// or some other place
|
||||
functions->fun_passwd.set_dependency(this);
|
||||
|
||||
if( !IsLoginCorrect(login, true) ||
|
||||
!IsEmailCorrect(email, true) ||
|
||||
!functions->fun_passwd.IsPasswordCorrect(pass, conf_pass, true) )
|
||||
if( !IsLoginCorrect(login) ||
|
||||
!IsEmailCorrect(email) ||
|
||||
!functions->fun_passwd.IsPasswordCorrect(pass, conf_pass) )
|
||||
return;
|
||||
|
||||
if( cur->session->puser && cur->session->puser->is_super_user )
|
||||
@@ -285,7 +284,7 @@ void AddUser::MakePost()
|
||||
log << log2 << "AddUser: account activated by an admin" << logend;
|
||||
}
|
||||
|
||||
if( AddNewUser(login, pass, email, autoactivate, true, true) )
|
||||
if( AddNewUser(login, pass, email, autoactivate, true) )
|
||||
system->RedirectToLastItem();
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user