Files
DarkflameServer/dDatabase/GameDatabase/ITables/IAccountEmails.h
Aaron Kimbrell e213a7aeff feat: web dashboard and playground work
The NexusDashboard-parity dashboard (dDashboardServer) and everything built on it on the experimental branch:
accounts, characters, properties and moderation tools, permissions shared with in-game slash commands, economy
reports, World 3D and property 3D views with client scenery, scheduled events (features, vanity changes, live
events, announcements, restarts), vanity files and events, the CDClient browser, the message inspector with saved
captures, chat filter tools, community challenges, live ops, the AI moderator helper, and the server-side changes
they need.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 22:30:43 -05:00

40 lines
1.6 KiB
C++

#ifndef __IACCOUNTEMAILS__H__
#define __IACCOUNTEMAILS__H__
#include <cstdint>
#include <optional>
#include <string>
#include <string_view>
// Account email addresses, single-use account tokens (password reset, email verification) and session invalidation
class IAccountEmails {
public:
struct EmailInfo {
std::string email;
bool confirmed{};
};
struct AccountToken {
uint32_t accountId{};
std::string data;
};
virtual std::optional<EmailInfo> GetAccountEmail(const uint32_t accountId) = 0;
virtual void SetAccountEmail(const uint32_t accountId, const std::string_view email, const bool confirmed) = 0;
// Account with this confirmed address (case-insensitive)
virtual std::optional<uint32_t> GetAccountIdByConfirmedEmail(const std::string_view email) = 0;
// Tokens are stored by hash only. Consuming returns and deletes an unexpired token.
virtual void InsertAccountToken(const std::string_view tokenHash, const uint32_t accountId, const std::string_view purpose, const std::string_view data, const int64_t expiresAt) = 0;
virtual std::optional<AccountToken> ConsumeAccountToken(const std::string_view tokenHash, const std::string_view purpose) = 0;
virtual void DeleteAccountTokens(const uint32_t accountId, const std::string_view purpose) = 0;
virtual void DeleteExpiredAccountTokens() = 0;
// Login sessions issued before this unix time are no longer accepted
virtual int64_t GetSessionsValidAfter(const uint32_t accountId) = 0;
virtual void SetSessionsValidAfter(const uint32_t accountId, const int64_t time) = 0;
};
#endif //!__IACCOUNTEMAILS__H__