Merge lp:~widelands-dev/widelands/bug-1827786-metaserver-login-box into lp:widelands

Proposed by Toni Förster
Status: Superseded
Proposed branch: lp:~widelands-dev/widelands/bug-1827786-metaserver-login-box
Merge into: lp:widelands
Prerequisite: lp:~widelands-dev/widelands/bug-1825932-open-games
Diff against target: 188 lines (+104/-2) (has conflicts)
3 files modified
src/ui_fsmenu/multiplayer.cc (+12/-0)
src/wui/login_box.cc (+81/-2)
src/wui/login_box.h (+11/-0)
Text conflict in src/ui_fsmenu/multiplayer.cc
Text conflict in src/wui/login_box.cc
Text conflict in src/wui/login_box.h
To merge this branch: bzr merge lp:~widelands-dev/widelands/bug-1827786-metaserver-login-box
Reviewer Review Type Date Requested Status
kaputtnik Pending
Review via email: mp+367100@code.launchpad.net

This proposal has been superseded by a proposal from 2019-05-12.

Commit message

redesigned login box

- limit the possible characters for usernames
- draw a red box around the input field for erroneous input
- tell user were to register their username
- clicking registered checkbox focuses password field
- remove check from registered clears password field
- password field is only accessible when checkbox is clicked
- when a password is set, ***** is shown onopening

multiplayer login redesign

- only show login dialog when no name is set
- always show login box settings button

To post a comment you must log in.
9106. By Toni Förster

uncheck registered when username was changed

9107. By Toni Förster

double check username before joining the lobby

Revision history for this message
kaputtnik (franku) wrote :

It would be good to have the registered checkbox above the password field. It would be a more logical ordering, imho.

9108. By Toni Förster

switch order of password field and checkbox

Revision history for this message
Toni Förster (stonerl) wrote :

Your're right. Chnaged it.

Revision history for this message
bunnybot (widelandsofficial) wrote :

Continuous integration builds have changed state:

Travis build 4915. State: passed. Details: https://travis-ci.org/widelands/widelands/builds/529968856.
Appveyor build 4696. State: success. Details: https://ci.appveyor.com/project/widelands-dev/widelands/build/_widelands_dev_widelands_bug_1827786_metaserver_login_box-4696.

Revision history for this message
GunChleoc (gunchleoc) :
Revision history for this message
Toni Förster (stonerl) wrote :

Will address the strings later. For the others see the diff comments.

9109. By Toni Förster

proper formated translatable string

9110. By Toni Förster

added missing space

Revision history for this message
bunnybot (widelandsofficial) wrote :

Continuous integration builds have changed state:

Travis build 4925. State: errored. Details: https://travis-ci.org/widelands/widelands/builds/530433164.
Appveyor build 4706. State: success. Details: https://ci.appveyor.com/project/widelands-dev/widelands/build/_widelands_dev_widelands_bug_1827786_metaserver_login_box-4706.

Revision history for this message
kaputtnik (franku) wrote :

As talked on IRC: Can you try to remove the red border around the password editbox and instead show the string 'Password' and the corresponding editbox look sort of grayed out?

I think the text below can also be improved: "You need an account on the widelands website to use a registered account. Please visit ...."

Revision history for this message
GunChleoc (gunchleoc) wrote :

Changing editbox styles is implemented in https://code.launchpad.net/~widelands-dev/widelands/font_size-lua/+merge/366938, so we really need somebody to review that branch and make Toni's life easier.

Revision history for this message
GunChleoc (gunchleoc) wrote :

The changes string is missing a . after the %

I'll do some testing before I reply to the remaining diff comments.

9111. By Toni Förster

changed wording & removed red border around password field

9112. By Toni Förster

add missing .

Revision history for this message
Toni Förster (stonerl) wrote :

@kaputtnik

I addressed your comments. The only thing I can't do ATM is, greying out the password field.

Revision history for this message
Toni Förster (stonerl) wrote :

But I'm not confident whether we should grey the password field out as well. I would look too similar to an active edit box. Greying out the text "Password" and making the input box not editable should be sufficient, IMHO.

9113. By Toni Förster

Fix issue with empty string.

Revision history for this message
Toni Förster (stonerl) wrote :

Unmerged revisions

9113. By Toni Förster

Fix issue with empty string.

9112. By Toni Förster

add missing .

9111. By Toni Förster

changed wording & removed red border around password field

9110. By Toni Förster

added missing space

9109. By Toni Förster

proper formated translatable string

9108. By Toni Förster

switch order of password field and checkbox

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/ui_fsmenu/multiplayer.cc'
2--- src/ui_fsmenu/multiplayer.cc 2019-05-11 18:50:30 +0000
3+++ src/ui_fsmenu/multiplayer.cc 2019-05-11 20:13:52 +0000
4@@ -90,6 +90,7 @@
5 */
6 void FullscreenMenuMultiPlayer::internet_login() {
7 Section& s = g_options.pull_section("global");
8+<<<<<<< TREE
9 if (auto_log_) {
10 nickname_ = s.get_string("nickname", _("nobody"));
11 password_ = s.get_string("password_sha1", "nobody");
12@@ -121,6 +122,17 @@
13 } else {
14 return;
15 }
16+=======
17+
18+ nickname_ = s.get_string("nickname", "");
19+ password_ = s.get_string("password_sha1", "nobody");
20+ register_ = s.get_bool("registered", false);
21+
22+ if (nickname_.empty() || nickname_.find_first_not_of("abcdefghijklmnopqrstuvwxyz"
23+ "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890@.+-_") <= nickname_.size()) {
24+ show_internet_login();
25+ return;
26+>>>>>>> MERGE-SOURCE
27 }
28
29 // Try to connect to the metaserver
30
31=== modified file 'src/wui/login_box.cc'
32--- src/wui/login_box.cc 2019-05-11 18:50:30 +0000
33+++ src/wui/login_box.cc 2019-05-11 20:13:52 +0000
34@@ -26,27 +26,46 @@
35 #include "ui_basic/messagebox.h"
36
37 LoginBox::LoginBox(Panel& parent)
38+<<<<<<< TREE
39 : Window(&parent, "login_box", 0, 0, 500, 220, _("Metaserver login")) {
40+=======
41+ : Window(&parent, "login_box", 0, 0, 500, 280, _("Metaserver login")) {
42+>>>>>>> MERGE-SOURCE
43 center_to_parent();
44
45 int32_t margin = 10;
46
47 ta_nickname = new UI::Textarea(this, margin, margin, _("Nickname:"));
48- ta_password = new UI::Textarea(this, margin, 40, _("Password:"));
49+ ta_password = new UI::Textarea(this, margin, 70, _("Password:"));
50 eb_nickname = new UI::EditBox(this, 150, margin, 330, 20, 2, UI::PanelStyle::kWui);
51- eb_password = new UI::EditBox(this, 150, 40, 330, 20, 2, UI::PanelStyle::kWui);
52+ eb_password = new UI::EditBox(this, 150, 70, 330, 20, 2, UI::PanelStyle::kWui);
53
54+<<<<<<< TREE
55 pwd_warning =
56 new UI::MultilineTextarea(this, margin, 65, 505, 50, UI::PanelStyle::kWui,
57 _("WARNING: Password will be shown and saved readable!"));
58
59 cb_register = new UI::Checkbox(this, Vector2i(margin, 110), _("Log in to a registered account"),
60+=======
61+ cb_register = new UI::Checkbox(this, Vector2i(margin, 40), _("Log in to a registered account."),
62+>>>>>>> MERGE-SOURCE
63 "", get_inner_w() - 2 * margin);
64+<<<<<<< TREE
65 cb_auto_log = new UI::Checkbox(this, Vector2i(margin, 135),
66 _("Automatically use this login information from now on."), "",
67 get_inner_w() - 2 * margin);
68
69 UI::Button* loginbtn = new UI::Button(
70+=======
71+
72+ register_account = new UI::MultilineTextarea(this, margin, 105, 470, 140, UI::PanelStyle::kWui,
73+ (boost::format(_("You need an account on the widelands website, to use a registered "
74+ "account. Please visit: %s Log in to your newly created account and set an online "
75+ "gaming password on your profile page."))
76+ % "\n\nhttps://widelands.org/accounts/register/\n\n").str());
77+
78+ loginbtn = new UI::Button(
79+>>>>>>> MERGE-SOURCE
80 this, "login",
81 UI::g_fh->fontset()->is_rtl() ? (get_inner_w() / 2 - 200) / 2 :
82 (get_inner_w() / 2 - 200) / 2 + get_inner_w() / 2,
83@@ -58,10 +77,26 @@
84 (get_inner_w() / 2 - 200) / 2,
85 loginbtn->get_y(), 200, 20, UI::ButtonStyle::kWuiSecondary, _("Cancel"));
86 cancelbtn->sigclicked.connect(boost::bind(&LoginBox::clicked_back, boost::ref(*this)));
87+<<<<<<< TREE
88+=======
89+ eb_nickname->changed.connect(boost::bind(&LoginBox::change_playername, this));
90+ cb_register->clickedto.connect(boost::bind(&LoginBox::clicked_register, this));
91+>>>>>>> MERGE-SOURCE
92
93 Section& s = g_options.pull_section("global");
94 eb_nickname->set_text(s.get_string("nickname", _("nobody")));
95 cb_register->set_state(s.get_bool("registered", false));
96+<<<<<<< TREE
97+=======
98+
99+ if (registered()) {
100+ eb_password->set_text("*****");
101+ } else {
102+ eb_password->set_can_focus(false);
103+ ta_password->set_color(UI_FONT_CLR_DISABLED);
104+ }
105+
106+>>>>>>> MERGE-SOURCE
107 eb_nickname->focus();
108 }
109
110@@ -113,3 +148,47 @@
111 }
112 return UI::Panel::handle_key(down, code);
113 }
114+<<<<<<< TREE
115+=======
116+
117+void LoginBox::clicked_register() {
118+ if (cb_register->get_state()) {
119+ ta_password->set_color(UI_FONT_CLR_DISABLED);
120+ eb_password->set_can_focus(false);
121+ eb_password->set_text("");
122+ } else {
123+ ta_password->set_color(UI_FONT_CLR_FG);
124+ eb_password->set_can_focus(true);
125+ eb_password->focus();
126+ }
127+}
128+
129+void LoginBox::verify_input() {
130+ // Check if all needed input fields are valid
131+ loginbtn->set_enabled(true);
132+ eb_nickname->set_tooltip("");
133+ eb_password->set_tooltip("");
134+ eb_nickname->set_warning(false);
135+
136+ if (eb_nickname->text().empty()) {
137+ eb_nickname->set_warning(true);
138+ eb_nickname->set_tooltip(_("Please enter a nickname!"));
139+ loginbtn->set_enabled(false);
140+ } else if (eb_nickname->text().find_first_not_of("abcdefghijklmnopqrstuvwxyz"
141+ "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890@.+-_") <= eb_nickname->text().size()) {
142+ eb_nickname->set_warning(true);
143+ eb_nickname->set_tooltip(_("Enter a valid nickname. This value may contain only "
144+ "English letters, numbers, and @ . + - _ characters."));
145+ loginbtn->set_enabled(false);
146+ }
147+
148+ if (eb_password->text().empty() && cb_register->get_state()) {
149+ eb_password->set_tooltip(_("Please enter your password!"));
150+ loginbtn->set_enabled(false);
151+ }
152+
153+ if (eb_password->has_focus() && eb_password->text() == "*****") {
154+ eb_password->set_text("");
155+ }
156+}
157+>>>>>>> MERGE-SOURCE
158
159=== modified file 'src/wui/login_box.h'
160--- src/wui/login_box.h 2019-05-11 18:50:30 +0000
161+++ src/wui/login_box.h 2019-05-11 20:13:52 +0000
162@@ -29,6 +29,11 @@
163 struct LoginBox : public UI::Window {
164 explicit LoginBox(UI::Panel&);
165
166+<<<<<<< TREE
167+=======
168+ void think() override;
169+
170+>>>>>>> MERGE-SOURCE
171 std::string get_nickname() {
172 return eb_nickname->text();
173 }
174@@ -46,8 +51,14 @@
175 bool handle_key(bool down, SDL_Keysym code) override;
176
177 private:
178+ void change_playername();
179 void clicked_back();
180 void clicked_ok();
181+<<<<<<< TREE
182+=======
183+ void clicked_register();
184+ void verify_input();
185+>>>>>>> MERGE-SOURCE
186
187 UI::EditBox* eb_nickname;
188 UI::EditBox* eb_password;

Subscribers

People subscribed via source and target branches

to status/vote changes: