Public Member Functions | Public Attributes | Private Attributes

User Class Reference

#include <User.h>

Inheritance diagram for User:
Inheritance graph
[legend]

List of all members.

Public Member Functions

template<class Action >
void persist (Action &a)
 User ()
void setPassword (const std::string &password)
bool authenticate (const std::string &password) const
 User (const std::string &name, const std::string &password)

Public Attributes

std::string name
int gamesPlayed
long long score
Wt::WDateTime lastLogin

Private Attributes

std::string password_

Detailed Description

Definition at line 17 of file User.h.


Constructor & Destructor Documentation

User::User (  ) [inline]

Definition at line 34 of file User.h.

{}
User::User ( const std::string &  name,
const std::string &  password 
)

Definition at line 48 of file User.C.

  : name(name),
    gamesPlayed(0),
    score(0)
{ 
  setPassword(password);
}

Member Function Documentation

bool User::authenticate ( const std::string &  password ) const

Definition at line 67 of file User.C.

{
#ifdef HAVE_CRYPT
  return md5(password, password_) == password_;
#else
  return password_ == password;
#endif
}
template<class Action >
void User::persist ( Action &  a ) [inline]

Definition at line 25 of file User.h.

  {
    Wt::Dbo::field(a, name,        "name");
    Wt::Dbo::field(a, password_,   "password");
    Wt::Dbo::field(a, gamesPlayed, "gamesPlayed");
    Wt::Dbo::field(a, score,       "score");
    Wt::Dbo::field(a, lastLogin,   "lastLogin");
  }
void User::setPassword ( const std::string &  password )

Definition at line 57 of file User.C.

{
#ifdef HAVE_CRYPT
  password_ = md5(password, generateSalt());
#else
  // This should not be used in production...
  password_ = password;
#endif
}

Member Data Documentation

Definition at line 20 of file User.h.

Definition at line 22 of file User.h.

std::string User::name

Definition at line 19 of file User.h.

std::string User::password_ [private]

Definition at line 42 of file User.h.

long long User::score

Definition at line 21 of file User.h.


The documentation for this class was generated from the following files:

Generated on Fri Sep 23 2011 for the C++ Web Toolkit (Wt) by doxygen 1.7.2