A user_handler implementation to link the server with a phpbb3 forum. More...
#include <forum_user_handler.hpp>
Public Member Functions | |
fuh (const config &c) | |
~fuh () | |
void | add_user (const std::string &name, const std::string &mail, const std::string &password) |
Adds a user. More... | |
void | remove_user (const std::string &name) |
Removes a user. More... | |
void | clean_up () |
Called by the server once a day. More... | |
bool | login (const std::string &name, const std::string &password, const std::string &seed) |
Return true if the given password matches the password for the given user. More... | |
std::string | create_pepper (const std::string &name) |
Needed because the hashing algorithm used by phpbb requires some info from the original hash to recreate the same hash. More... | |
void | user_logged_in (const std::string &name) |
Executed when the user with the given name logged in. More... | |
bool | user_exists (const std::string &name) |
Returns true if a user with the given name exists. More... | |
bool | user_is_active (const std::string &name) |
Returns true if the specified user account is usable for logins. More... | |
bool | user_is_moderator (const std::string &name) |
Returns true if this user is a moderator on this server. More... | |
void | set_is_moderator (const std::string &name, const bool &is_moderator) |
Mark this user as a moderator. More... | |
void | password_reminder (const std::string &name) |
Send a password reminder email to the given user. More... | |
std::string | user_info (const std::string &name) |
Returns a string containing info like the last login of this user. More... | |
void | set_user_detail (const std::string &user, const std::string &detail, const std::string &value) |
Set data for a given user name. More... | |
std::string | get_valid_details () |
List of details that can be set for this user_handler. More... | |
bool | use_phpbb_encryption () const |
Does this user_handler want passwords passed encrypted using phpbb's algorithm? More... | |
![]() | |
user_handler () | |
virtual | ~user_handler () |
void | init_mailer (const config &c) |
Initiate the mailer object. More... | |
std::string | create_salt (int length=8) |
Create a random string of digits for password encryption. More... | |
Private Types | |
typedef std::unique_ptr < MYSQL_RES, decltype(&mysql_free_result)> | mysql_result |
Private Member Functions | |
std::string | get_hash (const std::string &user) |
std::string | get_mail (const std::string &user) |
Used in send_mail(). More... | |
time_t | get_lastlogin (const std::string &user) |
time_t | get_registrationdate (const std::string &user) |
bool | is_inactive (const std::string &user) |
void | set_lastlogin (const std::string &user, const time_t &lastlogin) |
mysql_result | db_query (const std::string &query) |
std::string | db_query_to_string (const std::string &query) |
std::string | get_detail_for_user (const std::string &name, const std::string &detail) |
std::string | get_writable_detail_for_user (const std::string &name, const std::string &detail) |
void | write_detail (const std::string &name, const std::string &detail, const std::string &value) |
bool | extra_row_exists (const std::string &name) |
Private Attributes | |
std::string | db_name_ |
std::string | db_host_ |
std::string | db_user_ |
std::string | db_password_ |
std::string | db_users_table_ |
std::string | db_extra_table_ |
MYSQL * | conn |
Additional Inherited Members | |
![]() | |
bool | send_mail (const std::string &to_user, const std::string &subject, const std::string &message) |
Sends an email to the specified address. More... | |
A user_handler implementation to link the server with a phpbb3 forum.
Definition at line 40 of file forum_user_handler.hpp.
|
private |
Definition at line 97 of file forum_user_handler.hpp.
fuh::fuh | ( | const config & | c | ) |
fuh::~fuh | ( | ) |
|
virtual |
Adds a user.
Throws an error containing the error message if adding fails (e.g. because a user with the same name already exists).
Implements user_handler.
|
inlinevirtual |
Called by the server once a day.
Could for example be used for removing users that have not logged in for a certain amount of time.
Implements user_handler.
Definition at line 51 of file forum_user_handler.hpp.
|
virtual |
Needed because the hashing algorithm used by phpbb requires some info from the original hash to recreate the same hash.
Return an empty string if an error occurs
Implements user_handler.
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
privatevirtual |
|
private |
|
virtual |
List of details that can be set for this user_handler.
Implements user_handler.
|
private |
|
private |
|
virtual |
Return true if the given password matches the password for the given user.
Password could also be a hash Seed is not needed for clear text log ins Currently the login procedure in the server and client code is hardcoded for the forum_user_handler implementation
Implements user_handler.
|
virtual |
Send a password reminder email to the given user.
Should throw user_handler::error if sending fails (e.g. because we cannot send email).
Implements user_handler.
|
virtual |
Removes a user.
Throws an error containing the error message if removing fails (e.g. no user with the given name exists).
Implements user_handler.
|
virtual |
Mark this user as a moderator.
Implements user_handler.
|
private |
|
virtual |
|
inlinevirtual |
Does this user_handler want passwords passed encrypted using phpbb's algorithm?
Let it return true if it does and false if it does not.
Implements user_handler.
Definition at line 82 of file forum_user_handler.hpp.
|
virtual |
Returns true if a user with the given name exists.
Implements user_handler.
|
virtual |
Returns a string containing info like the last login of this user.
Formatted for user readable output.
Implements user_handler.
|
virtual |
Returns true if the specified user account is usable for logins.
Implements user_handler.
|
virtual |
Returns true if this user is a moderator on this server.
Implements user_handler.
|
virtual |
Executed when the user with the given name logged in.
Implements user_handler.
|
private |
|
private |
Definition at line 104 of file forum_user_handler.hpp.
|
private |
Definition at line 95 of file forum_user_handler.hpp.
|
private |
Definition at line 95 of file forum_user_handler.hpp.
|
private |
Definition at line 95 of file forum_user_handler.hpp.
|
private |
Definition at line 95 of file forum_user_handler.hpp.
|
private |
Definition at line 95 of file forum_user_handler.hpp.
|
private |
Definition at line 95 of file forum_user_handler.hpp.