* Support getting a user's password salt via initial websocket connection (added to Event_ServerIdentification) * Nonsense stuff to figure out later * move passwordhasher to correct location * protobuf changes * add ext to protobuf * implement request password salt server side * add supportspasswordhash to server identification * check backwards compatibility * reset some changes to master * implement get password salt client side * implement checking hashed passwords on server login * check for registration requirement on getting password salt * properly check password salt response and show errors * remove unused property * add password salt to list of response types Co-authored-by: ZeldaZach <zahalpern+github@gmail.com>
76 lines
2.4 KiB
C++
76 lines
2.4 KiB
C++
#include "featureset.h"
|
|
|
|
#include <QDebug>
|
|
#include <QMap>
|
|
|
|
FeatureSet::FeatureSet()
|
|
{
|
|
}
|
|
|
|
QMap<QString, bool> FeatureSet::getDefaultFeatureList()
|
|
{
|
|
initalizeFeatureList(featureList);
|
|
return featureList;
|
|
}
|
|
|
|
void FeatureSet::initalizeFeatureList(QMap<QString, bool> &featureList)
|
|
{
|
|
// default features [name], [is required to connect]
|
|
featureList.insert("client_id", false);
|
|
featureList.insert("client_ver", false);
|
|
featureList.insert("feature_set", false);
|
|
featureList.insert("user_ban_history", false);
|
|
featureList.insert("room_chat_history", false);
|
|
featureList.insert("client_warnings", false);
|
|
featureList.insert("mod_log_lookup", false);
|
|
featureList.insert("idle_client", false);
|
|
featureList.insert("forgot_password", false);
|
|
featureList.insert("websocket", false);
|
|
featureList.insert("hashed_password_login", false);
|
|
// These are temp to force users onto a newer client
|
|
featureList.insert("2.7.0_min_version", false);
|
|
featureList.insert("2.8.0_min_version", false);
|
|
}
|
|
|
|
void FeatureSet::enableRequiredFeature(QMap<QString, bool> &featureList, QString featureName)
|
|
{
|
|
if (featureList.contains(featureName))
|
|
featureList.insert(featureName, true);
|
|
}
|
|
|
|
void FeatureSet::disableRequiredFeature(QMap<QString, bool> &featureList, QString featureName)
|
|
{
|
|
if (featureList.contains(featureName))
|
|
featureList.insert(featureName, false);
|
|
}
|
|
|
|
QMap<QString, bool>
|
|
FeatureSet::addFeature(QMap<QString, bool> &featureList, QString featureName, bool isFeatureRequired)
|
|
{
|
|
featureList.insert(featureName, isFeatureRequired);
|
|
return featureList;
|
|
}
|
|
|
|
QMap<QString, bool> FeatureSet::identifyMissingFeatures(QMap<QString, bool> suppliedFeatures,
|
|
QMap<QString, bool> requiredFeatures)
|
|
{
|
|
QMap<QString, bool> missingList;
|
|
QMap<QString, bool>::iterator i;
|
|
for (i = requiredFeatures.begin(); i != requiredFeatures.end(); ++i) {
|
|
if (!suppliedFeatures.contains(i.key())) {
|
|
missingList.insert(i.key(), i.value());
|
|
}
|
|
}
|
|
return missingList;
|
|
}
|
|
|
|
bool FeatureSet::isRequiredFeaturesMissing(QMap<QString, bool> suppliedFeatures, QMap<QString, bool> requiredFeatures)
|
|
{
|
|
QMap<QString, bool>::iterator i;
|
|
for (i = requiredFeatures.begin(); i != requiredFeatures.end(); ++i) {
|
|
if (i.value() && suppliedFeatures.contains(i.key())) {
|
|
return true;
|
|
}
|
|
}
|
|
return false;
|
|
}
|