110 lines
No EOL
3.6 KiB
Text
110 lines
No EOL
3.6 KiB
Text
// ================================================================================
|
|
// Change Password dialog
|
|
// ================================================================================
|
|
_dialog( ChangePassword, localize( "guis/mainmenu/changepassword" ), _center( desktop, width ), _center( desktop, height ), 220, 118, "noMove", "dim" )
|
|
_input_dialog( changePassword )
|
|
_on_default( Account_ChangePassword_Ok, Account_ChangePassword_Cancel )
|
|
|
|
events {
|
|
onNamedEvent "onShow" {
|
|
callSuper();
|
|
setTabStop( 0 );
|
|
}
|
|
onPropertyChanged "gui.onConnectionLost" {
|
|
if( visible ) {
|
|
_close_input
|
|
}
|
|
}
|
|
}
|
|
|
|
_edit( Account_ChangePassword_Password, _right( dlgChangePassword ), _top( dlgChangePassword ), 100, BUTTON_HEIGHT )
|
|
_clear_on_show
|
|
_draw_right_edit_label( localize( "guis/mainmenu/password" ), COLOR_TEXT, 100 )
|
|
properties {
|
|
float password = 1;
|
|
float maxTextLength = 20;
|
|
}
|
|
_end_edit
|
|
|
|
_edit( account_ChangePassword_NewPassword, _right( dlgChangePassword ), _to_bottom_of( edtAccount_ChangePassword_Password ) + 3, 100, BUTTON_HEIGHT )
|
|
_clear_on_show
|
|
_draw_right_edit_label( localize( "guis/mainmenu/newpassword" ), COLOR_TEXT, 100 )
|
|
properties {
|
|
float password = 1;
|
|
float maxTextLength = 20;
|
|
}
|
|
_end_edit
|
|
|
|
_edit( account_ChangePassword_ConfirmPassword, _right( dlgChangePassword ), _to_bottom_of( edtAccount_ChangePassword_NewPassword ) + 3, 100, BUTTON_HEIGHT )
|
|
_clear_on_show
|
|
_draw_right_edit_label( localize( "guis/mainmenu/confirmpassword" ), COLOR_TEXT, 100 )
|
|
properties {
|
|
float password = 1;
|
|
float maxTextLength = 20;
|
|
}
|
|
_end_edit
|
|
|
|
_button( account_ChangePassword_Ok, _to_left_of( btnAccount_ChangePassword_Cancel ) - 6, _bottom( dlgChangePassword ), BUTTON_WIDTH, BUTTON_HEIGHT )
|
|
properties {
|
|
handle localizedText = localize( "guis/mainmenu/ok" );
|
|
float taskActive = 0;
|
|
}
|
|
_button_action(
|
|
// validation
|
|
if ( compare( gui.edtAccount_ChangePassword_NewPassword.editText, "" ) ) {
|
|
_setup_confirmation_ok_error( localize( "guis/mainmenu/blankpassword" ) )
|
|
_show_popup( confirmation )
|
|
|
|
return;
|
|
}
|
|
if ( compare( gui.edtAccount_ChangePassword_NewPassword.editText, gui.edtAccount_ChangePassword_ConfirmPassword.editText ) == 0 ) {
|
|
_setup_confirmation_ok_error( localize( "guis/mainmenu/confirmpasswordmismatch" ) )
|
|
_show_popup( confirmation )
|
|
return;
|
|
}
|
|
|
|
// finish the process
|
|
taskActive = 1;
|
|
_show_popup( sdNetProgress );
|
|
|
|
sdnet.accountChangePassword( gui.edtAccount_ChangePassword_Password.editText, gui.edtAccount_ChangePassword_NewPassword.editText );
|
|
)
|
|
events {
|
|
onPropertyChanged "sdnet.taskActive" {
|
|
if ( sdnet.taskActive == 0 ) {
|
|
if ( taskActive == 1 ) {
|
|
taskActive = 0;
|
|
|
|
// process result
|
|
if ( sdnet.taskErrorCode == SDNET_NO_ERROR ) {
|
|
sdnet.accountSetPassword( gui.edtAccount_ChangePassword_NewPassword.editText );
|
|
_close_input
|
|
return;
|
|
}
|
|
|
|
// process error
|
|
_setup_confirmation_ok_error( sdnet.taskResultMessage );
|
|
_show_popup( confirmation )
|
|
|
|
return;
|
|
}
|
|
}
|
|
}
|
|
onPropertyChanged "gui.onConnectionLost" {
|
|
if ( taskActive > 0 ) {
|
|
taskActive = 0;
|
|
}
|
|
if ( gui.dlgChangePassword.visible > 0 ) {
|
|
_show_single_dialog( gameSettings )
|
|
}
|
|
}
|
|
}
|
|
_end_button
|
|
|
|
_button( account_ChangePassword_Cancel, _right( dlgChangePassword ), _bottom( dlgChangePassword ), BUTTON_WIDTH, BUTTON_HEIGHT )
|
|
properties {
|
|
handle localizedText = localize( "guis/mainmenu/cancel" );
|
|
}
|
|
_button_action( _close_input )
|
|
_end_button
|
|
_end_dialog |