diff options
author | Tiger Wang <ziwei.tiger@hotmail.co.uk> | 2013-11-04 22:51:24 +0100 |
---|---|---|
committer | Tiger Wang <ziwei.tiger@hotmail.co.uk> | 2013-11-04 22:51:24 +0100 |
commit | e832736e0bf315585f873b43520d1d771930a1c2 (patch) | |
tree | d9fce26b198075371b04356b6f66f31da51f4493 /source/Authenticator.cpp | |
parent | Protocol 1.7: Added more client-bound packets. (diff) | |
download | cuberite-e832736e0bf315585f873b43520d1d771930a1c2.tar cuberite-e832736e0bf315585f873b43520d1d771930a1c2.tar.gz cuberite-e832736e0bf315585f873b43520d1d771930a1c2.tar.bz2 cuberite-e832736e0bf315585f873b43520d1d771930a1c2.tar.lz cuberite-e832736e0bf315585f873b43520d1d771930a1c2.tar.xz cuberite-e832736e0bf315585f873b43520d1d771930a1c2.tar.zst cuberite-e832736e0bf315585f873b43520d1d771930a1c2.zip |
Diffstat (limited to 'source/Authenticator.cpp')
-rw-r--r-- | source/Authenticator.cpp | 36 |
1 files changed, 8 insertions, 28 deletions
diff --git a/source/Authenticator.cpp b/source/Authenticator.cpp index e09fd0871..9a6dcf51b 100644 --- a/source/Authenticator.cpp +++ b/source/Authenticator.cpp @@ -46,28 +46,9 @@ cAuthenticator::~cAuthenticator() /// Read custom values from INI void cAuthenticator::ReadINI(cIniFile & IniFile) { - m_Server = IniFile.GetValue("Authentication", "Server"); - m_Address = IniFile.GetValue("Authentication", "Address"); - m_ShouldAuthenticate = IniFile.GetValueB("Authentication", "Authenticate", true); - bool bSave = false; - - if (m_Server.length() == 0) - { - m_Server = DEFAULT_AUTH_SERVER; - IniFile.SetValue("Authentication", "Server", m_Server); - bSave = true; - } - if (m_Address.length() == 0) - { - m_Address = DEFAULT_AUTH_ADDRESS; - IniFile.SetValue("Authentication", "Address", m_Address); - bSave = true; - } - - if (bSave) - { - IniFile.SetValueB("Authentication", "Authenticate", m_ShouldAuthenticate); - } + m_Server = IniFile.GetValueSet("Authentication", "Server", DEFAULT_AUTH_SERVER); + m_Address = IniFile.GetValueSet("Authentication", "Address", DEFAULT_AUTH_ADDRESS); + m_ShouldAuthenticate = IniFile.GetValueSetB("Authentication", "Authenticate", true); } @@ -199,7 +180,7 @@ bool cAuthenticator::AuthFromAddress(const AString & a_Server, const AString & a } else if (code == 200) { - LOGINFO("Got 200 OK :D"); + LOGD("cAuthenticator: Received status 200 OK! :D"); bOK = true; } } @@ -268,17 +249,16 @@ bool cAuthenticator::AuthFromAddress(const AString & a_Server, const AString & a std::string Result; ss >> Result; - LOGINFO("Got result: %s", Result.c_str()); - //if (Result.compare("3") == 0) // FIXME: Quick and dirty hack to support auth - //Lapayo: Wtf 3? + LOGD("cAuthenticator: Authentication result was %s", Result.c_str()); + if (Result.compare("YES") == 0) //Works well { - LOGINFO("Result was \"YES\", so player is authenticated!"); + LOGINFO("Authentication result \"YES\", player authentication success!"); return true; } - LOGINFO("Result was \"%s\", so player is NOT authenticated!", Result.c_str()); + LOGINFO("Authentication result was \"%s\", player authentication failure!", Result.c_str()); return false; } |