diff options
author | Yohann Ferreira <bertram@cegetel.net> | 2008-04-18 23:47:23 +0000 |
---|---|---|
committer | Yohann Ferreira <bertram@cegetel.net> | 2008-04-18 23:47:23 +0000 |
commit | f99ed4c4efcaff47c643a2683e489594d759151f (patch) | |
tree | d0df967052ec02460b1132e60b9d8055fe95578f /src | |
parent | 327db845912a5e3857438fc0ad5ed0543f25a79f (diff) | |
download | mana-f99ed4c4efcaff47c643a2683e489594d759151f.tar.gz mana-f99ed4c4efcaff47c643a2683e489594d759151f.tar.bz2 mana-f99ed4c4efcaff47c643a2683e489594d759151f.tar.xz mana-f99ed4c4efcaff47c643a2683e489594d759151f.zip |
Made mislogins and misregistrations a little less annoying for the user.
Diffstat (limited to 'src')
-rw-r--r-- | src/main.cpp | 22 | ||||
-rw-r--r-- | src/main.h | 1 | ||||
-rw-r--r-- | src/net/loginhandler.cpp | 4 |
3 files changed, 18 insertions, 9 deletions
diff --git a/src/main.cpp b/src/main.cpp index 4fc959cf..cc137752 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -502,6 +502,14 @@ namespace { state = STATE_CHAR_SELECT; } } accountListener; + + struct LoginListener : public gcn::ActionListener + { + void action(const gcn::ActionEvent &event) + { + state = STATE_LOGIN; + } + } loginListener; } // TODO Find some nice place for these functions @@ -521,13 +529,6 @@ void accountLogin(LoginData *loginData) // Clear the password, avoids auto login when returning to login loginData->password = ""; - // Remove _M or _F from username after a login for registration purpose - if (loginData->registerLogin) - { - loginData->username = - loginData->username.substr(0, loginData->username.length() - 2); - } - // TODO This is not the best place to save the config, but at least better // than the login gui window if (loginData->remember) @@ -936,6 +937,13 @@ int main(int argc, char *argv[]) accountLogin(&loginData); break; + case STATE_LOGIN_ERROR: + logger->log("State: LOGIN ERROR"); + currentDialog = new OkDialog("Error ", errorMessage); + currentDialog->addActionListener(&loginListener); + currentDialog = NULL; // OkDialog deletes itself + break; + case STATE_SWITCH_ACCOUNTSERVER: logger->log("State: SWITCH_ACCOUNTSERVER"); @@ -75,6 +75,7 @@ enum { STATE_LOADDATA, STATE_LOGIN, STATE_LOGIN_ATTEMPT, + STATE_LOGIN_ERROR, STATE_REGISTER, STATE_REGISTER_ATTEMPT, STATE_ACCOUNTCHANGE_ERROR, diff --git a/src/net/loginhandler.cpp b/src/net/loginhandler.cpp index 349684bf..39b2e194 100644 --- a/src/net/loginhandler.cpp +++ b/src/net/loginhandler.cpp @@ -72,7 +72,7 @@ void LoginHandler::handleMessage(MessageIn &msg) errorMessage = "Unknown error"; break; } - state = STATE_ERROR; + state = STATE_LOGIN_ERROR; } } break; @@ -104,7 +104,7 @@ void LoginHandler::handleMessage(MessageIn &msg) errorMessage = "Unknown error"; break; } - state = STATE_ERROR; + state = STATE_LOGIN_ERROR; } } break; |