summaryrefslogtreecommitdiff
path: root/src/account.cpp
diff options
context:
space:
mode:
authorHuynh Tran <nthuynh75@gmail.com>2005-06-27 15:41:00 +0000
committerHuynh Tran <nthuynh75@gmail.com>2005-06-27 15:41:00 +0000
commita78e59b9f2fb4eb7971eb5f46637df80157d787a (patch)
tree24e94f377228d9cfaeb5d487031bcdc326bb7c68 /src/account.cpp
parentbfcc4c6858238f343508b53f7fe90b9e9ac0ed01 (diff)
downloadmanaserv-a78e59b9f2fb4eb7971eb5f46637df80157d787a.tar.gz
manaserv-a78e59b9f2fb4eb7971eb5f46637df80157d787a.tar.bz2
manaserv-a78e59b9f2fb4eb7971eb5f46637df80157d787a.tar.xz
manaserv-a78e59b9f2fb4eb7971eb5f46637df80157d787a.zip
Implemented addAccount() (+ unit tests).
Diffstat (limited to 'src/account.cpp')
-rw-r--r--src/account.cpp44
1 files changed, 35 insertions, 9 deletions
diff --git a/src/account.cpp b/src/account.cpp
index 7fd8f778..ed2c358e 100644
--- a/src/account.cpp
+++ b/src/account.cpp
@@ -32,10 +32,16 @@ namespace tmwserv
/**
- * Default constructor.
+ * Constructor with initial account info.
*/
-Account::Account(void)
- throw()
+Account::Account(const std::string& name,
+ const std::string& password,
+ const std::string& email)
+ : mName(name),
+ mPassword(password),
+ mEmail(email),
+ mCharacters(),
+ mLevel(AL_NORMAL)
{
// NOOP
}
@@ -49,11 +55,12 @@ Account::Account(const std::string& name,
const std::string& email,
const Beings& characters)
: mName(name),
+ mPassword(password),
mEmail(email),
- mCharacters(characters)
+ mCharacters(characters),
+ mLevel(AL_NORMAL)
{
- // password must be encrypted.
- setPassword(password);
+ // NOOP
}
@@ -104,15 +111,14 @@ Account::getName(void) const
void
Account::setPassword(const std::string& password)
{
- // use MD5 digest algorithm to cipher the password.
- mPassword = utils::Cipher::instance().md5(password);
+ mPassword = password;
}
/**
* Get the user password.
*/
-const std::string&
+const std::string
Account::getPassword(void) const
{
return mPassword;
@@ -141,6 +147,26 @@ Account::getEmail(void) const
/**
+ * Set the account level.
+ */
+void
+Account::setLevel(const AccountLevels level)
+{
+ mLevel = level;
+}
+
+
+/**
+ * Get the account level.
+ */
+AccountLevels
+Account::getLevel(void) const
+{
+ return mLevel;
+}
+
+
+/**
* Set the characters.
*/
void