Allow registration on SSO only servers.

Stop using the homeserver from user defaults.
This commit is contained in:
Doug
2022-04-28 13:06:36 +01:00
committed by Doug
parent b4d7c7f12b
commit 67a021111c
19 changed files with 169 additions and 85 deletions
@@ -74,7 +74,15 @@ class RegistrationWizard {
/// See `AuthenticationService.getFallbackUrl`
func registrationFlow() async throws -> RegistrationResult {
let parameters = RegistrationParameters()
return try await performRegistrationRequest(parameters: parameters)
do {
let result = try await performRegistrationRequest(parameters: parameters)
return result
} catch {
// Map M_FORBIDDEN into a registration error.
guard let mxError = MXError(nsError: error), mxError.errcode == kMXErrCodeStringForbidden else { throw error }
throw RegistrationError.registrationDisabled
}
}
/// Can be call to check is the desired username is available for registration on the current homeserver.