logging in in the save preview will update the login button on the main screen

This commit is contained in:
jacob1 2013-07-18 16:33:59 -04:00
parent fe78593ca2
commit aa59c89fa2
4 changed files with 3 additions and 24 deletions

View File

@ -1273,7 +1273,6 @@ RequestBroker::Request * Client::GetUserInfoAsync(std::string username)
LoginStatus Client::Login(std::string username, std::string password, User & user) LoginStatus Client::Login(std::string username, std::string password, User & user)
{ {
lastError = ""; lastError = "";
std::stringstream urlStream;
std::stringstream hashStream; std::stringstream hashStream;
char passwordHash[33]; char passwordHash[33];
char totalHash[33]; char totalHash[33];
@ -1296,7 +1295,6 @@ LoginStatus Client::Login(std::string username, std::string password, User & use
char * postDatas[] = { (char*)username.c_str(), totalHash }; char * postDatas[] = { (char*)username.c_str(), totalHash };
int postLengths[] = { username.length(), 32 }; int postLengths[] = { username.length(), 32 };
data = http_multipart_post("http://" SERVER "/Login.json", postNames, postDatas, postLengths, NULL, NULL, NULL, &dataStatus, &dataLength); data = http_multipart_post("http://" SERVER "/Login.json", postNames, postDatas, postLengths, NULL, NULL, NULL, &dataStatus, &dataLength);
//data = http_auth_get("http://" SERVER "/Login.json", (char*)username.c_str(), (char*)password.c_str(), NULL, &dataStatus, &dataLength);
if(dataStatus == 200 && data) if(dataStatus == 200 && data)
{ {
try try
@ -1355,9 +1353,7 @@ LoginStatus Client::Login(std::string username, std::string password, User & use
lastError = http_ret_text(dataStatus); lastError = http_ret_text(dataStatus);
} }
if(data) if(data)
{
free(data); free(data);
}
return LoginError; return LoginError;
} }

View File

@ -79,18 +79,6 @@ public:
} }
}; };
class GameController::RenderCallback: public ControllerCallback
{
GameController * cc;
public:
RenderCallback(GameController * cc_) { cc = cc_; }
virtual void ControllerExit()
{
//cc->gameModel->SetUser(cc->loginWindow->GetUser());
}
};
class GameController::OptionsCallback: public ControllerCallback class GameController::OptionsCallback: public ControllerCallback
{ {
GameController * cc; GameController * cc;
@ -99,7 +87,6 @@ public:
virtual void ControllerExit() virtual void ControllerExit()
{ {
cc->gameModel->UpdateQuickOptions(); cc->gameModel->UpdateQuickOptions();
//cc->gameModel->SetUser(cc->loginWindow->GetUser());
} }
}; };
@ -1219,7 +1206,7 @@ void GameController::HideConsole()
void GameController::OpenRenderOptions() void GameController::OpenRenderOptions()
{ {
renderOptions = new RenderController(gameModel->GetRenderer(), new RenderCallback(this)); renderOptions = new RenderController(gameModel->GetRenderer(), NULL);
ui::Engine::Ref().ShowWindow(renderOptions->GetView()); ui::Engine::Ref().ShowWindow(renderOptions->GetView());
} }
@ -1230,7 +1217,7 @@ void GameController::OpenSaveWindow()
GameController * c; GameController * c;
public: public:
SaveUploadedCallback(GameController * _c): c(_c) {} SaveUploadedCallback(GameController * _c): c(_c) {}
virtual ~SaveUploadedCallback() {}; virtual ~SaveUploadedCallback() {}
virtual void SaveUploaded(SaveInfo save) virtual void SaveUploaded(SaveInfo save)
{ {
save.SetVote(1); save.SetVote(1);

View File

@ -47,7 +47,6 @@ private:
public: public:
bool HasDone; bool HasDone;
class SearchCallback; class SearchCallback;
class RenderCallback;
class SSaveCallback; class SSaveCallback;
class TagsCallback; class TagsCallback;
class StampsCallback; class StampsCallback;

View File

@ -31,12 +31,9 @@ void LoginController::Exit()
{ {
ui::Engine::Ref().CloseWindow(); ui::Engine::Ref().CloseWindow();
} }
Client::Ref().SetAuthUser(loginModel->GetUser());
if(callback) if(callback)
callback->ControllerExit(); callback->ControllerExit();
else
{
Client::Ref().SetAuthUser(loginModel->GetUser());
}
HasExited = true; HasExited = true;
} }