Mark a user logged in in DB when successful.
This commit is contained in:
@@ -106,6 +106,14 @@ void LoginInterface::loginCheck()
|
|||||||
Wt::log("info") << "login by "<< app->currentUser.username << " happened.";
|
Wt::log("info") << "login by "<< app->currentUser.username << " happened.";
|
||||||
setLocalCookieForUser(app->currentUser);
|
setLocalCookieForUser(app->currentUser);
|
||||||
app->loginCompleted();
|
app->loginCompleted();
|
||||||
|
//Now mark this as a successful login.
|
||||||
|
Wt::Dbo::Transaction loginTransaction(sqlSession);
|
||||||
|
UserAction* action = new UserAction();
|
||||||
|
action->action = UserAction::UAction::Login;
|
||||||
|
action->user = sqlSession.find<User>().where("username = ?").bind(app->currentUser.username);
|
||||||
|
action->datetime = Wt::WDateTime::currentDateTime();
|
||||||
|
sqlSession.add(action);
|
||||||
|
loginTransaction.commit();
|
||||||
}
|
}
|
||||||
//If credentials don't match, reject user with message saying crednetials are wrong and they can ask an admin to make them an account.
|
//If credentials don't match, reject user with message saying crednetials are wrong and they can ask an admin to make them an account.
|
||||||
else
|
else
|
||||||
|
|||||||
Reference in New Issue
Block a user