fix: enable passphrase reset with MAS (MESSENGER-7861)

This commit is contained in:
Frank Rotermund
2025-11-05 08:00:54 +01:00
parent e4179f8ceb
commit 9730c47b19
4 changed files with 21 additions and 2 deletions

View File

@@ -14,5 +14,8 @@ Please see LICENSE in the repository root for full details.
@interface WebViewViewController : MXKWebViewViewController
// bwi #7861 we need to enable javascript only for reauthentication
- (void) enableJavascript:(BOOL)enable;
@end

View File

@@ -86,4 +86,12 @@ Please see LICENSE in the repository root for full details.
[super setLocalHTMLFile:localHTMLFile];
}
// bwi #7861 we need to enable javascript only for reauthentication
- (void)enableJavascript:(BOOL)enable {
if (webView) {
webView.configuration.preferences.javaScriptEnabled = enable;
}
}
@end

View File

@@ -53,6 +53,9 @@ NSString *FallBackViewControllerJavascriptOnLogin = @"window.matrixLogin.onLogin
// the user agent to bypass the limitation of Google, as a quick fix (a proper solution will be to use the SSO SDK)
webView.customUserAgent = @"Mozilla/5.0";
// bwi #7861 this webview needs javascript to function on MAS setups
[self enableJavascript:YES];
[self clearCookies];
}

View File

@@ -141,7 +141,9 @@ final class ReauthenticationCoordinator: ReauthenticationCoordinatorType {
// NOTE: Prefer use a callback and the same mechanism as SSOAuthentificationSession instead of using custom WKWebView
let reauthFallbackViewController: ReauthFallBackViewController = ReauthFallBackViewController(url: authenticationURL.absoluteString)
reauthFallbackViewController.title = self.parameters.title
reauthFallbackViewController.enableJavascript(true)
reauthFallbackViewController.didCancel = { [weak self] in
guard let self = self else {
return
@@ -153,7 +155,7 @@ final class ReauthenticationCoordinator: ReauthenticationCoordinatorType {
guard let self = self else {
return
}
guard let sessionId = authenticationSession.session else {
self.delegate?.reauthenticationCoordinator(self, didFailWithError: ReauthenticationCoordinatorError.failToBuildPasswordParameters)
return
@@ -161,10 +163,13 @@ final class ReauthenticationCoordinator: ReauthenticationCoordinatorType {
let authenticationParameters = self.authenticationParametersBuilder.buildOAuthParameters(with: sessionId)
self.delegate?.reauthenticationCoordinatorDidComplete(self, withAuthenticationParameters: authenticationParameters)
self.presentingViewController.dismiss(animated: true)
}
let navigationController = RiotNavigationController(rootViewController: reauthFallbackViewController)
// bwi #7861 close buttons should close the view
self.presentingViewController.present(navigationController, animated: true)
}
}