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

* Changed the length of the 'USERS.PASSWORD' field in the database
	to 191 characters.
	* Applied Base64 encoding to the 'USERS.PASSWORD' field in the
	database.
	* Incremented the database version to 359.

Signed-off-by: Fred Gleason <fredg@paravelsystems.com>
This commit is contained in:
Fred Gleason
2022-10-06 16:04:01 -04:00
parent 7ab98c85c1
commit 285a095ada
7 changed files with 87 additions and 7 deletions

View File

@@ -102,8 +102,13 @@ bool RDUser::authenticated(bool webuser) const
"`LOGIN_NAME`,"+
"`ENABLE_WEB` "+
"from `USERS` where "+
"`LOGIN_NAME`='"+RDEscapeString(user_name)+"' && "+
"`PASSWORD`='"+RDEscapeString(user_password)+"'";
"`LOGIN_NAME`='"+RDEscapeString(user_name)+"' && ";
if(user_password.isEmpty()) {
sql+="`PASSWORD` is null";
}
else {
sql+="`PASSWORD`='"+RDEscapeString(user_password.toUtf8().toBase64())+"'";
}
q=new RDSqlQuery(sql);
if(q->first()) {
bool ret=RDBool(q->value(1).toString())||
@@ -134,14 +139,15 @@ bool RDUser::checkPassword(const QString &password,bool webuser)
QString RDUser::password() const
{
return RDGetSqlValue("USERS","LOGIN_NAME",user_name,"PASSWORD").toString();
return QByteArray::fromBase64(RDGetSqlValue("USERS","LOGIN_NAME",user_name,
"PASSWORD").toString().toUtf8());
}
void RDUser::setPassword(const QString &password)
{
user_password=password;
SetRow("PASSWORD",password);
SetRow("PASSWORD",QString(password.toUtf8().toBase64()));
}