commit b869dfb1e2fae8f55d8c348de7a91af1ddecc2a1
parent a78336abeae25bb552be9dec57975b7212fc8d0e
Author: Jan Dankert <develop@jandankert.de>
Date: Wed, 17 Nov 2021 23:29:17 +0100
Refactoring: New method for redirecting action and method.
Diffstat:
2 files changed, 15 insertions(+), 4 deletions(-)
diff --git a/modules/cms/action/RequestParams.class.php b/modules/cms/action/RequestParams.class.php
@@ -319,4 +319,17 @@ class RequestParams
public function __toString() {
return 'Request '.$this->action.'/'.$this->method.'/'.$this->id;
}
+
+
+ /**
+ * Redirect to a new action and method.
+ *
+ * @param $action
+ * @param $method
+ */
+ public function redirectActionAndMethod( $action, $method ) {
+
+ $this->action = $action;
+ $this->method = $method;
+ }
}
\ No newline at end of file
diff --git a/modules/cms/ui/UI.class.php b/modules/cms/ui/UI.class.php
@@ -44,12 +44,10 @@ class UI
self::setContentSecurityPolicy();
if ( @$_REQUEST['scope']=='openid' ) {
- $request->action = 'login';
- $request->method = 'oidc';
+ $request->redirectActionAndMethod('login','oidc');
}
elseif (empty($request->action)) {
- $request->action = 'index';
- $request->method = 'show';
+ $request->redirectActionAndMethod('index','show' );
}
if ( $request->isAction )