#include <Session.h>
Definition at line 25 of file Session.h.
◆ Session()
Definition at line 98 of file Session.C.
100 auto sqlite3 = cpp14::make_unique<Dbo::backend::Sqlite3>(WApplication::instance()->appRoot() +
"hangman.db");
101 sqlite3->setProperty(
"show-queries",
"true");
119 guestUser.
addIdentity(Auth::Identity::LoginName,
"guest");
120 myPasswordService.updatePassword(guestUser,
"guest");
122 log(
"info") <<
"Database created";
124 log(
"info") <<
"Using existing database";
127 transaction.commit();
◆ ~Session()
◆ addToScore()
void Session::addToScore |
( |
int |
s | ) |
|
Definition at line 158 of file Session.C.
165 ++u.
modify()->gamesPlayed;
166 u.
modify()->lastGame = WDateTime::currentDateTime();
169 transaction.commit();
◆ auth()
Definition at line 215 of file Session.C.
217 return myAuthService;
◆ configureAuth()
void Session::configureAuth |
( |
| ) |
|
|
static |
Definition at line 75 of file Session.C.
77 myAuthService.setAuthTokensEnabled(
true,
"hangmancookie");
78 myAuthService.setEmailVerificationEnabled(
true);
80 std::unique_ptr<Auth::PasswordVerifier> verifier
81 = cpp14::make_unique<Auth::PasswordVerifier>();
82 verifier->addHashFunction(cpp14::make_unique<Auth::BCryptHashFunction>(7));
87 verifier->addHashFunction(cpp14::make_unique<UnixCryptHashFunction>());
90 myPasswordService.setVerifier(std::move(verifier));
91 myPasswordService.setStrengthValidator(cpp14::make_unique<Auth::PasswordStrengthValidator>());
92 myPasswordService.setAttemptThrottlingEnabled(
true);
94 if (Auth::GoogleService::configured())
◆ findRanking()
int Session::findRanking |
( |
| ) |
|
Definition at line 194 of file Session.C.
202 ranking =
session_.
query<
int>(
"select distinct count(score) from user")
203 .where(
"score > ?").bind(u->score);
205 transaction.commit();
◆ login()
◆ oAuth()
Definition at line 225 of file Session.C.
227 return myOAuthServices;
◆ passwordAuth()
Definition at line 220 of file Session.C.
222 return myPasswordService;
◆ topUsers()
std::vector< User > Session::topUsers |
( |
int |
limit | ) |
|
Definition at line 172 of file Session.C.
178 std::vector<User> result;
181 result.push_back(*
user);
184 std::string name =
auth->identity(Auth::Identity::LoginName).toUTF8();
186 result.back().name = name;
189 transaction.commit();
◆ user()
◆ userName()
std::string Session::userName |
( |
| ) |
const |
Definition at line 150 of file Session.C.
155 return std::string();
◆ users()
◆ login_
◆ session_
◆ users_
The documentation for this class was generated from the following files:
- /builddir/build/BUILD/wt-4.3.0/examples/hangman/Session.h
- /builddir/build/BUILD/wt-4.3.0/examples/hangman/Session.C