2022-10-06 Fred Gleason <fredg@paravelsystems.com>

* Changed the type of the 'MATRICES.PASSWORD` field in the
	database to 'text'.
	* Changed the type of the 'MATRICES.PASSWORD_2` field in the
	database to 'text'.
	* Applied Base64 encoding to the 'MATRICES.PASSWORD' field in
	the database.
	* Applied Base64 encoding to the 'MATRICES.PASSWORD_2' field in
	the database.
	* Incremented the database version to 362.

Signed-off-by: Fred Gleason <fredg@paravelsystems.com>
This commit is contained in:
Fred Gleason
2022-10-06 18:07:40 -04:00
parent f212c99a83
commit 844e10e1b6
8 changed files with 138 additions and 12 deletions

View File

@@ -459,10 +459,10 @@ QString RDMatrix::password(RDMatrix::Role role) const
{
switch(role) {
case RDMatrix::Primary:
return GetRow("PASSWORD").toString();
return QByteArray::fromBase64(GetRow("PASSWORD").toString().toUtf8());
case RDMatrix::Backup:
return GetRow("PASSWORD_2").toString();
return QByteArray::fromBase64(GetRow("PASSWORD_2").toString().toUtf8());
}
return QString();
}
@@ -472,10 +472,10 @@ void RDMatrix::setPassword(RDMatrix::Role role,const QString &passwd) const
{
switch(role) {
case RDMatrix::Primary:
SetRow("PASSWORD",passwd);
SetRow("PASSWORD",passwd.toUtf8().toBase64());
case RDMatrix::Backup:
SetRow("PASSWORD_2",passwd);
SetRow("PASSWORD_2",passwd.toUtf8().toBase64());
}
}
@@ -985,6 +985,26 @@ void RDMatrix::SetRow(const QString &param,const QString &value) const
}
void RDMatrix::SetRow(const QString &param,const QByteArray &value) const
{
QString sql;
if(value.size()==0) {
sql=QString("update `MATRICES` set `")+
param+"`=NULL where "+
"`STATION_NAME`='"+RDEscapeString(mx_station)+"' && "+
QString::asprintf("`MATRIX`=%d",mx_number);
}
else {
sql=QString("update `MATRICES` set `")+
param+"`='"+RDEscapeString(value)+"' where "+
"`STATION_NAME`='"+RDEscapeString(mx_station)+"' && "+
QString::asprintf("`MATRIX`=%d",mx_number);
}
RDSqlQuery::apply(sql);
}
void RDMatrix::SetRow(const QString &param,int value) const
{
QString sql;