Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- struct AuthenticationBackend {
- virtual User Authenticate(const std::string& user, const std:string& pass) = 0;
- }
- struct MySQLAuthenticationBackend {
- virtual User* Authenticate(const std::string& userName, const std:string& pass)
- {
- Result result = externalDBConnection->Query("SELECT user, pass FROM accounts WHERE user=? AND pass=HASH(?)", userName, pass);
- if (result->Size() == 1)
- {
- if (psEngine->HasUser(userName))
- {
- return psEngine->GetUser(userName);
- }
- else
- {
- return psEngine->CreateUser(userName, pass);
- }
- }
- return 0;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement