add logincheck
This commit is contained in:
parent
9ba2696e52
commit
5a4e95e901
17
cpp/utils.cc
17
cpp/utils.cc
@ -4,6 +4,7 @@
|
||||
#include <a8/csvreader.h>
|
||||
#include <a8/udplog.h>
|
||||
#include <a8/mysql.h>
|
||||
#include <a8/openssl.h>
|
||||
|
||||
#include <google/protobuf/message.h>
|
||||
|
||||
@ -308,6 +309,22 @@ namespace f8
|
||||
return true;
|
||||
}
|
||||
|
||||
bool LoginCheck(const std::string& accountid, const std::string& sessionid)
|
||||
{
|
||||
std::vector<std::string> strings;
|
||||
a8::Split(sessionid, strings, '_');
|
||||
if (strings.size() < 4) {
|
||||
return false;
|
||||
}
|
||||
if (IsOnlineEnv()) {
|
||||
//session_createtime account_registertime md51 md52
|
||||
std::string md5_str = accountid + "f3a6a9a5-217a-4079-ab99-b5d69b8212be" +
|
||||
strings[1] + strings[0];
|
||||
return a8::openssl::md5(md5_str) == strings[2];
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
int ExtractGameIdFromAccountId(const std::string& accountid)
|
||||
{
|
||||
std::vector<std::string> strings;
|
||||
|
@ -109,6 +109,7 @@ namespace f8
|
||||
bool CheckRegisterTimeInSessionId(const std::string& accountid, const std::string& sessionid);
|
||||
time_t ExtractRegisterTimeFromSessionId(const std::string& sessionid);
|
||||
bool IsValidSessionId(const std::string& accountid, const std::string& sessionid);
|
||||
bool LoginCheck(const std::string& accountid, const std::string& sessionid);
|
||||
int ExtractGameIdFromAccountId(const std::string& accountid);
|
||||
int ExtractChannelIdFromAccountId(const std::string& accountid);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user