WebFlowCredentials: Make username comparison case-insensitive (fix #1741)
authorMichael Schuster <michael@schuster.ms>
Tue, 3 Mar 2020 05:01:27 +0000 (06:01 +0100)
committerMichael Schuster <michael@schuster.ms>
Tue, 3 Mar 2020 05:01:27 +0000 (06:01 +0100)
Fixes issue #1741

Signed-off-by: Michael Schuster <michael@schuster.ms>
src/gui/creds/webflowcredentials.cpp

index 4993a0dd04f315a93ce491c4c094972da347094c..fb85fc5d2a2720a01ad8d5ac118f354aa9236b56 100644 (file)
@@ -183,7 +183,11 @@ void WebFlowCredentials::askFromUser() {
 void WebFlowCredentials::slotAskFromUserCredentialsProvided(const QString &user, const QString &pass, const QString &host) {
     Q_UNUSED(host)
 
-    if (_user != user) {
+    // Compare the re-entered username case-insensitive and save the new value (avoid breaking the account)
+    // See issue: https://github.com/nextcloud/desktop/issues/1741
+    if (QString::compare(_user, user, Qt::CaseInsensitive) == 0) {
+        _user = user;
+    } else {
         qCInfo(lcWebFlowCredentials()) << "Authed with the wrong user!";
 
         QString msg = tr("Please login with the user: %1")