mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-04-16 06:28:27 +02:00
Merge branch 'feature/7861_mas_passphrase_reset' into 'develop'
Feature/7861 mas passphrase reset See merge request bwmessenger/bundesmessenger/bundesmessenger-ios!445
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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];
|
||||
}
|
||||
|
||||
|
||||
@@ -235,14 +235,17 @@ NSString *const kMXKWebViewViewControllerJavaScriptEnableLog =
|
||||
canGoBack = (![webView.URL.absoluteString isEqualToString:@"about:blank"]);
|
||||
}
|
||||
|
||||
if (canGoBack)
|
||||
{
|
||||
self.navigationItem.rightBarButtonItem = backButton;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Reset the original state
|
||||
self.navigationItem.rightBarButtonItems = originalRightBarButtonItems;
|
||||
// bwi #7861 don't overwrite other barbutton items here
|
||||
if (self.navigationItem.rightBarButtonItem == nil) {
|
||||
if (canGoBack)
|
||||
{
|
||||
self.navigationItem.rightBarButtonItem = backButton;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Reset the original state
|
||||
self.navigationItem.rightBarButtonItems = originalRightBarButtonItems;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -53,10 +53,16 @@ final class ReauthFallBackViewController: AuthFallBackViewController, Themable {
|
||||
}
|
||||
|
||||
private func setupNavigationBar() {
|
||||
// bwi #7861 change logic to both have a cancel and a close button. We don't need a back button here
|
||||
let doneBarButtonItem = MXKBarButtonItem(title: VectorL10n.close, style: .plain) { [weak self] in
|
||||
self?.didValidate?()
|
||||
}
|
||||
self.navigationItem.leftBarButtonItem = doneBarButtonItem
|
||||
self.navigationItem.rightBarButtonItem = doneBarButtonItem
|
||||
|
||||
let cancelBarButtonItem = MXKBarButtonItem(title: VectorL10n.cancel, style: .plain) { [weak self] in
|
||||
self?.didCancel?()
|
||||
}
|
||||
self.navigationItem.leftBarButtonItem = cancelBarButtonItem
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -141,19 +141,24 @@ 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
|
||||
}
|
||||
self.delegate?.reauthenticationCoordinatorDidCancel(self)
|
||||
|
||||
// bwi #7861 cancel buttons should close the view
|
||||
self.presentingViewController.dismiss(animated: true)
|
||||
}
|
||||
|
||||
reauthFallbackViewController.didValidate = { [weak self] in
|
||||
guard let self = self else {
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
guard let sessionId = authenticationSession.session else {
|
||||
self.delegate?.reauthenticationCoordinator(self, didFailWithError: ReauthenticationCoordinatorError.failToBuildPasswordParameters)
|
||||
return
|
||||
@@ -161,10 +166,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)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user