diff --git a/src/AppCfg.cpp b/src/AppCfg.cpp index f107517..bb44c8b 100644 --- a/src/AppCfg.cpp +++ b/src/AppCfg.cpp @@ -5,7 +5,7 @@ std::string AppCfg::m_work_path=""; std::string AppCfg::m_license=""; float AppCfg::m_face_match_threshold = 0.78f; void AppCfg::SetWorkPath(const std::string& work_path) { - + m_work_path = work_path; } const std::string AppCfg::GetWorkPath() { @@ -18,6 +18,6 @@ bool AppCfg::SetLicense(const std::string& license) { } void AppCfg::SetFaceMatchThreshold(float threshold) { - + m_face_match_threshold = threshold; } diff --git a/src/util/AuthModule.cpp b/src/util/AuthModule.cpp index 0f35f51..5b55f03 100644 --- a/src/util/AuthModule.cpp +++ b/src/util/AuthModule.cpp @@ -8,6 +8,7 @@ #include #include "openssl/aes.h" #include "AuthModule.h" +#include "DeviceInfo.h" #include "Base64.h" #include "HttpRequest.h" // 获取时间戳 @@ -115,8 +116,7 @@ void TimeInfo::Show() { } AuthInfo::AuthInfo() : - m_type(AUTH_TYPE_INVALID) { -} + m_type(AUTH_TYPE_INVALID) { } AuthInfo::AuthInfo(const std::string& key_data) { std::istringstream iss(key_data); @@ -144,6 +144,7 @@ AuthInfo::AuthInfo(const std::string& key_data) { ret_t AuthModule::CheckKey(const std::string& key) { + return RET_AUTH_FAILED; } @@ -155,18 +156,19 @@ ret_t AuthModule::CheckKeyFile(const std::string& key_file) { } m_auth_info = AuthInfo(key_data); // m_auth_info.m_expire_time.Show(); - switch (m_auth_info.m_type){ + switch (m_auth_info.m_type) { case AUTH_TYPE_OFFLINE_TIME: ret = CheckOfflineTime(); - break; - case AUTH_TYPE_OFFLINE_MAC: - ret = CheckOfflineMac(); - case AUTH_TYPE_ONLINE: - ret = CheckOnline(); - break; - default: - ret = RET_AUTH_FAILED; - break; + break; + case AUTH_TYPE_OFFLINE_MAC: + ret = CheckOfflineMac(); + break; + case AUTH_TYPE_ONLINE: + ret = CheckOnline(); + break; + default: + ret = RET_AUTH_FAILED; + break; } return ret; } @@ -242,6 +244,14 @@ ret_t AuthModule::CheckOfflineTime() { } ret_t AuthModule::CheckOfflineMac() { + std::vector mac_list = DeviceInfo::GetInstance().GetMacAddress(); + for (auto& mac : mac_list) { + for (auto& auth_mac : m_auth_info.m_mac_list) { + if (mac == auth_mac) { + return RET_OK; + } + } + } return RET_AUTH_FAILED; }