From 6e2ba655241984f6a571d8313e7a7a684bd409f6 Mon Sep 17 00:00:00 2001 From: Tomasz Sowa Date: Sat, 27 Oct 2012 11:17:52 +0000 Subject: [PATCH] changed: added 'check_abuse' parameter to Login::LoginUser bool Login::LoginUser(const std::wstring & login, const std::wstring & password, bool remember_me, bool use_ses_log, bool check_abuse) default 'false' -- it test the time between GET and POST and the rebus (if exists) git-svn-id: svn://ttmath.org/publicrep/winix/trunk@905 e52654a7-88a9-db11-a3e9-0013d4bc506e --- functions/login.cpp | 9 ++++++--- functions/login.h | 3 ++- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/functions/login.cpp b/functions/login.cpp index f47678f..2c4b5c0 100755 --- a/functions/login.cpp +++ b/functions/login.cpp @@ -210,7 +210,10 @@ return true; } -bool Login::LoginUser(const std::wstring & login, const std::wstring & password, bool remember_me, bool use_ses_log) +// if you are logging not from a webbrowser but from an application +// then probably you need check_abuse to be false +bool Login::LoginUser(const std::wstring & login, const std::wstring & password, bool remember_me, + bool use_ses_log, bool check_abuse) { long user_id; @@ -232,7 +235,7 @@ long user_id; return false; } - if( !CheckAbuse() ) + if( check_abuse && !CheckAbuse() ) { AddBanInfo(); return false; @@ -264,7 +267,7 @@ void Login::MakePost() const std::wstring & pass = cur->request->PostVar(L"password"); const std::wstring & remem = cur->request->PostVar(L"rememberme"); - if( LoginUser(login, pass, !remem.empty(), true) ) + if( LoginUser(login, pass, !remem.empty(), true, true) ) system->RedirectToLastItem(); } diff --git a/functions/login.h b/functions/login.h index 1648cf5..11fc2de 100755 --- a/functions/login.h +++ b/functions/login.h @@ -35,7 +35,8 @@ public: bool CannotLoginFrom(const IPBan & ipban); bool CheckUserPass(const std::wstring & login, const std::wstring & password, long & user_id); - bool LoginUser(const std::wstring & login, const std::wstring & password, bool remember_me, bool use_ses_log = false); + bool LoginUser(const std::wstring & login, const std::wstring & password, bool remember_me, + bool use_ses_log = false, bool check_abuse = false); private: