Add last_login column to user table and populate upon login

This commit is contained in:
woogerboy21 2015-08-15 02:56:10 -04:00
parent 0f4dc18074
commit bb0b626cee
6 changed files with 22 additions and 2 deletions

View file

@ -880,3 +880,14 @@ void Servatrice_DatabaseInterface::updateUsersClientID(const QString &userName,
execSqlQuery(query);
}
void Servatrice_DatabaseInterface::updateUsersLastLoginTime(const QString &userName)
{
if (!checkSql())
return;
QSqlQuery *query = prepareQuery("update {prefix}_users set last_login = NOW() where name = :user_name");
query->bindValue(":user_name", userName);
execSqlQuery(query);
}

View file

@ -9,7 +9,7 @@
#include "server.h"
#include "server_database_interface.h"
#define DATABASE_SCHEMA_VERSION 5
#define DATABASE_SCHEMA_VERSION 6
class Servatrice;
@ -73,6 +73,7 @@ public:
const QString &password, const QString &emailAddress, const QString &country, QString &token, bool active = false);
bool activateUser(const QString &userName, const QString &token);
void updateUsersClientID(const QString &userName, const QString &userClientID);
void updateUsersLastLoginTime(const QString &userName);
void logMessage(const int senderId, const QString &senderName, const QString &senderIp, const QString &logMessage,
LogMessage_TargetType targetType, const int targetId, const QString &targetName);
bool changeUserPassword(const QString &user, const QString &oldPassword, const QString &newPassword);