File tree Expand file tree Collapse file tree 2 files changed +20
-1
lines changed
Expand file tree Collapse file tree 2 files changed +20
-1
lines changed Original file line number Diff line number Diff line change 77from qgis .PyQt import uic
88from qgis .PyQt .QtCore import Qt , QSettings , QTimer
99from qgis .PyQt .QtGui import QPixmap
10- from qgis .core import QgsApplication
10+ from qgis .core import QgsApplication , Qgis
1111from urllib .error import URLError
1212
1313
2525 sso_ask_for_email ,
2626 mergin_server_deprecated_version ,
2727 url_reachable ,
28+ qgis_support_sso ,
2829)
2930from .utils import (
3031 MERGIN_URL ,
@@ -90,6 +91,11 @@ def __init__(self):
9091 self .check_credentials ()
9192 self .check_sso_availability ()
9293
94+ if not qgis_support_sso ():
95+ self .ui .button_sign_sso .setVisible (False )
96+ self .ui .stacked_widget_login .setCurrentIndex (0 )
97+ self .ui .sso_email .setVisible (False )
98+
9399 def accept (self ):
94100 if not self .test_connection ():
95101 return
@@ -181,6 +187,9 @@ def test_connection(self):
181187 def allow_sso_login (self ) -> None :
182188 self .ui .button_sign_sso .setVisible (False )
183189
190+ if not qgis_support_sso ():
191+ return
192+
184193 allowed , msg = sso_login_allowed (self .server_url ())
185194 if msg :
186195 QMessageBox .critical (self , "SSO allowed check" , msg )
Original file line number Diff line number Diff line change 1313 QgsBlockingNetworkRequest ,
1414 QgsNetworkAccessManager ,
1515 QgsExpressionContextUtils ,
16+ Qgis ,
1617)
1718from qgis .PyQt .QtCore import QSettings , QUrl
1819from qgis .PyQt .QtNetwork import QNetworkRequest
@@ -523,3 +524,12 @@ def url_reachable(url: str) -> bool:
523524 except (requests .RequestException , urllib3 .exceptions .LocationParseError ):
524525 return False
525526 return True
527+
528+
529+ def qgis_support_sso () -> bool :
530+ """
531+ Check if the current QGIS version supports SSO login.
532+ Returns True if SSO is supported, False otherwise.
533+ """
534+ # QGIS 3.40+ supports SSO
535+ return Qgis .versionInt () >= 34000
You can’t perform that action at this time.
0 commit comments