diff --git a/Build/Sources/TypeScript/backend/security/element/sudo-mode.ts b/Build/Sources/TypeScript/backend/security/element/sudo-mode.ts index 7c25a62cfd521564e05d94c37b4caf36954f9400..47b078d23e4cb0c0b1641f69acc900c24c0a11b2 100644 --- a/Build/Sources/TypeScript/backend/security/element/sudo-mode.ts +++ b/Build/Sources/TypeScript/backend/security/element/sudo-mode.ts @@ -16,12 +16,12 @@ import { html, LitElement, nothing, PropertyValues, TemplateResult } from 'lit'; import AjaxRequest from '@typo3/core/ajax/ajax-request'; import { AjaxResponse } from '@typo3/core/ajax/ajax-response'; import { styleTag, lll } from '@typo3/core/lit-helper'; +import Viewport from '@typo3/backend/viewport'; interface SudoModeResponse { message: string; redirect?: { uri: string, - target: string, } } @@ -100,8 +100,7 @@ export class SudoMode extends LitElement { .then(async (ajaxResponse: AjaxResponse) => { const response: SudoModeResponse = await ajaxResponse.resolve('application/json'); if (response.redirect) { - const targetDocument = response.redirect.target === 'top' ? top.document : document; - targetDocument.location.href = response.redirect.uri; + Viewport.ContentContainer.setUrl(response.redirect.uri); } }) .catch(async (ajaxResponse: AjaxResponse) => { diff --git a/typo3/sysext/backend/Classes/Controller/Security/SudoModeController.php b/typo3/sysext/backend/Classes/Controller/Security/SudoModeController.php index 218622b63bb1a0493aca89fc7c0c5e24653b4bd8..3e6b3f05225e16f857a455075f5b22789a8e3fd0 100644 --- a/typo3/sysext/backend/Classes/Controller/Security/SudoModeController.php +++ b/typo3/sysext/backend/Classes/Controller/Security/SudoModeController.php @@ -142,7 +142,6 @@ final class SudoModeController implements LoggerAwareInterface self::ROUTE_PATH_APPLY, $this->buildUriParametersForClaim($claim, 'apply') ), - 'target' => 'top', ]; if ($useInstallToolPassword && $this->passwordVerification->verifyInstallToolPassword($password)) { $this->logger->info('Verified with install tool password', $loggerContext); diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/security/element/sudo-mode.js b/typo3/sysext/backend/Resources/Public/JavaScript/security/element/sudo-mode.js index 32cb19d6422276fffc2125bba3efcbaefe525942..118e974f705d4a63ae99ea4e77a50ce7112d384a 100644 --- a/typo3/sysext/backend/Resources/Public/JavaScript/security/element/sudo-mode.js +++ b/typo3/sysext/backend/Resources/Public/JavaScript/security/element/sudo-mode.js @@ -10,7 +10,7 @@ * * The TYPO3 project - inspiring people to share! */ -var __decorate=function(e,o,s,t){var r,l=arguments.length,a=l<3?o:null===t?t=Object.getOwnPropertyDescriptor(o,s):t;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,o,s,t);else for(var d=e.length-1;d>=0;d--)(r=e[d])&&(a=(l<3?r(a):l>3?r(o,s,a):r(o,s))||a);return l>3&&a&&Object.defineProperty(o,s,a),a};import{customElement,property,query,state}from"lit/decorators.js";import{html,LitElement,nothing}from"lit";import AjaxRequest from"@typo3/core/ajax/ajax-request.js";import{styleTag,lll}from"@typo3/core/lit-helper.js";let SudoMode=class extends LitElement{constructor(){super(...arguments),this.useInstallToolPassword=!1,this.errorMessage=null}createRenderRoot(){return this}render(){return html` +var __decorate=function(e,o,s,t){var r,l=arguments.length,a=l<3?o:null===t?t=Object.getOwnPropertyDescriptor(o,s):t;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,o,s,t);else for(var d=e.length-1;d>=0;d--)(r=e[d])&&(a=(l<3?r(a):l>3?r(o,s,a):r(o,s))||a);return l>3&&a&&Object.defineProperty(o,s,a),a};import{customElement,property,query,state}from"lit/decorators.js";import{html,LitElement,nothing}from"lit";import AjaxRequest from"@typo3/core/ajax/ajax-request.js";import{styleTag,lll}from"@typo3/core/lit-helper.js";import Viewport from"@typo3/backend/viewport.js";let SudoMode=class extends LitElement{constructor(){super(...arguments),this.useInstallToolPassword=!1,this.errorMessage=null}createRenderRoot(){return this}render(){return html` ${styleTag` :host { display: block; } #sudo-mode-verification { display: block; } @@ -50,4 +50,4 @@ var __decorate=function(e,o,s,t){var r,l=arguments.length,a=l<3?o:null===t?t=Obj </div> </div> </div> - `}firstUpdated(e){super.firstUpdated(e),this.passwordElement.focus()}verifyPassword(e){e.preventDefault(),this.errorMessage=null,new AjaxRequest(this.verifyActionUri).post({password:this.passwordElement.value,useInstallToolPassword:this.useInstallToolPassword?1:0}).then((async e=>{const o=await e.resolve("application/json");if(o.redirect){("top"===o.redirect.target?top.document:document).location.href=o.redirect.uri}})).catch((async e=>{const o=await e.resolve("application/json");this.errorMessage=o.message}))}toggleUseInstallToolPassword(e){e.preventDefault(),this.useInstallToolPassword=!this.useInstallToolPassword}};__decorate([property({type:String})],SudoMode.prototype,"verifyActionUri",void 0),__decorate([state()],SudoMode.prototype,"useInstallToolPassword",void 0),__decorate([state()],SudoMode.prototype,"errorMessage",void 0),__decorate([query("#password")],SudoMode.prototype,"passwordElement",void 0),SudoMode=__decorate([customElement("typo3-backend-security-sudo-mode")],SudoMode);export{SudoMode}; \ No newline at end of file + `}firstUpdated(e){super.firstUpdated(e),this.passwordElement.focus()}verifyPassword(e){e.preventDefault(),this.errorMessage=null,new AjaxRequest(this.verifyActionUri).post({password:this.passwordElement.value,useInstallToolPassword:this.useInstallToolPassword?1:0}).then((async e=>{const o=await e.resolve("application/json");o.redirect&&Viewport.ContentContainer.setUrl(o.redirect.uri)})).catch((async e=>{const o=await e.resolve("application/json");this.errorMessage=o.message}))}toggleUseInstallToolPassword(e){e.preventDefault(),this.useInstallToolPassword=!this.useInstallToolPassword}};__decorate([property({type:String})],SudoMode.prototype,"verifyActionUri",void 0),__decorate([state()],SudoMode.prototype,"useInstallToolPassword",void 0),__decorate([state()],SudoMode.prototype,"errorMessage",void 0),__decorate([query("#password")],SudoMode.prototype,"passwordElement",void 0),SudoMode=__decorate([customElement("typo3-backend-security-sudo-mode")],SudoMode);export{SudoMode}; \ No newline at end of file