Account Namespace
Sign in with a username and password. Optional emailed codes, password reset, and adding keys to an account.
Use this when
- Your users make their own username and password and keep one account for as long as they use your app. Use
Login. - Customers add time later by entering a new key. Use
Redeem. The days, level and entitlements stack on the account. - Customers only type a key? Use License instead.
Sign in
Login returns a result, not true or false. Read status first. Ok means you are signed in. NeedsVerification means an 8-digit code was emailed: ask the user for it, then call SubmitVerification(code).
auto r = Atlas::Account::Login("marcus.reyes", "Wp7#kLm2vQ"); if (r.status == Atlas::Account::LoginResult::Status::Ok) { // r.expiry, r.level, r.note populated. Session is live.}else if (r.status == Atlas::Account::LoginResult::Status::NeedsVerification) { // r.masked_email, r.sign_in_ip, r.sign_in_country populated. Atlas::Account::SubmitVerification(code); // 8-digit code from email}// One call - collects creds, opens verify dialog if the server asks,// opens the confirm-email dialog if needed. Same protocol, zero UI code.bool authed = Atlas::Account::Dialog::Login();| Field | Type | Description | Populated when |
|---|---|---|---|
status | Status | Sign-in outcome. Branch on this before reading any other field. | always |
user_id | int | Numeric row id assigned by the auth server. | Ok only |
expiry | string | A DD-MM-YYYY date. When there is no expiry: "" in C++, "Never" in JS and Python (the same string as GetExpiry()). | Ok only |
level | int | Access level for the signed-in user. | Ok only |
note | string | Admin-set note. When there is none: "" in C++, "None" in JS and Python (the same string as GetNote()). | Ok only |
masked_email | string | e.g. "m***[email protected]" - for the "we sent a code to X" UI. | NeedsVerification only |
sign_in_ip | string | IP the server saw for the sign-in attempt. | NeedsVerification only |
sign_in_country | string | ISO-2 country code. | NeedsVerification only |
error_message | string | Human-readable reason. Populated on any non-Ok status. | non-Ok |
Status values
| Status | C++ | JS | Python | Meaning | What to do |
|---|---|---|---|---|---|
| Ok | Status::Ok | 'Ok' | Status.Ok | Signed in. Session is live. | Continue to your application's main flow. |
| WrongCredentials | Status::WrongCredentials | 'WrongCredentials' | Status.WrongCredentials | Unknown username/password. | Show the error message; let the user retry or contact support. |
| NeedsVerification | Status::NeedsVerification | 'NeedsVerification' | Status.NeedsVerification | Server emailed an 8-digit code. masked_email, sign_in_ip, sign_in_country populated. | Show the code-entry UI and call SubmitVerification. |
| Banned | Status::Banned | 'Banned' | Status.Banned | Account is banned. | Show the error message. The ban lifts when it expires or you remove it under Bans in the dashboard. |
| AccountPaused | Status::AccountPaused | 'AccountPaused' | Status.AccountPaused | Account is paused by the seller. | Show the error message. The seller resumes the account from the dashboard. |
| ServerUnreachable | Status::ServerUnreachable | 'ServerUnreachable' | Status.ServerUnreachable | TCP/handshake failed. JS and Python return this from releases after 1.0.3; on 1.0.3 and earlier a network failure arrives as WrongCredentials with the cause in error_message. | Transient. Back off and retry. Do not show a fatal dialog. |
| Error | Status::Error | 'Error' | Status.Error | Generic catch-all. | Inspect Data::GetErrorMessage(); show the user and offer a retry path. |
Verification challenge
The code is 8 digits, single-use, bound to the IP and masked email that triggered the challenge. The server rate-limits ResendVerification to one code per 60 s.
SubmitVerification(code)- finish the pending sign-in. Returnstrueon success.ResendVerification()- ask the server to email a new code. 60 s server-side cooldown.
Register
Email is optional - but required for password reset. If supplied, the account stays unverified until ConfirmEmail succeeds. Register does not sign in. Usernames and emails are unique per app, ignoring case.
// Create an account. Does NOT sign in.if (!Atlas::Account::Register("marcus.reyes", "Wp7#kLm2vQ", "[email protected]")) { std::cout << Atlas::Data::GetErrorMessage(); return 1;} // If email was supplied, the SDK is holding a confirm challenge.// HasPendingEmailConfirm() returns true until ConfirmEmail() succeeds.if (Atlas::Account::HasPendingEmailConfirm()) { Atlas::Account::ConfirmEmail(code); // 8-digit code from email}Email confirm (post-Register)
After Register(u, p, email) the SDK holds a separate confirm challenge, consumed by ConfirmEmail(code). HasPendingEmailConfirm() returns true until it succeeds.
Password reset
Two calls. RequestPasswordReset(identifier) asks the server to email an 8-digit code - identifier can be the username or the email. CompletePasswordReset(code, new_password) finishes.
// identifier = username OR email. Server always returns OK// (anti-enumeration - never leaks whether the identifier matched).Atlas::Account::RequestPasswordReset("marcus.reyes"); // User reads the 8-digit code from email.bool ok = Atlas::Account::CompletePasswordReset(code, "new-password");// true when the password was changed. Sign in with the new password.RequestPasswordReset returns true whether or not the identifier matches a real user. Anti-enumeration - the server never leaks whether it matched. It returns false only when the request itself fails (SDK not started, server unreachable).
Redeem a license key
Adds a license key to the signed-in account and uses the key up. Three things move across: its days are added to the account's expiry, its level replaces the account's if it is higher, and its entitlements are added (credits add to what the account holds, a feature keeps the later expiry, and a grant with a duration starts counting at redemption; releases after 1.0.3). It returns false if the key is unknown, paused, already used or has no days: read GetErrorMessage(). Customers who sign in with a license key never redeem. They use the new key.
// After Login, apply a license key to the account.if (Atlas::Account::Redeem("ATLAS-A9F2K-4RMXM")) { // The key's days were added to the expiry; level raised if the key's tier is higher.}Sign-in windows (C++ only)
The C++ library can show these windows for you. Each call blocks until the user closes it. JavaScript and Python have none: draw your own form and call the functions above.
Atlas::Account::Dialog::Login()- full flow: creds dialog → sign in → verify dialog if needed.Atlas::Account::Dialog::Login(u, p)- creds pre-collected; opens verify dialog if the server requires it.Atlas::Account::Dialog::Register()- register dialog → create account. Opens the confirm-code dialog automatically when an email was supplied.Atlas::Account::Dialog::VerifyCode()- 8-digit code dialog for the pending sign-in verify challenge.Atlas::Account::Dialog::ConfirmEmail()- 8-digit code dialog for the pending registration email-confirm.Atlas::Account::Dialog::ResetPassword()- full password-reset flow: request-code → email → complete-reset dialogs.