From: alex-z Date: Fri, 3 Dec 2021 08:41:33 +0000 (+0200) Subject: Always prefill username from Windows login name based on server version X-Git-Tag: archive/raspbian/3.16.7-1_deb13u1+rpi1~1^2~12^2~17^2~261^2 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=25785841a355d736fbcfb5afb210efcd0afadd46;p=nextcloud-desktop.git Always prefill username from Windows login name based on server version Signed-off-by: alex-z --- diff --git a/NEXTCLOUD.cmake b/NEXTCLOUD.cmake index 576ca8156..d34e682af 100644 --- a/NEXTCLOUD.cmake +++ b/NEXTCLOUD.cmake @@ -13,7 +13,6 @@ set( APPLICATION_REV_DOMAIN "com.nextcloud.desktopclient" ) set( APPLICATION_VIRTUALFILE_SUFFIX "nextcloud" CACHE STRING "Virtual file suffix (not including the .)") set( APPLICATION_OCSP_STAPLING_ENABLED OFF ) set( APPLICATION_FORBID_BAD_SSL OFF ) -set( APPLICATION_LOGIN_WITH_SYSTEM_USERNAME OFF ) set( LINUX_PACKAGE_SHORTNAME "nextcloud" ) set( LINUX_APPLICATION_ID "${APPLICATION_REV_DOMAIN}.${LINUX_PACKAGE_SHORTNAME}") diff --git a/config.h.in b/config.h.in index 2aebdb6b5..e9eff6c92 100644 --- a/config.h.in +++ b/config.h.in @@ -31,7 +31,6 @@ #cmakedefine APPLICATION_VIRTUALFILE_SUFFIX "@APPLICATION_VIRTUALFILE_SUFFIX@" #cmakedefine APPLICATION_OCSP_STAPLING_ENABLED "@APPLICATION_OCSP_STAPLING_ENABLED@" #cmakedefine APPLICATION_FORBID_BAD_SSL "@APPLICATION_FORBID_BAD_SSL@" -#cmakedefine APPLICATION_LOGIN_WITH_SYSTEM_USERNAME "@APPLICATION_LOGIN_WITH_SYSTEM_USERNAME@" #define APPLICATION_DOTVIRTUALFILE_SUFFIX "." APPLICATION_VIRTUALFILE_SUFFIX #cmakedefine01 ENFORCE_VIRTUAL_FILES_SYNC_FOLDER diff --git a/src/gui/creds/flow2auth.cpp b/src/gui/creds/flow2auth.cpp index 9873a2705..d0fbbca6b 100644 --- a/src/gui/creds/flow2auth.cpp +++ b/src/gui/creds/flow2auth.cpp @@ -133,7 +133,7 @@ void Flow2Auth::fetchNewToken(const TokenAction action) _loginUrl = loginUrl; - if (Theme::instance()->loginWithSystemUserName()) { + if (_account->isUsernamePrefillSupported()) { const auto userName = Utility::getCurrentUserName(); if (!userName.isEmpty()) { auto query = QUrlQuery(_loginUrl); diff --git a/src/libsync/account.cpp b/src/libsync/account.cpp index 5242861ad..537bd71e4 100644 --- a/src/libsync/account.cpp +++ b/src/libsync/account.cpp @@ -57,6 +57,7 @@ using namespace QKeychain; namespace { constexpr int pushNotificationsReconnectInterval = 1000 * 60 * 2; +constexpr int usernamePrefillServerVersinMinSupportedMajor = 24; } namespace OCC { @@ -629,6 +630,11 @@ bool Account::serverVersionUnsupported() const NEXTCLOUD_SERVER_VERSION_MIN_SUPPORTED_MINOR, NEXTCLOUD_SERVER_VERSION_MIN_SUPPORTED_PATCH); } +bool Account::isUsernamePrefillSupported() const +{ + return serverVersionInt() >= makeServerVersion(usernamePrefillServerVersinMinSupportedMajor, 0, 0); +} + void Account::setServerVersion(const QString &version) { if (version == _serverVersion) { diff --git a/src/libsync/account.h b/src/libsync/account.h index 91cd36b15..03e8a88cc 100644 --- a/src/libsync/account.h +++ b/src/libsync/account.h @@ -230,6 +230,8 @@ public: */ bool serverVersionUnsupported() const; + bool isUsernamePrefillSupported() const; + /** True when the server connection is using HTTP2 */ bool isHttp2Supported() { return _http2Supported; } void setHttp2Supported(bool value) { _http2Supported = value; } diff --git a/src/libsync/theme.cpp b/src/libsync/theme.cpp index 330b12902..ff7f58e60 100644 --- a/src/libsync/theme.cpp +++ b/src/libsync/theme.cpp @@ -417,15 +417,6 @@ bool Theme::forbidBadSSL() const #endif } -bool Theme::loginWithSystemUserName() const -{ -#ifdef APPLICATION_LOGIN_WITH_SYSTEM_USERNAME - return true; -#else - return false; -#endif -} - QString Theme::forceConfigAuthType() const { return QString(); diff --git a/src/libsync/theme.h b/src/libsync/theme.h index 6ab8fb3f7..6b9aefb25 100644 --- a/src/libsync/theme.h +++ b/src/libsync/theme.h @@ -254,13 +254,6 @@ public: */ virtual bool forbidBadSSL() const; - /** - * Use current logged in username from the system - * - * When true, the Web login form will be pre-filled with system user name - */ - bool loginWithSystemUserName() const; - /** * This is only usefull when previous version had a different overrideServerUrl * with a different auth type in that case You should then specify "http" or "shibboleth".