update access_time and status on login

This commit is contained in:
TheTrunk 2024-09-20 10:37:10 +07:00
parent c37b2deb54
commit 8b40a76e76
No known key found for this signature in database
GPG key ID: A55DFC7EBF10E737

View file

@ -701,6 +701,17 @@ namespace lws
if (is_hidden(account->first))
return {lws::error::account_not_found};
// Update access time
auto update_result = disk.update_access_time(req.creds.address);
if (!update_result)
return update_result.error();
// Move account state to active
epee::span<const lws::db::account_address> address_span(&req.creds.address, 1);
auto change_status_result = disk.change_status(db::account_status::active, address_span);
if (!change_status_result)
return change_status_result.error();
// Do not count a request for account creation as login
return response{false, bool(account->second.flags & db::account_generated_locally)};
}