ucb/source/ucp/gio/gio_mount.cxx |    9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

New commits:
commit 7bed55bc0b4ebb26fa8de5e3e38716d2febd0eb7
Author:     Justin Luth <justin_l...@sil.org>
AuthorDate: Mon Oct 18 14:05:07 2021 +0200
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Tue Oct 19 11:43:27 2021 +0200

    related tdf#145190 gio_mount: show username when requesting password
    
    It is always nice to know WHICH password you are being asked for.
    When a remote open/save service exists (without a saved password)
    then the password request immediately pops up and nowhere is there
    any indication which service / username the password is for.
    
    This still doesn't indicate which hostname/service this is for,
    but better than nothing at all.
    
    To avoid causing any regressions, this was done only when a
    username was explicitly passed along. In the case where a
    previous password was guessed, that is kept as _NA.
    
    [aMessage provides "Enter password for <user> on <host>"
    but that duplicates the label "Enter user name and password for:".
    So we don't seem to have much to work with here.]
    
    Change-Id: I0991c76ed1ce625ef354009fb416f1058cbeb313
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123746
    Tested-by: Jenkins
    Reviewed-by: Justin Luth <justin_l...@sil.org>
    Reviewed-by: Caolán McNamara <caol...@redhat.com>

diff --git a/ucb/source/ucp/gio/gio_mount.cxx b/ucb/source/ucp/gio/gio_mount.cxx
index dfbb9a0310e5..1d2dbcea8142 100644
--- a/ucb/source/ucp/gio/gio_mount.cxx
+++ b/ucb/source/ucp/gio/gio_mount.cxx
@@ -109,13 +109,14 @@ static void ooo_mount_operation_ask_password 
(GMountOperation *op,
 
     OUString aDomain, aUserName, aPassword;
 
+    if (default_user)
+        aUserName = OUString(default_user, strlen(default_user), 
RTL_TEXTENCODING_UTF8);
+
     ucbhelper::SimpleAuthenticationRequest::EntityType eUserName =
         (flags & G_ASK_PASSWORD_NEED_USERNAME)
           ? ucbhelper::SimpleAuthenticationRequest::ENTITY_MODIFY
-          : ucbhelper::SimpleAuthenticationRequest::ENTITY_NA;
-
-    if (default_user)
-        aUserName = OUString(default_user, strlen(default_user), 
RTL_TEXTENCODING_UTF8);
+          : aUserName.isEmpty() ? 
ucbhelper::SimpleAuthenticationRequest::ENTITY_NA
+                                : 
ucbhelper::SimpleAuthenticationRequest::ENTITY_FIXED;
 
     ucbhelper::SimpleAuthenticationRequest::EntityType ePassword =
         (flags & G_ASK_PASSWORD_NEED_PASSWORD)

Reply via email to