add maskText to mask password

This commit is contained in:
Ryan Tang 2024-09-09 14:22:21 -04:00
parent b3692705ab
commit d738971435
2 changed files with 15 additions and 3 deletions

View File

@ -468,11 +468,11 @@ void FSUDAQ::LoadProgramSettings(){
LogMsg(" Raw Data Path : " + rawDataPath);
LogMsg(" Influx IP : " + influxIP);
LogMsg(" Database Name : " + dataBaseName);
LogMsg("Database Token : " + influxToken);
LogMsg("Database Token : " + maskText(influxToken));
LogMsg(" Elog IP : " + elogIP);
LogMsg(" Elog Name : " + elogName);
LogMsg(" Elog User : " + elogUser);
LogMsg(" Elog PWD : " + elogPWD);
LogMsg(" Elog User : " + maskText(elogUser));
LogMsg(" Elog PWD : " + maskText(elogPWD));
logMsgHTMLMode = true;
//check is rawDataPath exist, if not, create one

View File

@ -209,6 +209,18 @@ private:
//@----- Analyzer
Analyzer * onlineAnalyzer;
QString maskText(const QString &password) {
if (password.length() <= 3) {
return password; // No masking needed for short passwords
} else if (password.length() <= 10) {
QString maskedPassword = password.left(3);
maskedPassword += QString("*").repeated(password.length() - 3);
return maskedPassword;
} else {
return password.left(3) + QString("*").repeated(7);
}
}
};