aboutsummaryrefslogtreecommitdiff
path: root/src/network/clientpackethandler.cpp
diff options
context:
space:
mode:
authorrubenwardy <rw@rubenwardy.com>2022-06-05 16:47:38 +0100
committerGitHub <noreply@github.com>2022-06-05 17:47:38 +0200
commit03d86ea0b4900cd0394649597d278d465512d629 (patch)
treed2e5414acea951ea42400b5a87b5ee9a8296a3f3 /src/network/clientpackethandler.cpp
parent21323ef1ff02dd714330a8c9d8235f047e1dacf8 (diff)
downloadminetest-03d86ea0b4900cd0394649597d278d465512d629.tar.gz
minetest-03d86ea0b4900cd0394649597d278d465512d629.tar.bz2
minetest-03d86ea0b4900cd0394649597d278d465512d629.zip
Add register dialog to separate login/register (#12185)
New users find Minetest's account system confusing. This change moves username/password to a new dialog, with login and register buttons added to the Join Game tab. The old registration confirmation dialog is removed in favour of the new dialog. Fixes #8138
Diffstat (limited to 'src/network/clientpackethandler.cpp')
-rw-r--r--src/network/clientpackethandler.cpp19
1 files changed, 14 insertions, 5 deletions
diff --git a/src/network/clientpackethandler.cpp b/src/network/clientpackethandler.cpp
index 55d20d673..78ace6a81 100644
--- a/src/network/clientpackethandler.cpp
+++ b/src/network/clientpackethandler.cpp
@@ -101,11 +101,20 @@ void Client::handleCommand_Hello(NetworkPacket* pkt)
// Authenticate using that method, or abort if there wasn't any method found
if (chosen_auth_mechanism != AUTH_MECHANISM_NONE) {
- if (chosen_auth_mechanism == AUTH_MECHANISM_FIRST_SRP &&
- !m_simple_singleplayer_mode &&
- !getServerAddress().isLocalhost() &&
- g_settings->getBool("enable_register_confirmation")) {
- promptConfirmRegistration(chosen_auth_mechanism);
+ bool is_register = chosen_auth_mechanism == AUTH_MECHANISM_FIRST_SRP;
+ ELoginRegister mode = is_register ? ELoginRegister::Register : ELoginRegister::Login;
+ if (m_allow_login_or_register != ELoginRegister::Any &&
+ m_allow_login_or_register != mode) {
+ m_chosen_auth_mech = AUTH_MECHANISM_NONE;
+ m_access_denied = true;
+ if (m_allow_login_or_register == ELoginRegister::Login) {
+ m_access_denied_reason =
+ gettext("Name is not registered. To create an account on this server, click 'Register'");
+ } else {
+ m_access_denied_reason =
+ gettext("Name is taken. Please choose another name");
+ }
+ m_con->Disconnect();
} else {
startAuth(chosen_auth_mechanism);
}