added: to IsWhite (core/misc)
other unicode white characters 25 characters -- without a new line character (10) added: config option: account_need_email_verification if true then when creating an account a user has to provide his email address and a message with an activation link will be sent back to him added: 'pw' winix function (not finished yet) at the moment only one parameter 'activate' git-svn-id: svn://ttmath.org/publicrep/winix/trunk@810 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
@@ -128,26 +128,58 @@ User & Users::operator[](Users::SizeType pos)
|
||||
}
|
||||
|
||||
|
||||
void Users::LoginUser(long user_id, bool remember_me)
|
||||
bool Users::LoginUser(long user_id, bool remember_me, bool use_ses_log)
|
||||
{
|
||||
if( !cur->session )
|
||||
return;
|
||||
return false;
|
||||
|
||||
if( cur->session->id == 0 )
|
||||
{
|
||||
log << log1 << "Users: cannot login a user on a temporary session" << logend;
|
||||
return;
|
||||
|
||||
if( use_ses_log )
|
||||
slog << logerror << T(L"service_unavailable") << logend;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
cur->session->puser = GetUser(user_id);
|
||||
cur->session->spam_score = 0;
|
||||
User * puser = GetUser(user_id);
|
||||
|
||||
if( !cur->session->puser )
|
||||
if( !puser )
|
||||
{
|
||||
log << log1 << "Users: user id: " << user_id << " is not in system.users table" << logend;
|
||||
return;
|
||||
log << log1 << "Users: user id: " << user_id << " is not in system.users table" << logend;
|
||||
|
||||
if( use_ses_log )
|
||||
slog << logerror << T(L"service_unavailable") << logend;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
if( puser->status != WINIX_ACCOUNT_READY )
|
||||
{
|
||||
log << log1 << "Users: user id: " << user_id << " is not ready for logging in (status: "
|
||||
<< puser->status << ")" << logend;
|
||||
|
||||
if( use_ses_log )
|
||||
{
|
||||
if( puser->status == WINIX_ACCOUNT_NOT_ACTIVATED )
|
||||
slog << logerror << T(L"account_not_activated") << logend;
|
||||
else
|
||||
if( puser->status == WINIX_ACCOUNT_SUSPENDED )
|
||||
slog << logerror << T(L"account_suspended") << logend;
|
||||
else
|
||||
if( puser->status == WINIX_ACCOUNT_BLOCKED )
|
||||
slog << logerror << T(L"account_banned") << logend;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
if( cur->session->puser )
|
||||
LogoutCurrentUser();
|
||||
|
||||
cur->session->puser = puser;
|
||||
cur->session->spam_score = 0;
|
||||
cur->session->remember_me = remember_me;
|
||||
|
||||
last.UserLogin(user_id, cur->session->puser->name, inet_addr(cur->request->env_remote_addr), cur->session->id);
|
||||
@@ -156,6 +188,8 @@ void Users::LoginUser(long user_id, bool remember_me)
|
||||
how_many_logged += 1;
|
||||
|
||||
log << log2 << "User " << cur->session->puser->name << " (id: " << user_id << ") logged" << logend;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user