Stay signed in works now (with checkbox in sign in dialog.)
git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/branches/uni@13204 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
@@ -14,18 +14,33 @@
|
||||
<div width="80%" align="center" layout="vertical-row" height="fit" >
|
||||
<div width="100%" height="fit" layout="horizontal-row" >
|
||||
<label proportion="1" text_align="left" I18N="In the login dialog" text="Username"/>
|
||||
<textbox proportion="2" id="username" I18N="In the login dialog"/>
|
||||
<div proportion="2" height="100%" layout="horizontal-row">
|
||||
<spacer height="1" width="2%">
|
||||
<textbox proportion="2" id="username" I18N="In the login dialog"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<spacer height="20" width="20">
|
||||
|
||||
<div width="100%" height="fit" layout="horizontal-row" >
|
||||
<label proportion="1" text_align="left" I18N="In the login dialog" text="Password"/>
|
||||
<textbox proportion="2" id="password" I18N="In the login dialog"/>
|
||||
<div proportion="2" height="100%" layout="horizontal-row">
|
||||
<spacer height="1" width="2%">
|
||||
<textbox proportion="2" id="password" I18N="In the login dialog"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<spacer height="20" width="20">
|
||||
|
||||
<div width="100%" height="fit" layout="horizontal-row" >
|
||||
<label proportion="1" text_align="left" I18N="In the login dialog" text="Stay signed in"/>
|
||||
<div proportion="2" height="100%" layout="horizontal-row">
|
||||
<checkbox width="fit" height="fit" id="remember" I18N="In the login dialog"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<spacer height="20" width="50">
|
||||
<spacer height="20" width="50">
|
||||
|
||||
<label id="message" proportion="1" width="90%" align="center" text_align="center" word_wrap="true" text=""/>
|
||||
|
||||
|
||||
@@ -55,13 +55,13 @@ CurrentOnlineUser::CurrentOnlineUser(){
|
||||
// ============================================================================
|
||||
bool CurrentOnlineUser::trySavedSession()
|
||||
{
|
||||
assert(m_is_signed_in == false);
|
||||
if (m_is_signed_in) return true;
|
||||
if(UserConfigParams::m_saved_session)
|
||||
{
|
||||
HTTPConnector * connector = new HTTPConnector((std::string)UserConfigParams::m_server_multiplayer + "client-user.php");
|
||||
connector->setParameter("action",std::string("validate"));
|
||||
connector->setParameter("action",std::string("saved-session"));
|
||||
connector->setParameter("userid", UserConfigParams::m_saved_user);
|
||||
connector->setParameter("token", UserConfigParams::m_saved_token);
|
||||
connector->setParameter("token", UserConfigParams::m_saved_token.c_str());
|
||||
const XMLNode * result = connector->getXMLFromPage();
|
||||
std::string rec_success = "";
|
||||
std::string info;
|
||||
@@ -73,11 +73,12 @@ bool CurrentOnlineUser::trySavedSession()
|
||||
int username_fetched = result->get("username", &m_name);
|
||||
int userid_fetched = result->get("userid", &m_id);
|
||||
assert(token_fetched && username_fetched && userid_fetched);
|
||||
UserConfigParams::m_saved_token = m_token;
|
||||
m_is_signed_in = true;
|
||||
m_is_guest = false;
|
||||
}
|
||||
result->get("info", &info);
|
||||
Log::info("trySavedSession","%s",info);
|
||||
Log::info("trySavedSession","%s",info.c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -36,7 +36,7 @@ using namespace irr::gui;
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
LoginDialog::LoginDialog(const Message message_type) :
|
||||
ModalDialog(0.8f,0.8f)
|
||||
ModalDialog(0.8f,0.9f)
|
||||
{
|
||||
m_self_destroy = false;
|
||||
m_open_registration_dialog = false;
|
||||
@@ -67,6 +67,10 @@ LoginDialog::LoginDialog(const Message message_type) :
|
||||
assert(m_password_widget != NULL);
|
||||
m_password_widget->setPasswordBox(true,L'*');
|
||||
|
||||
m_remember_widget = getWidget<CheckBoxWidget>("remember");
|
||||
assert(m_remember_widget != NULL);
|
||||
m_remember_widget->setState(false);
|
||||
|
||||
m_message_widget = getWidget<LabelWidget>("message");
|
||||
assert(m_message_widget != NULL);
|
||||
|
||||
@@ -82,6 +86,8 @@ LoginDialog::LoginDialog(const Message message_type) :
|
||||
assert(m_as_guest_widget != NULL);
|
||||
m_cancel_widget = getWidget<IconButtonWidget>("cancel");
|
||||
assert(m_cancel_widget != NULL);
|
||||
|
||||
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
@@ -98,7 +104,7 @@ void LoginDialog::login()
|
||||
const stringw username = m_username_widget->getText().trim();
|
||||
const stringw password = m_password_widget->getText().trim();
|
||||
stringw info = "";
|
||||
if(CurrentOnlineUser::get()->signIn(username,password,info))
|
||||
if(CurrentOnlineUser::get()->signIn(username,password, m_remember_widget->getState(),info))
|
||||
{
|
||||
m_self_destroy = true;
|
||||
}
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
|
||||
#include "guiengine/modaldialog.hpp"
|
||||
#include "guiengine/widgets/text_box_widget.hpp"
|
||||
#include "guiengine/widgets/check_box_widget.hpp"
|
||||
#include "guiengine/widgets/icon_button_widget.hpp"
|
||||
#include "guiengine/widgets/ribbon_widget.hpp"
|
||||
#include "guiengine/widgets/label_widget.hpp"
|
||||
@@ -42,6 +43,7 @@ private:
|
||||
GUIEngine::LabelWidget * m_info_widget;
|
||||
GUIEngine::TextBoxWidget * m_username_widget;
|
||||
GUIEngine::TextBoxWidget * m_password_widget;
|
||||
GUIEngine::CheckBoxWidget * m_remember_widget;
|
||||
GUIEngine::LabelWidget * m_message_widget;
|
||||
|
||||
GUIEngine::RibbonWidget * m_options_widget;
|
||||
|
||||
@@ -52,6 +52,7 @@ DEFINE_SCREEN_SINGLETON( OnlineScreen );
|
||||
OnlineScreen::OnlineScreen() : Screen("online/main.stkgui")
|
||||
{
|
||||
m_recorded_state = Not;
|
||||
CurrentOnlineUser::get()->trySavedSession();
|
||||
} // OnlineScreen
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
@@ -106,7 +107,6 @@ void OnlineScreen::beforeAddingWidget()
|
||||
//Set everything that could be set invisible or deactivated, to active and visible
|
||||
m_bottom_menu_widget->setVisible(true);
|
||||
m_top_menu_widget->setVisible(true);
|
||||
|
||||
hasStateChanged();
|
||||
if (m_recorded_state == Registered)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user