From 6015555e3051b4ed41891a97b6567e675b7e12c0 Mon Sep 17 00:00:00 2001 From: manuroe Date: Mon, 4 Mar 2019 17:25:21 +0100 Subject: [PATCH] Authentication: support SSO by using the fallback URL #2306 Disable register button on SSO --- .../AuthenticationViewController.m | 23 ++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/Riot/Modules/Authentication/AuthenticationViewController.m b/Riot/Modules/Authentication/AuthenticationViewController.m index 21fc7187d..b25074b80 100644 --- a/Riot/Modules/Authentication/AuthenticationViewController.m +++ b/Riot/Modules/Authentication/AuthenticationViewController.m @@ -324,6 +324,9 @@ - (void)setUserInteractionEnabled:(BOOL)userInteractionEnabled { super.userInteractionEnabled = userInteractionEnabled; + + // Reset + self.rightBarButtonItem.enabled = YES; // Show/Hide server options if (_optionsContainer.hidden == userInteractionEnabled) @@ -344,19 +347,33 @@ } else { + AuthInputsView *authInputsview; + if ([self.authInputsView isKindOfClass:AuthInputsView.class]) + { + authInputsview = (AuthInputsView*)self.authInputsView; + } + // The right bar button is used to switch the authentication type. if (self.authType == MXKAuthenticationTypeLogin) { - self.rightBarButtonItem.title = NSLocalizedStringFromTable(@"auth_register", @"Vector", nil); + if (!authInputsview.isSingleSignOnRequired) + { + self.rightBarButtonItem.title = NSLocalizedStringFromTable(@"auth_register", @"Vector", nil); + } + else + { + // Disable register on SSO + self.rightBarButtonItem.enabled = NO; + self.rightBarButtonItem.title = nil; + } } else if (self.authType == MXKAuthenticationTypeRegister) { self.rightBarButtonItem.title = NSLocalizedStringFromTable(@"auth_login", @"Vector", nil); // Restore the back button - if ([self.authInputsView isKindOfClass:AuthInputsView.class]) + if (authInputsview) { - AuthInputsView *authInputsview = (AuthInputsView*)self.authInputsView; [self updateRegistrationScreenWithThirdPartyIdentifiersHidden:authInputsview.thirdPartyIdentifiersHidden]; } }