license: Implemented new license format

* Implemented new format splitting user, version, and usage period into separate lines
* Refactored all classes: License, LicenseGenerator, LicenseChecker
* Removed redundant license check hash from ApplicationSettings, don't generate, store and check it anymore
* Moved license checking and encoding logic to LicenseChecker
* Moved default for license generation to main.cpp
* Refactored license checking logic in whole app, removed involved message types
* Added LicenseCheckerTestSuite for checking all legacy and current license types
* Generate new license type lifelong
This commit is contained in:
Eberhard Graether
2019-03-18 14:49:52 +01:00
parent 6ff7d22641
commit b02064a160
38 changed files with 2073 additions and 1538 deletions
-29
View File
@@ -224,32 +224,3 @@ std::string utility::getOsTypeString()
}
return "unknown";
}
bool utility::saveLicense(const License* license)
{
if (license == nullptr)
{
return false;
}
if (license->isValid())
{
ApplicationSettings* appSettings = ApplicationSettings::getInstance().get();
if (appSettings == nullptr)
{
LOG_ERROR_STREAM(<< "Unable to retrieve app settings");
return false;
}
const FilePath appLocation = AppPath::getAppPath();
appSettings->setLicenseString(license->getLicenseEncodedString(appLocation.str()));
appSettings->setLicenseCheck(license->hashLocation(appLocation.getAbsolute().str()));
appSettings->save();
return true;
}
else
{
LOG_ERROR( "The entered license key is invalid.");
return false;
}
}