Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/bug-1827786-metaserver-login-box-clean-start into lp:widelands

2019-05-25 Thread GunChleoc
Review: Approve

@bunnybot merge
-- 
https://code.launchpad.net/~widelands-dev/widelands/bug-1827786-metaserver-login-box-clean-start/+merge/367320
Your team Widelands Developers is subscribed to branch 
lp:~widelands-dev/widelands/bug-1825932-open-games-clean-start.

___
Mailing list: https://launchpad.net/~widelands-dev
Post to : widelands-dev@lists.launchpad.net
Unsubscribe : https://launchpad.net/~widelands-dev
More help   : https://help.launchpad.net/ListHelp


Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/bug-1827786-metaserver-login-box-clean-start into lp:widelands

2019-05-25 Thread GunChleoc
Code LGTM.

One tweak I'd like to see after testing:

Error message "The sent password was incorrect!" - call it "Wrong password" or 
"Wrong password, please try again." The user doesn't care about the technical 
detail that it was sent. This is coming from the metaserver, so I have opened a 
but over there. https://github.com/widelands/widelands_metaserver/issues/53


-- 
https://code.launchpad.net/~widelands-dev/widelands/bug-1827786-metaserver-login-box-clean-start/+merge/367320
Your team Widelands Developers is subscribed to branch 
lp:~widelands-dev/widelands/bug-1825932-open-games-clean-start.

___
Mailing list: https://launchpad.net/~widelands-dev
Post to : widelands-dev@lists.launchpad.net
Unsubscribe : https://launchpad.net/~widelands-dev
More help   : https://help.launchpad.net/ListHelp


Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/bug-1827786-metaserver-login-box-clean-start into lp:widelands

2019-05-23 Thread kaputtnik
Review: Approve testing

Ok, we may need to file a bug against the metaserver then.

This branch is ok for me now :-)
-- 
https://code.launchpad.net/~widelands-dev/widelands/bug-1827786-metaserver-login-box-clean-start/+merge/367320
Your team Widelands Developers is subscribed to branch 
lp:~widelands-dev/widelands/bug-1825932-open-games-clean-start.

___
Mailing list: https://launchpad.net/~widelands-dev
Post to : widelands-dev@lists.launchpad.net
Unsubscribe : https://launchpad.net/~widelands-dev
More help   : https://help.launchpad.net/ListHelp


Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/bug-1827786-metaserver-login-box-clean-start into lp:widelands

2019-05-23 Thread Toni Förster
Also, this needs to be resolved on the Metaserver side.
-- 
https://code.launchpad.net/~widelands-dev/widelands/bug-1827786-metaserver-login-box-clean-start/+merge/367320
Your team Widelands Developers is subscribed to branch 
lp:~widelands-dev/widelands/bug-1825932-open-games-clean-start.

___
Mailing list: https://launchpad.net/~widelands-dev
Post to : widelands-dev@lists.launchpad.net
Unsubscribe : https://launchpad.net/~widelands-dev
More help   : https://help.launchpad.net/ListHelp


Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/bug-1827786-metaserver-login-box-clean-start into lp:widelands

2019-05-23 Thread Toni Förster
> Setting a correct password and clicking on 'Save' connects immediately to the
> lobby and immediately disconnect again. One can see this in channel #widelands
> on IRC.
> 

That is currently the only way to check whether the password was correct or not.
-- 
https://code.launchpad.net/~widelands-dev/widelands/bug-1827786-metaserver-login-box-clean-start/+merge/367320
Your team Widelands Developers is subscribed to branch 
lp:~widelands-dev/widelands/bug-1825932-open-games-clean-start.

___
Mailing list: https://launchpad.net/~widelands-dev
Post to : widelands-dev@lists.launchpad.net
Unsubscribe : https://launchpad.net/~widelands-dev
More help   : https://help.launchpad.net/ListHelp


Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/bug-1827786-metaserver-login-box-clean-start into lp:widelands

2019-05-23 Thread kaputtnik
Setting a correct password and clicking on 'Save' connects immediately to the 
lobby and immediately disconnect again. One can see this in channel #widelands 
on IRC.

But the assert is gone now :-)
-- 
https://code.launchpad.net/~widelands-dev/widelands/bug-1827786-metaserver-login-box-clean-start/+merge/367320
Your team Widelands Developers is subscribed to branch 
lp:~widelands-dev/widelands/bug-1825932-open-games-clean-start.

___
Mailing list: https://launchpad.net/~widelands-dev
Post to : widelands-dev@lists.launchpad.net
Unsubscribe : https://launchpad.net/~widelands-dev
More help   : https://help.launchpad.net/ListHelp


Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/bug-1827786-metaserver-login-box-clean-start into lp:widelands

2019-05-23 Thread kaputtnik
Popup if wrong password is set works now. But i can still provoke the Assertion:

1. Open the settings
2. Enter a wrong password and close the popup
3. Click cancel
4. Try to connect with the metaserver (click on Online Game)

Running widelands with a new home directory does not show this error.
-- 
https://code.launchpad.net/~widelands-dev/widelands/bug-1827786-metaserver-login-box-clean-start/+merge/367320
Your team Widelands Developers is subscribed to branch 
lp:~widelands-dev/widelands/bug-1825932-open-games-clean-start.

___
Mailing list: https://launchpad.net/~widelands-dev
Post to : widelands-dev@lists.launchpad.net
Unsubscribe : https://launchpad.net/~widelands-dev
More help   : https://help.launchpad.net/ListHelp


Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/bug-1827786-metaserver-login-box-clean-start into lp:widelands

2019-05-23 Thread Toni Förster
Can you give it another try?
-- 
https://code.launchpad.net/~widelands-dev/widelands/bug-1827786-metaserver-login-box-clean-start/+merge/367320
Your team Widelands Developers is subscribed to branch 
lp:~widelands-dev/widelands/bug-1825932-open-games-clean-start.

___
Mailing list: https://launchpad.net/~widelands-dev
Post to : widelands-dev@lists.launchpad.net
Unsubscribe : https://launchpad.net/~widelands-dev
More help   : https://help.launchpad.net/ListHelp


Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/bug-1827786-metaserver-login-box-clean-start into lp:widelands

2019-05-17 Thread kaputtnik
Review: Needs Fixing

Hm, there is some inconsistency and an assertion:

1. Start widelands
2. Set a wrong password -> No hint about wrong password -> Login dialog closes
3. Trying to get into the lobby shows now a warning -> Loginbox appear
4. Set a wrong password again -> now the warning appears immediately
5. Close dialog by pressing 'Cancel' (did not test right click to close it)
6. Try to enter the lobby -> Assertion:

widelands: 
/home/kaputtnik/Quellcode/widelands-repo/bug-1827786-metaserver-login-box-clean-start/src/ui_fsmenu/multiplayer.cc:134:
 void FullscreenMenuMultiPlayer::internet_login(): Assertion `!auth.empty()' 
failed.

If feasible the warning about wrong password should appear also in step 2.

I am fine with the wording though :-)
-- 
https://code.launchpad.net/~widelands-dev/widelands/bug-1827786-metaserver-login-box-clean-start/+merge/367320
Your team Widelands Developers is subscribed to branch 
lp:~widelands-dev/widelands/bug-1825932-open-games-clean-start.

___
Mailing list: https://launchpad.net/~widelands-dev
Post to : widelands-dev@lists.launchpad.net
Unsubscribe : https://launchpad.net/~widelands-dev
More help   : https://help.launchpad.net/ListHelp


Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/bug-1827786-metaserver-login-box-clean-start into lp:widelands

2019-05-17 Thread GunChleoc
Buttons use Title Case, so:

Online Game
Online Game Settings
-- 
https://code.launchpad.net/~widelands-dev/widelands/bug-1827786-metaserver-login-box-clean-start/+merge/367320
Your team Widelands Developers is subscribed to branch 
lp:~widelands-dev/widelands/bug-1825932-open-games-clean-start.

___
Mailing list: https://launchpad.net/~widelands-dev
Post to : widelands-dev@lists.launchpad.net
Unsubscribe : https://launchpad.net/~widelands-dev
More help   : https://help.launchpad.net/ListHelp


Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/bug-1827786-metaserver-login-box-clean-start into lp:widelands

2019-05-17 Thread GunChleoc
How abut calling the "Back" button "Leave Lobby" rather than "Log Out"?
-- 
https://code.launchpad.net/~widelands-dev/widelands/bug-1827786-metaserver-login-box-clean-start/+merge/367320
Your team Widelands Developers is subscribed to branch 
lp:~widelands-dev/widelands/bug-1825932-open-games-clean-start.

___
Mailing list: https://launchpad.net/~widelands-dev
Post to : widelands-dev@lists.launchpad.net
Unsubscribe : https://launchpad.net/~widelands-dev
More help   : https://help.launchpad.net/ListHelp


Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/bug-1827786-metaserver-login-box-clean-start into lp:widelands

2019-05-16 Thread Toni Förster
I gave it another run.  The button is now called “Login settings” and sits in 
between the “LAN / Direct IP” ans “Back”.[1] The Title of the Login box has be 
renamed accordingly, also the “Login” button has been renamed to “Save”.[2]

The window opens automatically when no username or an invalid username is set 
or the wrong password has been entered. Otherwise, the user has to click the 
button. Clicking on “Save” in the box only closes the window but does not login 
automatically.
 
[1]https://fosuta.org/pics/multi-new.png
[2]https://fosuta.org/pics/login-new.png
-- 
https://code.launchpad.net/~widelands-dev/widelands/bug-1827786-metaserver-login-box-clean-start/+merge/367320
Your team Widelands Developers is subscribed to branch 
lp:~widelands-dev/widelands/bug-1825932-open-games-clean-start.

___
Mailing list: https://launchpad.net/~widelands-dev
Post to : widelands-dev@lists.launchpad.net
Unsubscribe : https://launchpad.net/~widelands-dev
More help   : https://help.launchpad.net/ListHelp


Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/bug-1827786-metaserver-login-box-clean-start into lp:widelands

2019-05-16 Thread Toni Förster
Hmm, I'm still uncertain. What about this?

https://fosuta.org/pics/multi-settings.png

I have to flesh out the details, though. Bu would this Screen look okay?
-- 
https://code.launchpad.net/~widelands-dev/widelands/bug-1827786-metaserver-login-box-clean-start/+merge/367320
Your team Widelands Developers is subscribed to branch 
lp:~widelands-dev/widelands/bug-1825932-open-games-clean-start.

___
Mailing list: https://launchpad.net/~widelands-dev
Post to : widelands-dev@lists.launchpad.net
Unsubscribe : https://launchpad.net/~widelands-dev
More help   : https://help.launchpad.net/ListHelp


Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/bug-1827786-metaserver-login-box-clean-start into lp:widelands

2019-05-15 Thread kaputtnik
> We rename the back button to "Leave lobby"
> Above the button we have a checkbox "Clear login data"

"Leave lobby and clear login data" would be the correct explanation. But it's 
confusing anyway to have this in the lobby.

Maybe i am too nitpicking ;)
-- 
https://code.launchpad.net/~widelands-dev/widelands/bug-1827786-metaserver-login-box-clean-start/+merge/367320
Your team Widelands Developers is subscribed to branch 
lp:~widelands-dev/widelands/bug-1825932-open-games-clean-start.

___
Mailing list: https://launchpad.net/~widelands-dev
Post to : widelands-dev@lists.launchpad.net
Unsubscribe : https://launchpad.net/~widelands-dev
More help   : https://help.launchpad.net/ListHelp


Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/bug-1827786-metaserver-login-box-clean-start into lp:widelands

2019-05-15 Thread Toni Förster
Well another solution would be:

We rename the back button to "Leave lobby"
Above the button we have a checkbox "Clear login data"
-- 
https://code.launchpad.net/~widelands-dev/widelands/bug-1827786-metaserver-login-box-clean-start/+merge/367320
Your team Widelands Developers is subscribed to branch 
lp:~widelands-dev/widelands/bug-1825932-open-games-clean-start.

___
Mailing list: https://launchpad.net/~widelands-dev
Post to : widelands-dev@lists.launchpad.net
Unsubscribe : https://launchpad.net/~widelands-dev
More help   : https://help.launchpad.net/ListHelp


Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/bug-1827786-metaserver-login-box-clean-start into lp:widelands

2019-05-15 Thread kaputtnik
I am not convinced by this solution, it is confusing:

1. We have two places (views) which interact with the same thing now.
2. We have two buttons, 'Logout' and 'Back', in the lobby now, which do the 
same at first sight: Go back to the 'Multiplayer' view. How will a tooltip, if 
there were any, look to explain the buttons?

Having it like before is better, imho, although the small icon (button) to show 
the loginbox is visually disturbing. But better a visually disturbing thing 
than a confusing UI, especially because the Multiplayer view is mostly open for 
a short time.

Just my personal opinion :)
-- 
https://code.launchpad.net/~widelands-dev/widelands/bug-1827786-metaserver-login-box-clean-start/+merge/367320
Your team Widelands Developers is subscribed to branch 
lp:~widelands-dev/widelands/bug-1825932-open-games-clean-start.

___
Mailing list: https://launchpad.net/~widelands-dev
Post to : widelands-dev@lists.launchpad.net
Unsubscribe : https://launchpad.net/~widelands-dev
More help   : https://help.launchpad.net/ListHelp


Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/bug-1827786-metaserver-login-box-clean-start into lp:widelands

2019-05-15 Thread Toni Förster
We have a logout button now :D

The login dialog will be shown only for non registered users. Registered users 
may log out from their account from within the lobby.

The additional login button from the Multiplayer menu is removed.
-- 
https://code.launchpad.net/~widelands-dev/widelands/bug-1827786-metaserver-login-box-clean-start/+merge/367320
Your team Widelands Developers is subscribed to branch 
lp:~widelands-dev/widelands/bug-1825932-open-games-clean-start.

___
Mailing list: https://launchpad.net/~widelands-dev
Post to : widelands-dev@lists.launchpad.net
Unsubscribe : https://launchpad.net/~widelands-dev
More help   : https://help.launchpad.net/ListHelp


Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/bug-1827786-metaserver-login-box-clean-start into lp:widelands

2019-05-15 Thread Toni Förster
I have moved username validation to internet gaming.

I'm currently experimenting with a logout button stay tuned :=)
-- 
https://code.launchpad.net/~widelands-dev/widelands/bug-1827786-metaserver-login-box-clean-start/+merge/367320
Your team Widelands Developers is subscribed to branch 
lp:~widelands-dev/widelands/bug-1825932-open-games-clean-start.

___
Mailing list: https://launchpad.net/~widelands-dev
Post to : widelands-dev@lists.launchpad.net
Unsubscribe : https://launchpad.net/~widelands-dev
More help   : https://help.launchpad.net/ListHelp


Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/bug-1827786-metaserver-login-box-clean-start into lp:widelands

2019-05-15 Thread GunChleoc
That would not allow different players to use the same computer, because you 
can never log out when the password is correct.

I'd say revert the changes for now and let's think about having a logout button 
in the lobby.

Regarding the user name validation, this should be implemented in internet 
gaming somewhere, not in editbox. The editbox is a UI element and should not 
care about what a well-formed user name is. That way, you could also get rid of 
the remaining code duplication.

I have tested the password display and it's working fine :)
-- 
https://code.launchpad.net/~widelands-dev/widelands/bug-1827786-metaserver-login-box-clean-start/+merge/367320
Your team Widelands Developers is subscribed to branch 
lp:~widelands-dev/widelands/bug-1825932-open-games-clean-start.

___
Mailing list: https://launchpad.net/~widelands-dev
Post to : widelands-dev@lists.launchpad.net
Unsubscribe : https://launchpad.net/~widelands-dev
More help   : https://help.launchpad.net/ListHelp


Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/bug-1827786-metaserver-login-box-clean-start into lp:widelands

2019-05-15 Thread Toni Förster
I could think of another option. We remove the button entirely. The login 
window is always shown for non registered users. When a user has entered a 
password, the dialog won't be shown as long as the password is valid.

-- 
https://code.launchpad.net/~widelands-dev/widelands/bug-1827786-metaserver-login-box-clean-start/+merge/367320
Your team Widelands Developers is subscribed to branch 
lp:~widelands-dev/widelands/bug-1825932-open-games-clean-start.

___
Mailing list: https://launchpad.net/~widelands-dev
Post to : widelands-dev@lists.launchpad.net
Unsubscribe : https://launchpad.net/~widelands-dev
More help   : https://help.launchpad.net/ListHelp


Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/bug-1827786-metaserver-login-box-clean-start into lp:widelands

2019-05-14 Thread Toni Förster
I made the "show login dialog" button a proper button. kaputtnik has second 
thoughts, though.

here is a screenshot:

https://i.ibb.co/b3W3x3W/internetgame.png
-- 
https://code.launchpad.net/~widelands-dev/widelands/bug-1827786-metaserver-login-box-clean-start/+merge/367320
Your team Widelands Developers is subscribed to branch 
lp:~widelands-dev/widelands/bug-1825932-open-games-clean-start.

___
Mailing list: https://launchpad.net/~widelands-dev
Post to : widelands-dev@lists.launchpad.net
Unsubscribe : https://launchpad.net/~widelands-dev
More help   : https://help.launchpad.net/ListHelp


Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/bug-1827786-metaserver-login-box-clean-start into lp:widelands

2019-05-14 Thread Toni Förster
Carets are also fixed.
-- 
https://code.launchpad.net/~widelands-dev/widelands/bug-1827786-metaserver-login-box-clean-start/+merge/367320
Your team Widelands Developers is subscribed to branch 
lp:~widelands-dev/widelands/bug-1825932-open-games-clean-start.

___
Mailing list: https://launchpad.net/~widelands-dev
Post to : widelands-dev@lists.launchpad.net
Unsubscribe : https://launchpad.net/~widelands-dev
More help   : https://help.launchpad.net/ListHelp


Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/bug-1827786-metaserver-login-box-clean-start into lp:widelands

2019-05-14 Thread Toni Förster
Please test again it should address all issues. The only problem is that the 
caret does not move properly. Help is appreciated. :)

@Gun have a look at the diff comment, please.

Diff comments:

> 
> === modified file 'src/ui_fsmenu/multiplayer.cc'
> --- src/ui_fsmenu/multiplayer.cc  2019-05-11 18:50:30 +
> +++ src/ui_fsmenu/multiplayer.cc  2019-05-14 13:16:07 +
> @@ -90,37 +107,17 @@
>   */
>  void FullscreenMenuMultiPlayer::internet_login() {
>   Section& s = g_options.pull_section("global");
> - if (auto_log_) {
> - nickname_ = s.get_string("nickname", _("nobody"));
> - password_ = s.get_string("password_sha1", "nobody");
> - register_ = s.get_bool("registered", false);
> - } else {
> - LoginBox lb(*this);
> - if (lb.run() == 
> UI::Panel::Returncodes::kOk) {
> - nickname_ = lb.get_nickname();
> - /// NOTE: The password is only stored (in memory and on 
> disk) and transmitted (over the
> - /// network
> - /// to the metaserver) as cryptographic hash. This does 
> NOT mean that the password is
> - /// stored
> - /// securely on the local disk. While the password 
> should be secure while transmitted to
> - /// the
> - /// metaserver (no-one can use the transmitted data to 
> log in as the user) this is not the
> - /// case
> - /// for local storage. The stored hash of the password 
> makes it hard to look at the
> - /// configuration
> - /// file and figure out the plaintext password to, 
> e.g., log in on the forum. However, the
> - /// stored hash can be copied to another system and 
> used to log in as the user on the
> - /// metaserver.
> - // Further note: SHA-1 is considered broken and 
> shouldn't be used anymore. But since the
> - // passwords on the server are protected by SHA-1 we 
> have to use it here, too
> - password_ = crypto::sha1(lb.get_password());
> - register_ = lb.registered();
> -
> - s.set_bool("registered", lb.registered());
> - s.set_bool("auto_log", lb.set_automaticlog());
> - } else {
> - return;
> - }
> +
> + nickname_ = s.get_string("nickname", "");
> + password_ = s.get_string("password_sha1", "nobody");
> + register_ = s.get_bool("registered", false);
> +
> + // Checks can be done directly in editbox' by using valid_username().
> + // This is just to be on the safe side, in case the user changed the 
> password in the config file.
> + if (nickname_.empty() || 
> nickname_.find_first_not_of("abcdefghijklmnopqrstuvwxyz"
> + "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890@.+-_") <= 
> nickname_.size()) {

As the comment says, this is just to make sure that the name is valid in case 
the user did a change the name directly in the config file. For all other 
username related checks I use valid_username(). Can this stay in?

> + show_internet_login();
> + return;
>   }
>  
>   // Try to connect to the metaserver


-- 
https://code.launchpad.net/~widelands-dev/widelands/bug-1827786-metaserver-login-box-clean-start/+merge/367320
Your team Widelands Developers is subscribed to branch 
lp:~widelands-dev/widelands/bug-1825932-open-games-clean-start.

___
Mailing list: https://launchpad.net/~widelands-dev
Post to : widelands-dev@lists.launchpad.net
Unsubscribe : https://launchpad.net/~widelands-dev
More help   : https://help.launchpad.net/ListHelp


Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/bug-1827786-metaserver-login-box-clean-start into lp:widelands

2019-05-13 Thread GunChleoc
It does not solve comment #1 in the attached bug though:

> We should also add a password mode to the Editbox class that will show *** 
> instead of the actual text.

So, either open a new bug before merging, or fix it in this branch.
-- 
https://code.launchpad.net/~widelands-dev/widelands/bug-1827786-metaserver-login-box-clean-start/+merge/367320
Your team Widelands Developers is subscribed to branch 
lp:~widelands-dev/widelands/bug-1825932-open-games-clean-start.

___
Mailing list: https://launchpad.net/~widelands-dev
Post to : widelands-dev@lists.launchpad.net
Unsubscribe : https://launchpad.net/~widelands-dev
More help   : https://help.launchpad.net/ListHelp


Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/bug-1827786-metaserver-login-box-clean-start into lp:widelands

2019-05-13 Thread kaputtnik
Looks good, imho. Graying out the 'Password' is sufficient :-)

The green arrow on the right of 'Internet Game' is always shown now? -> I tried 
to start widelands with a new homedir, and the green arrow was shown.

Don't forget to remove the 'red border' thing from the commit message please ;)
-- 
https://code.launchpad.net/~widelands-dev/widelands/bug-1827786-metaserver-login-box-clean-start/+merge/367320
Your team Widelands Developers is subscribed to branch 
lp:~widelands-dev/widelands/bug-1825932-open-games-clean-start.

___
Mailing list: https://launchpad.net/~widelands-dev
Post to : widelands-dev@lists.launchpad.net
Unsubscribe : https://launchpad.net/~widelands-dev
More help   : https://help.launchpad.net/ListHelp


Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/bug-1827786-metaserver-login-box-clean-start into lp:widelands

2019-05-12 Thread GunChleoc
I have pushed a small tweak and added some more comments.

Diff comments:

> === modified file 'src/ui_fsmenu/multiplayer.cc'
> --- src/ui_fsmenu/multiplayer.cc  2019-05-11 18:50:30 +
> +++ src/ui_fsmenu/multiplayer.cc  2019-05-12 11:12:04 +
> @@ -58,21 +58,46 @@
>   vbox_.add_inf_space();
>   vbox_.add(, UI::Box::Resizing::kFullSize);
>  
> - Section& s = g_options.pull_section("global");
> - auto_log_ = s.get_bool("auto_log", false);
> - if (auto_log_) {
> - showloginbox =
> + showloginbox =
>  new UI::Button(this, "login_dialog", 0, 0, 0, 0, 
> UI::ButtonStyle::kFsMenuSecondary,
> 
> g_gr->images().get("images/ui_basic/continue.png"), _("Show login dialog"));
> - showloginbox->sigclicked.connect(
> + showloginbox->sigclicked.connect(
>  boost::bind(::show_internet_login, 
> boost::ref(*this)));
> - }
>   layout();
>  }
>  
>  /// called if the showloginbox button was pressed
>  void FullscreenMenuMultiPlayer::show_internet_login() {
> - auto_log_ = false;
> + Section& s = g_options.pull_section("global");
> + LoginBox lb(*this);
> + if (lb.run() == UI::Panel::Returncodes::kOk) {
> + nickname_ = lb.get_nickname();
> + s.set_string("nickname", nickname_);
> + /// NOTE: The password is only stored (in memory and on disk) 
> and transmitted (over the
> + /// network
> + /// to the metaserver) as cryptographic hash. This does NOT 
> mean that the password is
> + /// stored
> + /// securely on the local disk. While the password should be 
> secure while transmitted to
> + /// the
> + /// metaserver (no-one can use the transmitted data to log in 
> as the user) this is not the
> + /// case
> + /// for local storage. The stored hash of the password makes it 
> hard to look at the
> + /// configuration
> + /// file and figure out the plaintext password to, e.g., log in 
> on the forum. However, the
> + /// stored hash can be copied to another system and used to log 
> in as the user on the
> + /// metaserver.
> + // Further note: SHA-1 is considered broken and shouldn't be 
> used anymore. But since the
> + // passwords on the server are protected by SHA-1 we have to 
> use it here, too
> + if (lb.get_password() != "*") {

Better make this empty when it's not set and make the ** a function of 
displaying it only.

> + password_ = crypto::sha1(lb.get_password());
> + s.set_string("password_sha1", password_);
> + }
> +
> + register_ = lb.registered();
> + s.set_bool("registered", lb.registered());
> + } else {
> + return;
> + }
>   internet_login();
>  }
>  
> 
> === modified file 'src/wui/login_box.cc'
> --- src/wui/login_box.cc  2019-05-11 18:50:30 +
> +++ src/wui/login_box.cc  2019-05-12 11:12:04 +
> @@ -113,3 +114,44 @@
>   }
>   return UI::Panel::handle_key(down, code);
>  }
> +
> +void LoginBox::clicked_register() {
> + if (cb_register->get_state()) {
> + ta_password->set_color(UI_FONT_CLR_DISABLED);
> + eb_password->set_can_focus(false);
> + eb_password->set_text("");

When the user starts typing, the password is displayed as clear text, not as 
***. This needs to be fixed in the UI::Editbox class' draw() function.

> + } else {
> + ta_password->set_color(UI_FONT_CLR_FG);
> + eb_password->set_can_focus(true);
> + eb_password->focus();
> + }
> +}
> +
> +void LoginBox::verify_input() {
> + // Check if all needed input fields are valid
> + loginbtn->set_enabled(true);
> + eb_nickname->set_tooltip("");
> + eb_password->set_tooltip("");
> + eb_nickname->set_warning(false);
> +
> + if (eb_nickname->text().empty()) {
> + eb_nickname->set_warning(true);
> + eb_nickname->set_tooltip(_("Please enter a nickname!"));
> + loginbtn->set_enabled(false);
> + } else if 
> (eb_nickname->text().find_first_not_of("abcdefghijklmnopqrstuvwxyz"

We have this same complicated comparison above pull out a bool function to 
ensure consistency.

> + "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890@.+-_") <= 
> eb_nickname->text().size()) {
> + eb_nickname->set_warning(true);
> + eb_nickname->set_tooltip(_("Enter a valid nickname. 
> This value may contain only "
> + 
>   "English letters, numbers, and @ . + - _ 
> characters."));
> + loginbtn->set_enabled(false);
> + }
> +
> + if (eb_password->text().empty() && 

Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/bug-1827786-metaserver-login-box-clean-start into lp:widelands

2019-05-11 Thread Toni Förster
This one replaces the old one I messed up:

https://code.launchpad.net/~widelands-dev/widelands/bug-1827786-metaserver-login-box/+merge/367100

This is the second out of 3 patches. This can go in as soon as this branch

lp:~widelands-dev/widelands/bug-1825932-open-games-clean-start

has been merged
-- 
https://code.launchpad.net/~widelands-dev/widelands/bug-1827786-metaserver-login-box-clean-start/+merge/367312
Your team Widelands Developers is requested to review the proposed merge of 
lp:~widelands-dev/widelands/bug-1827786-metaserver-login-box-clean-start into 
lp:widelands.

___
Mailing list: https://launchpad.net/~widelands-dev
Post to : widelands-dev@lists.launchpad.net
Unsubscribe : https://launchpad.net/~widelands-dev
More help   : https://help.launchpad.net/ListHelp