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
This commit is contained in:
Tomasz Sowa 2012-10-27 11:17:52 +00:00
parent 8033ac66c4
commit 6e2ba65524
2 changed files with 8 additions and 4 deletions

View File

@ -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();
}

View File

@ -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: