UI/UX: Add success dialog for password change
This brings the UX more in line with password recovery and email change
This commit is contained in:
parent
4932a60a9b
commit
1ff8b0fc9c
@ -1,7 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<stkgui>
|
<stkgui>
|
||||||
<div x="2%" y="5%" width="96%" height="90%" layout="vertical-row" >
|
<div x="2%" y="5%" width="96%" height="90%" layout="vertical-row" >
|
||||||
|
|
||||||
<header id="title" width="100%" height="fit" text_align="center" word_wrap="true"
|
<header id="title" width="100%" height="fit" text_align="center" word_wrap="true"
|
||||||
I18N="In the change password dialog" text="Password Change"/>
|
I18N="In the change password dialog" text="Password Change"/>
|
||||||
|
|
||||||
@ -30,15 +29,16 @@
|
|||||||
|
|
||||||
<spacer height="2%" width="50"/>
|
<spacer height="2%" width="50"/>
|
||||||
|
|
||||||
<label id="info" proportion="1" width="90%" align="center" text_align="center" word_wrap="true" text=""/>
|
<label id="info" proportion="1" width="90%" align="center" text_align="center" word_wrap="true"
|
||||||
|
I18N="In the change password dialog" text=""/>
|
||||||
|
|
||||||
<spacer height="2%" width="50"/>
|
<spacer height="2%" width="50"/>
|
||||||
|
|
||||||
<buttonbar id="options" width="90%" height="16%" align="center">
|
<buttonbar id="options" width="90%" height="16%" align="center">
|
||||||
<icon-button id="cancel" width="64" height="64" icon="gui/icons/red_x.png"
|
<icon-button id="cancel" width="64" height="64" icon="gui/icons/red_x.png"
|
||||||
I18N="In the change password dialog" text="Close" label_location="bottom"/>
|
I18N="In the change password dialog" text="Cancel" label_location="bottom"/>
|
||||||
<icon-button id="submit" width="64" height="64" icon="gui/icons/green_check.png"
|
<icon-button id="submit" width="64" height="64" icon="gui/icons/green_check.png"
|
||||||
I18N="In the change password dialog" text="Submit" label_location="bottom"/>
|
I18N="In the change password dialog" text="Submit" label_location="bottom"/>
|
||||||
</buttonbar>
|
</buttonbar>
|
||||||
<spacer height="1f" width="20"/>
|
<spacer height="1f" width="20"/>
|
||||||
</div>
|
</div>
|
||||||
|
@ -2,18 +2,18 @@
|
|||||||
<stkgui>
|
<stkgui>
|
||||||
<div x="2%" y="5%" width="96%" height="90%" layout="vertical-row" >
|
<div x="2%" y="5%" width="96%" height="90%" layout="vertical-row" >
|
||||||
<header id="title" width="96%" height="fit" text_align="center" word_wrap="true"
|
<header id="title" width="96%" height="fit" text_align="center" word_wrap="true"
|
||||||
I18N="In the recovery dialog" text="Account Recovery"/>
|
I18N="In the recovery dialog" text="Account Recovery"/>
|
||||||
|
|
||||||
<spacer height="2%" width="50"/>
|
<spacer height="2%" width="50"/>
|
||||||
|
|
||||||
<label id="info" proportion="1" width="90%" align="center" text_align="center" word_wrap="true" I18N="In the recovery dialog"
|
<label id="info" proportion="1" width="90%" align="center" text_align="center" word_wrap="true" I18N="In the recovery dialog"
|
||||||
text="You will receive an email with further instructions on how to reset your password. Please be patient and be sure to check your spam folder." />
|
text="You will receive an email with further instructions on how to reset your password. Please be patient and be sure to check your spam folder." />
|
||||||
|
|
||||||
<spacer height="2%" width="50"/>
|
<spacer height="2%" width="50"/>
|
||||||
|
|
||||||
<buttonbar id="options" width="25%" height="15%" align="center">
|
<buttonbar id="options" width="25%" height="15%" align="center">
|
||||||
<icon-button id="cancel" width="64" height="64" icon="gui/icons/green_check.png"
|
<icon-button id="cancel" width="64" height="64" icon="gui/icons/green_check.png"
|
||||||
I18N="In the recovery dialog" text="Close" label_location="none"/>
|
I18N="In the recovery dialog" text="Close" label_location="none"/>
|
||||||
</buttonbar>
|
</buttonbar>
|
||||||
<spacer width="20" height="1f" />
|
<spacer width="20" height="1f" />
|
||||||
</div>
|
</div>
|
||||||
|
@ -2,12 +2,12 @@
|
|||||||
<stkgui>
|
<stkgui>
|
||||||
<div x="2%" y="5%" width="96%" height="90%" layout="vertical-row" >
|
<div x="2%" y="5%" width="96%" height="90%" layout="vertical-row" >
|
||||||
<header id="title" width="100%" height="fit" text_align="center" word_wrap="true"
|
<header id="title" width="100%" height="fit" text_align="center" word_wrap="true"
|
||||||
I18N="In the recovery dialog" text="Account Recovery"/>
|
I18N="In the recovery dialog" text="Account Recovery"/>
|
||||||
|
|
||||||
<spacer height="2%" width="50"/>
|
<spacer height="2%" width="50"/>
|
||||||
|
|
||||||
<label id="message" proportion="2" width="90%" align="center" text_align="left" word_wrap="true"
|
<label id="message" proportion="2" width="90%" align="center" text_align="left" word_wrap="true"
|
||||||
text="Fill in the username and email address you supplied at registration to be able to reset your password."/>
|
text="Fill in the username and email address you supplied at registration to be able to reset your password."/>
|
||||||
|
|
||||||
<spacer height="4%" width="50"/>
|
<spacer height="4%" width="50"/>
|
||||||
|
|
||||||
@ -29,15 +29,15 @@
|
|||||||
<spacer height="2%" width="50"/>
|
<spacer height="2%" width="50"/>
|
||||||
|
|
||||||
<label id="info" proportion="1" width="90%" align="center" text_align="center" word_wrap="true"
|
<label id="info" proportion="1" width="90%" align="center" text_align="center" word_wrap="true"
|
||||||
I18N="In the recovery dialog" text=""/>
|
I18N="In the recovery dialog" text=""/>
|
||||||
|
|
||||||
<spacer height="2%" width="50"/>
|
<spacer height="2%" width="50"/>
|
||||||
|
|
||||||
<buttonbar id="options" width="25%" proportion="1" align="center">
|
<buttonbar id="options" width="90%" proportion="1" align="center">
|
||||||
<icon-button id="cancel" width="64" height="64" icon="gui/icons/red_x.png"
|
<icon-button id="cancel" width="64" height="64" icon="gui/icons/red_x.png"
|
||||||
I18N="In the recovery dialog" text="Cancel" label_location="none"/>
|
I18N="In the recovery dialog" text="Cancel" label_location="none"/>
|
||||||
<icon-button id="submit" width="64" height="64" icon="gui/icons/green_check.png"
|
<icon-button id="submit" width="64" height="64" icon="gui/icons/green_check.png"
|
||||||
I18N="In the recovery dialog" text="Submit" label_location="none"/>
|
I18N="In the recovery dialog" text="Submit" label_location="none"/>
|
||||||
</buttonbar>
|
</buttonbar>
|
||||||
<spacer height="1f" width="20"/>
|
<spacer height="1f" width="20"/>
|
||||||
</div>
|
</div>
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
#include "guiengine/engine.hpp"
|
#include "guiengine/engine.hpp"
|
||||||
#include "guiengine/widgets.hpp"
|
#include "guiengine/widgets.hpp"
|
||||||
#include "online/xml_request.hpp"
|
#include "online/xml_request.hpp"
|
||||||
|
#include "states_screens/dialogs/message_dialog.hpp"
|
||||||
#include "states_screens/state_manager.hpp"
|
#include "states_screens/state_manager.hpp"
|
||||||
#include "utils/string_utils.hpp"
|
#include "utils/string_utils.hpp"
|
||||||
#include "utils/translation.hpp"
|
#include "utils/translation.hpp"
|
||||||
@ -42,6 +43,7 @@ using namespace Online;
|
|||||||
ChangePasswordDialog::ChangePasswordDialog() : ModalDialog(0.8f, 0.7f)
|
ChangePasswordDialog::ChangePasswordDialog() : ModalDialog(0.8f, 0.7f)
|
||||||
{
|
{
|
||||||
m_self_destroy = false;
|
m_self_destroy = false;
|
||||||
|
m_show_success_dialog = false;
|
||||||
m_success = false;
|
m_success = false;
|
||||||
|
|
||||||
loadFromFile("online/change_password.stkgui");
|
loadFromFile("online/change_password.stkgui");
|
||||||
@ -115,7 +117,7 @@ void ChangePasswordDialog::changePassword(const stringw ¤t_password,
|
|||||||
request->addParameter("current", current_password);
|
request->addParameter("current", current_password);
|
||||||
|
|
||||||
// The server code expects two passwords (and verifies again that they
|
// The server code expects two passwords (and verifies again that they
|
||||||
// are identical), so send the passwod twice.
|
// are identical), so send the password twice.
|
||||||
request->addParameter("new1", new_password);
|
request->addParameter("new1", new_password);
|
||||||
request->addParameter("new2", new_password);
|
request->addParameter("new2", new_password);
|
||||||
request->queue();
|
request->queue();
|
||||||
@ -207,12 +209,9 @@ bool ChangePasswordDialog::onEscapePressed()
|
|||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
void ChangePasswordDialog::success()
|
void ChangePasswordDialog::success()
|
||||||
{
|
{
|
||||||
m_info_widget->setDefaultColor();
|
// Close this dialog and show success dialog
|
||||||
m_info_widget->setText(_("Password successfully changed."), false);
|
m_self_destroy = true;
|
||||||
m_options_widget->setActive(true);
|
m_show_success_dialog = true;
|
||||||
m_current_password_widget->setText("");
|
|
||||||
m_new_password1_widget->setText("");
|
|
||||||
m_new_password2_widget->setText("");
|
|
||||||
} // success
|
} // success
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
@ -243,4 +242,8 @@ void ChangePasswordDialog::onUpdate(float dt)
|
|||||||
{
|
{
|
||||||
ModalDialog::dismiss();
|
ModalDialog::dismiss();
|
||||||
}
|
}
|
||||||
|
if (m_show_success_dialog)
|
||||||
|
{
|
||||||
|
new MessageDialog(_("Password successfully changed."));
|
||||||
|
}
|
||||||
} // onUpdate
|
} // onUpdate
|
||||||
|
@ -56,6 +56,7 @@ public:
|
|||||||
private:
|
private:
|
||||||
|
|
||||||
bool m_self_destroy;
|
bool m_self_destroy;
|
||||||
|
bool m_show_success_dialog;
|
||||||
bool m_success;
|
bool m_success;
|
||||||
|
|
||||||
GUIEngine::TextBoxWidget * m_current_password_widget;
|
GUIEngine::TextBoxWidget * m_current_password_widget;
|
||||||
|
Loading…
Reference in New Issue
Block a user