From 4bc25ffb15d1e559417550a64ca8995ce894f8a8 Mon Sep 17 00:00:00 2001 From: d42 Date: Thu, 31 Dec 2020 16:09:42 +0100 Subject: [PATCH 1/2] find sso flow in all of the flows --- src/LoginPage.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/LoginPage.cpp b/src/LoginPage.cpp index 05741cca..fc918359 100644 --- a/src/LoginPage.cpp +++ b/src/LoginPage.cpp @@ -315,10 +315,14 @@ LoginPage::checkHomeserverVersion() if (err || flows.flows.empty()) emit versionOkCb(LoginMethod::Password); - if (flows.flows[0].type == mtx::user_interactive::auth_types::sso) - emit versionOkCb(LoginMethod::SSO); - else - emit versionOkCb(LoginMethod::Password); + LoginMethod login_method = LoginMethod::Password; + for(const auto &flow : flows.flows) { + if (flow.type == mtx::user_interactive::auth_types::sso) { + login_method = LoginMethod::SSO; + break; + } + } + emit versionOk(login_method); }); }); } From b732ea432b8e759b06e221b6d15f1e8a8b1723a9 Mon Sep 17 00:00:00 2001 From: d42 Date: Thu, 31 Dec 2020 17:57:09 +0100 Subject: [PATCH 2/2] rename login_method -> loginMethod to fit the Nheko coding style --- src/LoginPage.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/LoginPage.cpp b/src/LoginPage.cpp index fc918359..62498738 100644 --- a/src/LoginPage.cpp +++ b/src/LoginPage.cpp @@ -315,14 +315,14 @@ LoginPage::checkHomeserverVersion() if (err || flows.flows.empty()) emit versionOkCb(LoginMethod::Password); - LoginMethod login_method = LoginMethod::Password; + LoginMethod loginMethod = LoginMethod::Password; for(const auto &flow : flows.flows) { if (flow.type == mtx::user_interactive::auth_types::sso) { - login_method = LoginMethod::SSO; + loginMethod = LoginMethod::SSO; break; } } - emit versionOk(login_method); + emit versionOk(loginMethod); }); }); }