From f352ddaefc6ea3caed5b836fd6caa50a7059c17a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tam=C3=A1s=20Bari?= Date: Thu, 25 Sep 2025 09:08:26 +0200 Subject: [PATCH] feat: Adding an option to disable username prefill on Windows MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Tamás Bari --- NEXTCLOUD.cmake | 2 ++ config.h.in | 1 + src/gui/creds/flow2auth.cpp | 20 ++++++++++++-------- 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/NEXTCLOUD.cmake b/NEXTCLOUD.cmake index 054b303d80..b0a90f8de4 100644 --- a/NEXTCLOUD.cmake +++ b/NEXTCLOUD.cmake @@ -58,6 +58,8 @@ option(ENFORCE_SINGLE_ACCOUNT "Enforce use of a single account in desktop client option( DO_NOT_USE_PROXY "Do not use system wide proxy, instead always do a direct connection to server" OFF ) +option( WIN_DISABLE_USERNAME_PREFILL "Do not prefill the Windows user name when creating a new account" OFF ) + ## Theming options set(NEXTCLOUD_BACKGROUND_COLOR "#0082c9" CACHE STRING "Default Nextcloud background color") set( APPLICATION_WIZARD_HEADER_BACKGROUND_COLOR ${NEXTCLOUD_BACKGROUND_COLOR} CACHE STRING "Hex color of the wizard header background") diff --git a/config.h.in b/config.h.in index 8d6096ccf1..1927903195 100644 --- a/config.h.in +++ b/config.h.in @@ -36,6 +36,7 @@ #cmakedefine01 ENFORCE_VIRTUAL_FILES_SYNC_FOLDER #cmakedefine01 DISABLE_VIRTUAL_FILES_SYNC_FOLDER #cmakedefine01 DO_NOT_USE_PROXY +#cmakedefine01 WIN_DISABLE_USERNAME_PREFILL #cmakedefine ENFORCE_SINGLE_ACCOUNT "@ENFORCE_SINGLE_ACCOUNT@" #cmakedefine01 APPLICATION_DISPLAY_LEGACY_IMPORT_DIALOG #cmakedefine01 DISABLE_ACCOUNT_MIGRATION diff --git a/src/gui/creds/flow2auth.cpp b/src/gui/creds/flow2auth.cpp index 451a37e5ea..f1b7a9aff6 100644 --- a/src/gui/creds/flow2auth.cpp +++ b/src/gui/creds/flow2auth.cpp @@ -3,20 +3,23 @@ * SPDX-License-Identifier: GPL-2.0-or-later */ +#include "flow2auth.h" + +#include "abstractnetworkjob.h" +#include "account.h" +#include "config.h" +#include "configfile.h" +#include "guiutility.h" +#include "networkjobs.h" +#include "theme.h" + #include #include #include #include #include -#include "abstractnetworkjob.h" -#include "account.h" -#include "flow2auth.h" #include #include -#include "theme.h" -#include "networkjobs.h" -#include "configfile.h" -#include "guiutility.h" namespace OCC { @@ -106,7 +109,8 @@ void Flow2Auth::fetchNewToken(const TokenAction action) if (const auto userName = _account->userFromCredentials(); !userName.isEmpty()) { setUserNameForLogin(userName, _loginUrl); - } else if (const auto userName = Utility::getCurrentUserName(); !userName.isEmpty()) { + } else if (const auto userName = Utility::getCurrentUserName(); // + !userName.isEmpty() && !WIN_DISABLE_USERNAME_PREFILL) { setUserNameForLogin(userName, _loginUrl); } }