mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-13 15:45:42 +08:00
refs #752, added username for DB user
This commit is contained in:
committed by
Roland Winklmeier
parent
03b5f9ce2c
commit
609eae061f
@@ -65,6 +65,7 @@ namespace BlackMisc
|
|||||||
user.setDbKey(json.value("id").toInt(-1));
|
user.setDbKey(json.value("id").toInt(-1));
|
||||||
user.setVatsimId(json.value("vatsimId").toInt(-1));
|
user.setVatsimId(json.value("vatsimId").toInt(-1));
|
||||||
user.setRealName(json.value("name").toString());
|
user.setRealName(json.value("name").toString());
|
||||||
|
user.setUsername(json.value("username").toString());
|
||||||
user.setEmail(json.value("email").toString(""));
|
user.setEmail(json.value("email").toString(""));
|
||||||
user.setCountry(CCountry(json.value("country").toString(), json.value("countryname").toString()));
|
user.setCountry(CCountry(json.value("country").toString(), json.value("countryname").toString()));
|
||||||
user.setEnabled(json.value("enabled").toBool());
|
user.setEnabled(json.value("enabled").toBool());
|
||||||
@@ -76,10 +77,16 @@ namespace BlackMisc
|
|||||||
|
|
||||||
void CAuthenticatedUser::setRealName(const QString &realname)
|
void CAuthenticatedUser::setRealName(const QString &realname)
|
||||||
{
|
{
|
||||||
QString rn(realname.trimmed().simplified());
|
const QString rn(realname.trimmed().simplified());
|
||||||
this->m_realname = rn;
|
this->m_realname = rn;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CAuthenticatedUser::setUsername(const QString &username)
|
||||||
|
{
|
||||||
|
const QString un(username.trimmed().simplified().toUpper());
|
||||||
|
this->m_username = un;
|
||||||
|
}
|
||||||
|
|
||||||
CStatusMessageList CAuthenticatedUser::validate() const
|
CStatusMessageList CAuthenticatedUser::validate() const
|
||||||
{
|
{
|
||||||
static const CLogCategoryList cats(CLogCategoryList(this).join({ CLogCategory::validation()}));
|
static const CLogCategoryList cats(CLogCategoryList(this).join({ CLogCategory::validation()}));
|
||||||
@@ -126,6 +133,8 @@ namespace BlackMisc
|
|||||||
return CVariant::fromValue(this->m_password);
|
return CVariant::fromValue(this->m_password);
|
||||||
case IndexRealName:
|
case IndexRealName:
|
||||||
return CVariant::fromValue(this->m_realname);
|
return CVariant::fromValue(this->m_realname);
|
||||||
|
case IndexUsername:
|
||||||
|
return CVariant::fromValue(this->m_username);
|
||||||
default:
|
default:
|
||||||
return CValueObject::propertyByIndex(index);
|
return CValueObject::propertyByIndex(index);
|
||||||
}
|
}
|
||||||
@@ -150,6 +159,9 @@ namespace BlackMisc
|
|||||||
case IndexRealName:
|
case IndexRealName:
|
||||||
this->setRealName(variant.value<QString>());
|
this->setRealName(variant.value<QString>());
|
||||||
break;
|
break;
|
||||||
|
case IndexUsername:
|
||||||
|
this->setUsername(variant.value<QString>());
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
CValueObject::setPropertyByIndex(index, variant);
|
CValueObject::setPropertyByIndex(index, variant);
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -46,7 +46,8 @@ namespace BlackMisc
|
|||||||
IndexEmail = BlackMisc::CPropertyIndex::GlobalIndexCAuthenticatedUser,
|
IndexEmail = BlackMisc::CPropertyIndex::GlobalIndexCAuthenticatedUser,
|
||||||
IndexVatsimId,
|
IndexVatsimId,
|
||||||
IndexPassword,
|
IndexPassword,
|
||||||
IndexRealName
|
IndexRealName,
|
||||||
|
IndexUsername
|
||||||
};
|
};
|
||||||
|
|
||||||
//! Default constructor.
|
//! Default constructor.
|
||||||
@@ -64,9 +65,15 @@ namespace BlackMisc
|
|||||||
//! Full name + id
|
//! Full name + id
|
||||||
QString getRealNameAndId() const;
|
QString getRealNameAndId() const;
|
||||||
|
|
||||||
//! setRealName
|
//! Set real name
|
||||||
void setRealName(const QString &realname);
|
void setRealName(const QString &realname);
|
||||||
|
|
||||||
|
//! Username
|
||||||
|
const QString &getUsername() const { return m_username; }
|
||||||
|
|
||||||
|
//! Set username
|
||||||
|
void setUsername(const QString &username);
|
||||||
|
|
||||||
//! Get password
|
//! Get password
|
||||||
const QString &getPassword() const { return m_password; }
|
const QString &getPassword() const { return m_password; }
|
||||||
|
|
||||||
@@ -160,6 +167,7 @@ namespace BlackMisc
|
|||||||
private:
|
private:
|
||||||
int m_vatsimId;
|
int m_vatsimId;
|
||||||
QString m_realname;
|
QString m_realname;
|
||||||
|
QString m_username;
|
||||||
QString m_email;
|
QString m_email;
|
||||||
QString m_password;
|
QString m_password;
|
||||||
BlackMisc::CCountry m_country;
|
BlackMisc::CCountry m_country;
|
||||||
@@ -172,6 +180,7 @@ namespace BlackMisc
|
|||||||
BLACK_METAMEMBER(dbKey),
|
BLACK_METAMEMBER(dbKey),
|
||||||
BLACK_METAMEMBER(vatsimId),
|
BLACK_METAMEMBER(vatsimId),
|
||||||
BLACK_METAMEMBER(realname),
|
BLACK_METAMEMBER(realname),
|
||||||
|
BLACK_METAMEMBER(username),
|
||||||
BLACK_METAMEMBER(email),
|
BLACK_METAMEMBER(email),
|
||||||
BLACK_METAMEMBER(password),
|
BLACK_METAMEMBER(password),
|
||||||
BLACK_METAMEMBER(country),
|
BLACK_METAMEMBER(country),
|
||||||
|
|||||||
Reference in New Issue
Block a user