World of Hello
Static Public Member Functions | List of all members
account Class Reference

the user (client) account. More...

#include <account.h>

Static Public Member Functions

static bool isVerified ()
 determine if the user has logged in. More...
 
static account login (string account, string password, function func=null,...)
 log into an account using a password. More...
 
static account create (string account, string email, function func=null,...)
 create an account. More...
 
static account updatePassword (string account, string oldPassword, string newPassword)
 updates the password of the given account. More...
 
static account forgotPassword (string account, string email)
 generates a new password for the given account. More...
 
static account getEmail (string account="")
 gets the email of an account. More...
 

Detailed Description

the user (client) account.

   This class can be used for checking account information
   as well as logging in and creating a new account.

Member Function Documentation

◆ create()

static account account::create ( string  account,
string  email,
function  func = null,
  ... 
)
static

create an account.

  Create an account through the server using an account name and password.
  A server command "loginFailed" will be raised if there is a login error.\n
  WARNING: By using this function, users will be aware of a potentially insecure action.
Parameters
Thenew account name.
Thenew account email.
(optional)The function to trigger with the server response.
(optional)Any number of values to pass to the function, func, when invoked.
Returns
Returns itself.

◆ forgotPassword()

static account account::forgotPassword ( string  account,
string  email 
)
static

generates a new password for the given account.

   Creates a new, random, email for the given account if the account exists and matches the given email.
   Emails the user with the newly created password.
Parameters
Theaccount name.
Theemail of the account.
Returns
Returns itself.

◆ getEmail()

static account account::getEmail ( string  account = "")
static

gets the email of an account.

   Gets the email of the given account.\n
   WARNING: does not return the email. Instead, a server command starting with "getEmail" is caught.\n
   A server command of " getEmail"ERROR" " will be raised if there is an error trying to receive the email.
Parameters
(optional)The account to get the email of. If no account given, defaults to the logged in user.
Returns
Returns itself.

◆ isVerified()

static bool account::isVerified ( )
static

determine if the user has logged in.

  Check if the user has logged into a verified account.
Returns
true if the user has logged in through the server, otherwise false.

◆ login()

static account account::login ( string  account,
string  password,
function  func = null,
  ... 
)
static

log into an account using a password.

  Log the user into an account using an account name and password.
  The given function, func, is then triggered as an Event.Server.onCommand event and passed any additional arguments given.
Parameters
Theuser's account name.
Theuser's password.
(optional)The function to trigger with the server response.
(optional)Any number of values to pass to the function, func, when invoked.
Returns
Returns itself.

◆ updatePassword()

static account account::updatePassword ( string  account,
string  oldPassword,
string  newPassword 
)
static

updates the password of the given account.

   Updates the password of an account, given an old password and a new password.
   A server command "updatePassword" will be raised with "success" if the new password was successfully created.
   Otherwise, it will be raised with some detailed error.\n
   WARNING: By using this function, users will be aware of a potentially insecure action.
Parameters
Theaccount name to update the password.
Theold password of the given account.
Thenew password to the given account.
Returns
Returns itself.