winix/functions/login.h

64 lines
1.1 KiB
C++
Executable File

/*
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2010-2014, Tomasz Sowa
* All rights reserved.
*
*/
#ifndef headerfile_winix_functions_login
#define headerfile_winix_functions_login
#include "functionbase.h"
#include "core/user.h"
namespace Winix
{
namespace Fun
{
class Login : public FunctionBase
{
public:
Login();
void MakePost();
void MakeGet();
bool ShouldUseCaptchaForCurrentIP();
bool ShouldUseCaptchaFor(const IPBan & ipban);
bool CannotLoginFromCurrentIP();
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 check_abuse = false);
private:
void ClearTmpStruct();
bool CheckPasswords(const std::wstring & password);
void AddBanInfo();
bool CheckAbuse();
UserPass up, up2;
std::string pass_decrypted;
std::wstring pass_hashed;
std::wstring salt;
};
} // namespace
} // namespace Winix
#endif