feat: Adding an option to disable username prefill on Windows

Signed-off-by: Tamás Bari <adaorcpp@gmail.com>
This commit is contained in:
Tamás Bari 2025-09-25 09:08:26 +02:00 committed by Matthieu Gallien
parent 66d9e9aac7
commit f352ddaefc
3 changed files with 15 additions and 8 deletions

View File

@ -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")

View File

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

View File

@ -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 <QDesktopServices>
#include <QApplication>
#include <QClipboard>
#include <QTimer>
#include <QBuffer>
#include "abstractnetworkjob.h"
#include "account.h"
#include "flow2auth.h"
#include <QJsonObject>
#include <QJsonDocument>
#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);
}
}