Changeset - r23642:df495c081e7f
[Not reviewed]
master
0 8 0
Niels Martin Hansen - 6 years ago 2019-01-12 21:27:19
nielsm@indvikleren.dk
Add: Warn players that company passwords are not truly secure
8 files changed with 43 insertions and 1 deletions:
0 comments (0 inline, 0 general)
src/lang/english.txt
Show inline comments
 
@@ -265,6 +265,7 @@ STR_SHOW_HIDDEN_ENGINES_VEHICLE_AIRCRAFT
 
STR_BUTTON_DEFAULT                                              :{BLACK}Default
 
STR_BUTTON_CANCEL                                               :{BLACK}Cancel
 
STR_BUTTON_OK                                                   :{BLACK}OK
 
STR_WARNING_PASSWORD_SECURITY                                   :{YELLOW}Warning: Server administrators may be{}able to read any text entered here.
 

	
 
# On screen keyboard window
 
STR_OSK_KEYBOARD_LAYOUT                                         :`1234567890-=\qwertyuiop[]asdfghjkl;'  zxcvbnm,./ .
src/misc_gui.cpp
Show inline comments
 
@@ -981,6 +981,23 @@ struct QueryStringWindow : public Window
 
			resize->width = 0;
 
			size->width = 0;
 
		}
 

	
 
		if (widget == WID_QS_WARNINGBOX && (this->flags & QSF_PASSWORD) == 0) {
 
			/* We don't want this widget to show! */
 
			fill->width = 0;
 
			resize->width = 0;
 
			size->width = 0;
 
		}
 
		if (widget == WID_QS_WARNING) {
 
			*size = GetStringBoundingBox(STR_WARNING_PASSWORD_SECURITY);
 
		}
 
	}
 

	
 
	virtual void DrawWidget(const Rect &r, int widget) const
 
	{
 
		if (widget != WID_QS_WARNING) return;
 

	
 
		DrawStringMultiLine(r.left, r.right, r.top, r.bottom, STR_WARNING_PASSWORD_SECURITY, TC_FROMSTRING, SA_CENTER);
 
	}
 

	
 
	void SetStringParameters(int widget) const override
 
@@ -1037,6 +1054,9 @@ static const NWidgetPart _nested_query_s
 
	NWidget(WWT_PANEL, COLOUR_GREY),
 
		NWidget(WWT_EDITBOX, COLOUR_GREY, WID_QS_TEXT), SetMinimalSize(256, 12), SetFill(1, 1), SetPadding(2, 2, 2, 2),
 
	EndContainer(),
 
	NWidget(WWT_PANEL, COLOUR_GREY, WID_QS_WARNINGBOX),
 
		NWidget(WWT_LABEL, COLOUR_GREY, WID_QS_WARNING), SetPadding(WD_FRAMETEXT_TOP, WD_FRAMETEXT_RIGHT, WD_FRAMETEXT_BOTTOM, WD_FRAMETEXT_LEFT), SetFill(0, 1),
 
	EndContainer(),
 
	NWidget(NWID_HORIZONTAL, NC_EQUALSIZE),
 
		NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_QS_DEFAULT), SetMinimalSize(87, 12), SetFill(1, 1), SetDataTip(STR_BUTTON_DEFAULT, STR_NULL),
 
		NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_QS_CANCEL), SetMinimalSize(86, 12), SetFill(1, 1), SetDataTip(STR_BUTTON_CANCEL, STR_NULL),
src/network/network_gui.cpp
Show inline comments
 
@@ -2157,7 +2157,7 @@ void ShowNetworkNeedPassword(NetworkPass
 
		case NETWORK_GAME_PASSWORD:    caption = STR_NETWORK_NEED_GAME_PASSWORD_CAPTION; break;
 
		case NETWORK_COMPANY_PASSWORD: caption = STR_NETWORK_NEED_COMPANY_PASSWORD_CAPTION; break;
 
	}
 
	ShowQueryString(STR_EMPTY, caption, NETWORK_PASSWORD_LENGTH, w, CS_ALPHANUMERAL, QSF_NONE);
 
	ShowQueryString(STR_EMPTY, caption, NETWORK_PASSWORD_LENGTH, w, CS_ALPHANUMERAL, QSF_PASSWORD);
 
}
 

	
 
struct NetworkCompanyPasswordWindow : public Window {
 
@@ -2174,6 +2174,14 @@ struct NetworkCompanyPasswordWindow : pu
 
		this->SetFocusedWidget(WID_NCP_PASSWORD);
 
	}
 

	
 
	virtual void DrawWidget(const Rect &r, int widget) const
 
	{
 
		if (widget != WID_NCP_WARNING) return;
 

	
 
		DrawStringMultiLine(r.left + WD_FRAMETEXT_LEFT, r.right - WD_FRAMETEXT_RIGHT, r.top + WD_FRAMERECT_TOP, r.bottom - WD_FRAMERECT_BOTTOM,
 
			STR_WARNING_PASSWORD_SECURITY, TC_FROMSTRING, SA_CENTER);
 
	}
 

	
 
	void OnOk()
 
	{
 
		if (this->IsWidgetLowered(WID_NCP_SAVE_AS_DEFAULT_PASSWORD)) {
 
@@ -2220,6 +2228,9 @@ static const NWidgetPart _nested_network
 
			EndContainer(),
 
		EndContainer(),
 
	EndContainer(),
 
	NWidget(WWT_PANEL, COLOUR_GREY, WID_NCP_WARNING),
 
		NWidget(WWT_LABEL, COLOUR_GREY), SetFill(0, 1), SetPadding(2, 2, 2, 2), SetDataTip(STR_WARNING_PASSWORD_SECURITY, STR_NULL),
 
	EndContainer(),
 
	NWidget(NWID_HORIZONTAL, NC_EQUALSIZE),
 
		NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_NCP_CANCEL), SetFill(1, 0), SetDataTip(STR_BUTTON_CANCEL, STR_COMPANY_PASSWORD_CANCEL),
 
		NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_NCP_OK), SetFill(1, 0), SetDataTip(STR_BUTTON_OK, STR_COMPANY_PASSWORD_OK),
src/script/api/game/game_window.hpp.sq
Show inline comments
 
@@ -636,6 +636,8 @@ void SQGSWindow_Register(Squirrel *engin
 
	SQGSWindow.DefSQConst(engine, ScriptWindow::WID_A_WEBSITE,                             "WID_A_WEBSITE");
 
	SQGSWindow.DefSQConst(engine, ScriptWindow::WID_QS_CAPTION,                            "WID_QS_CAPTION");
 
	SQGSWindow.DefSQConst(engine, ScriptWindow::WID_QS_TEXT,                               "WID_QS_TEXT");
 
	SQGSWindow.DefSQConst(engine, ScriptWindow::WID_QS_WARNING,                            "WID_QS_WARNING");
 
	SQGSWindow.DefSQConst(engine, ScriptWindow::WID_QS_WARNINGBOX,                         "WID_QS_WARNINGBOX");
 
	SQGSWindow.DefSQConst(engine, ScriptWindow::WID_QS_DEFAULT,                            "WID_QS_DEFAULT");
 
	SQGSWindow.DefSQConst(engine, ScriptWindow::WID_QS_CANCEL,                             "WID_QS_CANCEL");
 
	SQGSWindow.DefSQConst(engine, ScriptWindow::WID_QS_OK,                                 "WID_QS_OK");
 
@@ -780,6 +782,7 @@ void SQGSWindow_Register(Squirrel *engin
 
	SQGSWindow.DefSQConst(engine, ScriptWindow::WID_NCP_LABEL,                             "WID_NCP_LABEL");
 
	SQGSWindow.DefSQConst(engine, ScriptWindow::WID_NCP_PASSWORD,                          "WID_NCP_PASSWORD");
 
	SQGSWindow.DefSQConst(engine, ScriptWindow::WID_NCP_SAVE_AS_DEFAULT_PASSWORD,          "WID_NCP_SAVE_AS_DEFAULT_PASSWORD");
 
	SQGSWindow.DefSQConst(engine, ScriptWindow::WID_NCP_WARNING,                           "WID_NCP_WARNING");
 
	SQGSWindow.DefSQConst(engine, ScriptWindow::WID_NCP_CANCEL,                            "WID_NCP_CANCEL");
 
	SQGSWindow.DefSQConst(engine, ScriptWindow::WID_NCP_OK,                                "WID_NCP_OK");
 
	SQGSWindow.DefSQConst(engine, ScriptWindow::WID_NGRFI_CAPTION,                         "WID_NGRFI_CAPTION");
src/script/api/script_window.hpp
Show inline comments
 
@@ -1598,6 +1598,8 @@ public:
 
	enum QueryStringWidgets {
 
		WID_QS_CAPTION                               = ::WID_QS_CAPTION,                               ///< Caption of the window.
 
		WID_QS_TEXT                                  = ::WID_QS_TEXT,                                  ///< Text of the query.
 
		WID_QS_WARNING                               = ::WID_QS_WARNING,                               ///< Warning label about password security
 
		WID_QS_WARNINGBOX                            = ::WID_QS_WARNINGBOX,                            ///< Container for warning label
 
		WID_QS_DEFAULT                               = ::WID_QS_DEFAULT,                               ///< Default button.
 
		WID_QS_CANCEL                                = ::WID_QS_CANCEL,                                ///< Cancel button.
 
		WID_QS_OK                                    = ::WID_QS_OK,                                    ///< OK button.
 
@@ -1817,6 +1819,7 @@ public:
 
		WID_NCP_LABEL                                = ::WID_NCP_LABEL,                                ///< Label in front of the password field.
 
		WID_NCP_PASSWORD                             = ::WID_NCP_PASSWORD,                             ///< Input field for the password.
 
		WID_NCP_SAVE_AS_DEFAULT_PASSWORD             = ::WID_NCP_SAVE_AS_DEFAULT_PASSWORD,             ///< Toggle 'button' for saving the current password as default password.
 
		WID_NCP_WARNING                              = ::WID_NCP_WARNING,                              ///< Warning text about password security
 
		WID_NCP_CANCEL                               = ::WID_NCP_CANCEL,                               ///< Close the window without changing anything.
 
		WID_NCP_OK                                   = ::WID_NCP_OK,                                   ///< Safe the password etc.
 
	};
src/textbuf_gui.h
Show inline comments
 
@@ -22,6 +22,7 @@ enum QueryStringFlags {
 
	QSF_ACCEPT_UNCHANGED = 0x01, ///< return success even when the text didn't change
 
	QSF_ENABLE_DEFAULT   = 0x02, ///< enable the 'Default' button ("\0" is returned)
 
	QSF_LEN_IN_CHARS     = 0x04, ///< the length of the string is counted in characters
 
	QSF_PASSWORD         = 0x08, ///< password entry box, show warning about password security
 
};
 

	
 
DECLARE_ENUM_AS_BIT_SET(QueryStringFlags)
src/widgets/misc_widget.h
Show inline comments
 
@@ -32,6 +32,8 @@ enum AboutWidgets {
 
enum QueryStringWidgets {
 
	WID_QS_CAPTION, ///< Caption of the window.
 
	WID_QS_TEXT,    ///< Text of the query.
 
	WID_QS_WARNING,    ///< Warning label about password security
 
	WID_QS_WARNINGBOX, ///< Container for warning label
 
	WID_QS_DEFAULT, ///< Default button.
 
	WID_QS_CANCEL,  ///< Cancel button.
 
	WID_QS_OK,      ///< OK button.
src/widgets/network_widget.h
Show inline comments
 
@@ -122,6 +122,7 @@ enum NetworkCompanyPasswordWidgets {
 
	WID_NCP_LABEL,                    ///< Label in front of the password field.
 
	WID_NCP_PASSWORD,                 ///< Input field for the password.
 
	WID_NCP_SAVE_AS_DEFAULT_PASSWORD, ///< Toggle 'button' for saving the current password as default password.
 
	WID_NCP_WARNING,                  ///< Warning text about password security
 
	WID_NCP_CANCEL,                   ///< Close the window without changing anything.
 
	WID_NCP_OK,                       ///< Safe the password etc.
 
};
0 comments (0 inline, 0 general)