[Widelands-dev] [Merge] lp:~widelands-dev/widelands/per-level-soldier-anims into lp:widelands

2019-05-14 Thread bunnybot
Continuous integration builds have changed state:

Travis build 4966. State: failed. Details: 
https://travis-ci.org/widelands/widelands/builds/531659623.
Appveyor build 4747. State: success. Details: 
https://ci.appveyor.com/project/widelands-dev/widelands/build/_widelands_dev_widelands_per_level_soldier_anims-4747.
-- 
https://code.launchpad.net/~widelands-dev/widelands/per-level-soldier-anims/+merge/354929
Your team Widelands Developers is requested to review the proposed merge of 
lp:~widelands-dev/widelands/per-level-soldier-anims 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


Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/economy-target-profiles into lp:widelands

2019-05-14 Thread Benedikt Straub
Updated video: 
https://bugs.launchpad.net/widelands/+bug/1827696/+attachment/5263625/+files/vokoscreen-2019-05-14_14-29-18.mkv
I still get a different result by the same steps and have no idea why :(
-- 
https://code.launchpad.net/~widelands-dev/widelands/economy-target-profiles/+merge/366987
Your team Widelands Developers is subscribed to branch 
lp:~widelands-dev/widelands/economy-target-profiles.

___
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-1797702-spaces-in-names-clean-start into lp:widelands

2019-05-14 Thread Toni Förster
Solved :)
-- 
https://code.launchpad.net/~widelands-dev/widelands/bug-1797702-spaces-in-names-clean-start/+merge/367314
Your team Widelands Developers is subscribed to branch 
lp:~widelands-dev/widelands/bug-1827786-metaserver-login-box-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


[Widelands-dev] [Merge] lp:~widelands-dev/widelands/unlock-all-campaigns into lp:widelands

2019-05-14 Thread bunnybot
Continuous integration builds have changed state:

Travis build 4968. State: errored. Details: 
https://travis-ci.org/widelands/widelands/builds/531939662.
Appveyor build 4749. State: success. Details: 
https://ci.appveyor.com/project/widelands-dev/widelands/build/_widelands_dev_widelands_unlock_all_campaigns-4749.
-- 
https://code.launchpad.net/~widelands-dev/widelands/unlock-all-campaigns/+merge/367371
Your team Widelands Developers is subscribed to branch 
lp:~widelands-dev/widelands/unlock-all-campaigns.

___
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/ferry into lp:widelands

2019-05-14 Thread Klaus Halfmann
Review: Needs Fixing

Played Calvission a #1 with a Barbarian at #2 , Imperial at #3 and Frisisan at 
#4

Got an assert aftree trying to build two woodcutters:

Forcing flag at (70, 164)
Message: adding warehouse for player 1 at (69, 163)
Forcing flag at (73, 163)
Forcing flag at (66, 165)
Forcing flag at (65, 169)
Forcing flag at (157, 27)
Message: adding warehouse for player 2 at (157, 26)
Forcing flag at (168, 141)
Message: adding warehouse for player 3 at (168, 140)
Forcing flag at (56, 45)
Message: adding warehouse for player 4 at (56, 44)
InternetGaming: Received a client list update with 18 items.
InternetGaming: Received a game list update with 1 items.
Assertion failed: (wh), function get_next_step, file 
../src/economy/transfer.cc, line 186.
Abort trap: 6



4   widelands   0x0001049b4f48 
Widelands::Transfer::get_next_step(Widelands::PlayerImmovable*, bool&) + 3320 
(transfer.cc:186)
5   widelands   0x0001049bc711 
Widelands::WareInstance::update(Widelands::Game&) + 1841 (ware_instance.cc:330)
6   widelands   0x0001048f73f4 
Widelands::Flag::add_ware(Widelands::EditorGameBase&, Widelands::WareInstance&) 
+ 1524 (flag.cc:462)
7   widelands   0x000102f0cbfd 
Widelands::Worker::dropoff_update(Widelands::Game&, Widelands::Bob::State&) + 
2381 (worker.cc:2123)
8   widelands   0x000102abc710 
Widelands::Bob::do_act(Widelands::Game&) + 704 (bob.cc:195)

Do you need a savegame?
-- 
https://code.launchpad.net/~widelands-dev/widelands/ferry/+merge/351880
Your team Widelands Developers is subscribed to branch 
lp:~widelands-dev/widelands/ferry.

___
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/economy-target-profiles into lp:widelands

2019-05-14 Thread Toni Förster



Diff comments:

> 
> === modified file 'src/wui/economy_options_window.cc'
> --- src/wui/economy_options_window.cc 2019-02-23 11:00:49 +
> +++ src/wui/economy_options_window.cc 2019-05-11 13:37:58 +
> @@ -186,35 +281,399 @@
>   const Widelands::Economy::TargetQuantity& tq = is_wares 
> ?
> 
> economy->ware_target_quantity(index) :
> 
> economy->worker_target_quantity(index);
> - // Don't allow negative new amount.
> - if (amount >= 0 || -amount <= 
> static_cast(tq.permanent)) {
> - if (is_wares) {
> - game.send_player_command(*new 
> Widelands::CmdSetWareTargetQuantity(
> -game.get_gametime(), 
> player_->player_number(), serial_, index,
> -tq.permanent + amount));
> + // Don't allow negative new amount
> + const int old_amount = static_cast(tq.permanent);
> + const int new_amount = std::max(0, old_amount + delta);
> + if (new_amount == old_amount) {
> + continue;
> + }
> + if (is_wares) {
> + game.send_player_command(*new 
> Widelands::CmdSetWareTargetQuantity(
> +game.get_gametime(), 
> player_->player_number(), serial_, index, new_amount));
> + } else {
> + game.send_player_command(*new 
> Widelands::CmdSetWorkerTargetQuantity(
> +game.get_gametime(), 
> player_->player_number(), serial_, index, new_amount));
> + }
> + }
> + }
> +}
> +
> +void EconomyOptionsWindow::EconomyOptionsPanel::reset_target() {
> + Widelands::Game& game = 
> dynamic_cast(player_->egbase());
> + const bool is_wares = type_ == Widelands::wwWARE;
> + const auto& items = is_wares ? player_->tribe().wares() : 
> player_->tribe().workers();
> + const PredefinedTargets settings = 
> economy_options_window_->get_selected_target();
> +
> + bool anything_selected = false;
> + bool second_phase = false;
> +
> +run_second_phase:
> + for (const Widelands::DescriptionIndex& index : items) {
> + if (display_.ware_selected(index) || (second_phase && 
> !display_.is_ware_hidden(index))) {
> + anything_selected = true;
> + if (is_wares) {
> + game.send_player_command(*new 
> Widelands::CmdSetWareTargetQuantity(
> + game.get_gametime(), 
> player_->player_number(), serial_, index, settings.wares.at(index)));
> + } else {
> + game.send_player_command(*new 
> Widelands::CmdSetWorkerTargetQuantity(
> + game.get_gametime(), 
> player_->player_number(), serial_, index, settings.workers.at(index)));
> + }
> + }
> + }
> +
> + if (!second_phase && !anything_selected) {
> + // Nothing was selected, now go through the loop again and 
> change everything
> + second_phase = true;
> + goto run_second_phase;
> + }
> +}
> +
> +constexpr unsigned kThinkInterval = 200;
> +
> +void EconomyOptionsWindow::think() {
> + const uint32_t time = player_->egbase().get_gametime();
> + if (time - time_last_thought_ < kThinkInterval || 
> !player_->get_economy(serial_)) {
> + // If our economy has been deleted, die() was already called, 
> no need to do anything
> + return;
> + }
> + time_last_thought_ = time;
> + update_profiles();
> +}
> +
> +std::string EconomyOptionsWindow::applicable_target() {
> + const Widelands::Economy* eco = player_->get_economy(serial_);
> + for (const auto& pair : predefined_targets_) {
> + bool matches = true;
> + if (tabpanel_.active() == 0) {
> + for (const Widelands::DescriptionIndex& index : 
> player_->tribe().wares()) {
> + const auto it = pair.second.wares.find(index);
> + if (it != pair.second.wares.end() && 
> eco->ware_target_quantity(index).permanent != it->second) {
> + matches = false;
> + break;
> + }
> + }
> + } else {
> + for (const Widelands::DescriptionIndex& index : 
> player_->tribe().workers()) {
> + const auto it = pair.second.workers.find(index);
> + if (it != pair.second.workers.en

Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/ferry into lp:widelands

2019-05-14 Thread Benedikt Straub
This one function with this one assert yet again... yes, please provide a 
savegame
-- 
https://code.launchpad.net/~widelands-dev/widelands/ferry/+merge/351880
Your team Widelands Developers is subscribed to branch 
lp:~widelands-dev/widelands/ferry.

___
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


[Widelands-dev] [Merge] lp:~widelands-dev/widelands/constructionsite_options into lp:widelands

2019-05-14 Thread Benedikt Straub
Benedikt Straub has proposed merging 
lp:~widelands-dev/widelands/constructionsite_options into lp:widelands.

Commit message:
Allow players to define settings for and to enhance buildings under construction

Requested reviews:
  Widelands Developers (widelands-dev)
Related bugs:
  Bug #1597310 in widelands: "Possibility to set building options when building 
is under construction"
  https://bugs.launchpad.net/widelands/+bug/1597310

For more details, see:
https://code.launchpad.net/~widelands-dev/widelands/constructionsite_options/+merge/367428
-- 
Your team Widelands Developers is requested to review the proposed merge of 
lp:~widelands-dev/widelands/constructionsite_options into lp:widelands.
=== modified file 'src/ai/defaultai_seafaring.cc'
--- src/ai/defaultai_seafaring.cc	2019-02-23 11:00:49 +
+++ src/ai/defaultai_seafaring.cc	2019-05-14 17:38:23 +
@@ -346,7 +346,7 @@
 if (site->bo->is(BuildingAttribute::kShipyard)) {
 	for (uint32_t k = 0; k < site->bo->inputs.size(); ++k) {
 		game().send_player_set_ware_priority(
-		   *site->site, wwWARE, site->bo->inputs.at(k), HIGH_PRIORITY);
+		   *site->site, wwWARE, site->bo->inputs.at(k), kPriorityHigh);
 	}
 }
 			}

=== modified file 'src/economy/economy.cc'
--- src/economy/economy.cc	2019-04-09 16:43:49 +
+++ src/economy/economy.cc	2019-05-14 17:38:23 +
@@ -971,7 +971,7 @@
 static bool accept_warehouse_if_policy(Warehouse& wh,
WareWorker type,
DescriptionIndex ware,
-   Warehouse::StockPolicy policy) {
+   StockPolicy policy) {
 	return wh.get_stock_policy(type, ware) == policy;
 }
 
@@ -1005,8 +1005,8 @@
 
 		for (uint32_t nwh = 0; nwh < warehouses_.size(); ++nwh) {
 			Warehouse* wh = warehouses_[nwh];
-			Warehouse::StockPolicy policy = wh->get_stock_policy(type, ware);
-			if (policy == Warehouse::StockPolicy::kPrefer) {
+			StockPolicy policy = wh->get_stock_policy(type, ware);
+			if (policy == StockPolicy::kPrefer) {
 haveprefer = true;
 
 // Getting count of worker/ware
@@ -1022,7 +1022,7 @@
 	preferred_wh_stock = current_stock;
 }
 			}
-			if (policy == Warehouse::StockPolicy::kNormal)
+			if (policy == StockPolicy::kNormal)
 havenormal = true;
 		}
 		if (!havenormal && !haveprefer && type == wwWARE)
@@ -1037,7 +1037,7 @@
 			(!havenormal) ?
 			   WarehouseAcceptFn() :
 			   boost::bind(&accept_warehouse_if_policy, _1, type, ware,
-			   Warehouse::StockPolicy::kNormal));
+			   StockPolicy::kNormal));
 		}
 		if (!wh) {
 			log("Warning: Economy::handle_active_supplies "

=== modified file 'src/economy/request.cc'
--- src/economy/request.cc	2019-02-23 11:00:49 +
+++ src/economy/request.cc	2019-05-14 17:38:23 +
@@ -262,7 +262,7 @@
 int32_t Request::get_priority(int32_t cost) const {
 	int MAX_IDLE_PRIORITY = 100;
 	bool is_construction_site = false;
-	int32_t modifier = DEFAULT_PRIORITY;
+	int32_t modifier = kPriorityNormal;
 
 	if (target_building_) {
 		modifier = target_building_->get_priority(get_type(), get_index());

=== modified file 'src/logic/editor_game_base.cc'
--- src/logic/editor_game_base.cc	2019-04-26 05:52:49 +
+++ src/logic/editor_game_base.cc	2019-05-14 17:38:23 +
@@ -38,6 +38,7 @@
 #include "logic/map_objects/map_object.h"
 #include "logic/map_objects/tribes/battle.h"
 #include "logic/map_objects/tribes/building.h"
+#include "logic/map_objects/tribes/constructionsite.h"
 #include "logic/map_objects/tribes/dismantlesite.h"
 #include "logic/map_objects/tribes/tribe_descr.h"
 #include "logic/map_objects/tribes/tribes.h"
@@ -349,10 +350,15 @@
 PlayerNumber const owner,
 DescriptionIndex idx,
 bool loading,
-Building::FormerBuildings former_buildings) {
+Building::FormerBuildings former_buildings,
+const BuildingSettings* settings) {
 	Player* plr = get_player(owner);
 	const TribeDescr& tribe = plr->tribe();
-	return tribe.get_building_descr(idx)->create(*this, plr, c, true, loading, former_buildings);
+	Building& b = tribe.get_building_descr(idx)->create(*this, plr, c, true, loading, former_buildings);
+	if (settings) {
+		dynamic_cast(b).apply_settings(*settings);
+	}
+	return b;
 }
 
 /**

=== modified file 'src/logic/editor_game_base.h'
--- src/logic/editor_game_base.h	2019-02-27 19:00:36 +
+++ src/logic/editor_game_base.h	2019-05-14 17:38:23 +
@@ -56,6 +56,7 @@
 class TribeDescr;
 struct Flag;
 struct AttackController;
+struct BuildingSettings

Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/economy-target-profiles into lp:widelands

2019-05-14 Thread Benedikt Straub
Hmm... it seems like the dropdown´s entries and selection are not updated 
correctly for some reason which is beyond my understanding. The "Not Selected" 
message is only the consequence of an upstream failure which I suspect in 
update_profiles(). I have rewritten it, can you try if the problem still exists?
-- 
https://code.launchpad.net/~widelands-dev/widelands/economy-target-profiles/+merge/366987
Your team Widelands Developers is subscribed to branch 
lp:~widelands-dev/widelands/economy-target-profiles.

___
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
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


[Widelands-dev] [Merge] lp:~widelands-dev/widelands/constructionsite_options into lp:widelands

2019-05-14 Thread bunnybot
Continuous integration builds have changed state:

Travis build 4971. State: errored. Details: 
https://travis-ci.org/widelands/widelands/builds/532431388.
Appveyor build 4752. State: success. Details: 
https://ci.appveyor.com/project/widelands-dev/widelands/build/_widelands_dev_widelands_constructionsite_options-4752.
-- 
https://code.launchpad.net/~widelands-dev/widelands/constructionsite_options/+merge/367428
Your team Widelands Developers is requested to review the proposed merge of 
lp:~widelands-dev/widelands/constructionsite_options 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


[Widelands-dev] [Merge] lp:~widelands-dev/widelands/economy-target-profiles into lp:widelands

2019-05-14 Thread bunnybot
Continuous integration builds have changed state:

Travis build 4972. State: failed. Details: 
https://travis-ci.org/widelands/widelands/builds/532432343.
Appveyor build 4753. State: success. Details: 
https://ci.appveyor.com/project/widelands-dev/widelands/build/_widelands_dev_widelands_economy_target_profiles-4753.
-- 
https://code.launchpad.net/~widelands-dev/widelands/economy-target-profiles/+merge/366987
Your team Widelands Developers is subscribed to branch 
lp:~widelands-dev/widelands/economy-target-profiles.

___
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


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

2019-05-14 Thread bunnybot
Continuous integration builds have changed state:

Travis build 4976. State: errored. Details: 
https://travis-ci.org/widelands/widelands/builds/532515887.
Appveyor build 4757. State: success. Details: 
https://ci.appveyor.com/project/widelands-dev/widelands/build/_widelands_dev_widelands_bug_1827786_metaserver_login_box_clean_start-4757.
-- 
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


[Widelands-dev] [Merge] lp:~widelands-dev/widelands-website/gaming_password into lp:widelands-website

2019-05-14 Thread kaputtnik
kaputtnik has proposed merging 
lp:~widelands-dev/widelands-website/gaming_password into lp:widelands-website.

Commit message:
Better place for setting the online gaming password

Requested reviews:
  Widelands Developers (widelands-dev)
Related bugs:
  Bug #1828677 in Widelands Website: "Give online gaming password a more 
prominent place."
  https://bugs.launchpad.net/widelands-website/+bug/1828677

For more details, see:
https://code.launchpad.net/~widelands-dev/widelands-website/gaming_password/+merge/367448

Rework of a users profile page:

Removed tabs, because the links are also in the loginbox:
- Messages
- Scheduler

Added tab:
- Gaming Password
- Renamed Tab 'E-Mail settings' -> 'Notification Settings'

Added an additional edit field for setting the gaming password, so the password 
has to be entered two times. Added a check to compare the entered data and give 
an errormessage if the passwords didn't match.

Added some help text.

Moved hashing of password to models.py, because i think it fits better over 
there.
-- 
Your team Widelands Developers is requested to review the proposed merge of 
lp:~widelands-dev/widelands-website/gaming_password into lp:widelands-website.
=== modified file 'templates/django_messages/base.html'
--- templates/django_messages/base.html	2019-02-23 19:02:18 +
+++ templates/django_messages/base.html	2019-05-15 06:56:07 +
@@ -1,4 +1,4 @@
-{% extends "wlprofile/base.html" %}
+{% extends "mainpage/base.html" %}
 {% load i18n %}
 {% load static %}
 
@@ -9,8 +9,6 @@
 	
 {{ block.super}}{% endblock %}
 
-{% block messages %}class="active"{% endblock %}
-
 {% block title %}
 Messages - {{block.super}}
 {% endblock %}

=== modified file 'wlggz/forms.py'
--- wlggz/forms.py	2019-03-05 08:47:47 +
+++ wlggz/forms.py	2019-05-15 06:56:07 +
@@ -10,13 +10,12 @@
 from models import GGZAuth
 from django.utils.translation import ugettext_lazy as _
 
-import hashlib
-import base64
-
 
 class EditGGZForm(forms.ModelForm):
 password = forms.CharField(label=_(u'Online Gaming Password'),
widget=forms.PasswordInput(render_value=False), required=True)
+password2 = forms.CharField(label=_(u'Enter again'),
+   widget=forms.PasswordInput(render_value=False), required=True)
 
 class Meta:
 model = GGZAuth
@@ -27,11 +26,9 @@
 
 super(EditGGZForm, self).__init__(instance=instance, *args, **kwargs)
 
-def clean_password(self):
-pw = self.cleaned_data['password']
-pw_hash = hashlib.sha1(pw.encode('utf-8')).digest()
-pw_base64 = base64.standard_b64encode(pw_hash)
-return pw_base64
-
-def save(self, *args, **kwargs):
-super(EditGGZForm, self).save(*args, **kwargs)
+def clean(self):
+cleaned_data = super(EditGGZForm,self).clean()
+pw = cleaned_data.get('password')
+pw2 = cleaned_data.get('password2')
+if pw != pw2:
+self.add_error('password2', "The passwords didn't match")

=== modified file 'wlggz/models.py'
--- wlggz/models.py	2019-03-31 11:08:21 +
+++ wlggz/models.py	2019-05-15 06:56:07 +
@@ -13,6 +13,8 @@
 from django.utils.translation import ugettext_lazy as _
 from pybb.models import Post
 
+import hashlib
+import base64
 
 class GGZAuth(models.Model):
 user = AutoOneToOneField(
@@ -24,3 +26,11 @@
 class Meta:
 verbose_name = _('ggz')
 verbose_name_plural = _('ggz')
+
+def save(self, *args, **kwargs):
+# hash the password
+pw_hash = hashlib.sha1(self.password.encode('utf-8')).digest()
+pw_base64 = base64.standard_b64encode(pw_hash)
+self.password = pw_base64
+# Save into the database
+super(GGZAuth, self).save(*args, **kwargs)

=== modified file 'wlggz/templates/wlggz/edit_ggz.html'
--- wlggz/templates/wlggz/edit_ggz.html	2019-01-24 18:03:54 +
+++ wlggz/templates/wlggz/edit_ggz.html	2019-05-15 06:56:07 +
@@ -1,4 +1,4 @@
-{% extends "mainpage/base.html" %}
+{% extends "wlprofile/base.html" %}
 
 {% load i18n %}
 
@@ -6,17 +6,28 @@
 {% trans "Set Online Gaming Password" %} - {{ block.super }}
 {% endblock %}
 
+{% block game_passwrd %}class="active"{% endblock %}
+
 {% block content_header %}
 	{% trans "Set Online Gaming Password" %}
 {% endblock %}
 
 {% block content_main %}
-
+
+	The password set here can be used when playing widelands over internet.
+	Although it is optional to use a password it is recommended to use one,
+	because your username will be reserved then. The password is stored encrypted.
+	To use the password on internetgames:
+	
+		Start the game and click on 'Multiplayer -> Internet Game'
+		Enter your website's username and the password you have set here
+		Click on 'Login'
+	
 	
 		
 		{% for field in ggz_form %}
 			
-{{ field.label_tag }}:
+{{ field.label_tag }}
 {{ field }}
 {{ field.errors }}
 			

=== modified file 'wlggz/views.py'
--- wlggz/views.py	2018-04-08 14:40: