Commit 298bc081 authored by Harry Glatz's avatar Harry Glatz

Merge branch '458-wrong-redirect-after-login' into 'develop'

Resolve "Wrong redirect after login"

Closes #458

See merge request t3o/t3olayout!340
parents 1543b70a 5bf00a69
......@@ -27,9 +27,6 @@ class FlyOutAjaxLoginController
self::getTypoScriptFrontendController();
$feUser = EidUtility::initFeUser();
if (!isset($feUser->user['uid'])) {
exit;
}
$objectManager = GeneralUtility::makeInstance(ObjectManager::class);
......
<html xmlns:f="http://xsd.helhum.io/ns/typo3/cms-fluid/master/ViewHelpers" data-namespace-typo3-fluid="true">
<script type="text/javascript">
var rsaScriptUrl = '{f:uri.resource(path: "JavaScript/RsaEncryptionWithLib.min.js", extensionName: "rsaauth", absolute: 0)}';
</script>
<script type="text/javascript">
//<f:format.cdata>
function rsaauthInit() {
if (typeof TYPO3RsaEncryptionPublicKeyUrl == 'undefined') {
console.log("loading rsa stuff");
// load rsauth js
var script = document.createElement('script');
script.src = rsaScriptUrl;
script.onload = function () {
// make sure RSAEncrypt function exists now and set TYPO3RsaEncryptionPublicKeyUrl
if (typeof RSAEncrypt === 'function') {
TYPO3RsaEncryptionPublicKeyUrl = '?eID=RsaPublicKeyGenerationController';
} else {
console.error("There was an error loading RsaEncryptionWithLib, Login will not work.");
console.error(rsaScriptUrl + " could not be loaded or does not contain the needed functions.");
}
};
document.head.appendChild(script);
}
}
function isEmpty(elem) {
if ($(elem).val().length) {
$(elem).addClass('_touched');
} else {
$(elem).removeClass('_touched');
}
}
window.onload = function() {
isEmpty(document.getElementById('login-user'));
isEmpty(document.getElementById('login-pass'));
}
//</f:format.cdata>
</script>
<form action="{f:uri.page(addQueryString:1)}" onsubmit="return true;" method="post">
<div class="hidden">
<input type="hidden" name="logintype" value="login">
<input type="hidden" name="pid" value="{f:cObject(typoscriptObjectPath:'lib.loginPid')}">
<input type="hidden" name="redirect_url" value="{f:uri.page(addQueryString:1)}">
</div>
<h4>Enter your credentials below to sign in</h4>
<div class="form-control__wrp">
<input class="form-control" name="user" type="text" onfocusout="isEmpty(this)" id="login-user">
<span class="form-control__placeholder">Username</span>
<i class="form-control__icon fa fa-user" aria-hidden="true"></i>
</div>
<div class="form-control__wrp">
<input class="form-control" name="pass" data-rsa-encryption onfocus="rsaauthInit()" onfocusout="isEmpty(this)" type="password" id="login-pass">
<span class="form-control__placeholder">Password</span>
<i class="form-control__icon fa fa-key" aria-hidden="true"></i>
</div>
<div class="d-flex justify-content-end align-items-center form-nav">
<f:if condition="{f:cObject(typoscriptObjectPath:'lib.forgotPasswordPageURL')}">
<a href="{f:cObject(typoscriptObjectPath:'lib.forgotPasswordPageURL')}" class="small">Forgot password?</a>
</f:if>
<button type="submit" class="btn btn-outline-light btn-lg">Login</button>
<f:if condition="{f:cObject(typoscriptObjectPath:'lib.signUpPageURL')}">
<a href="{f:cObject(typoscriptObjectPath:'lib.signUpPageURL')}" class="btn btn-outline-light btn-lg">Sign up</a>
</f:if>
</div>
</form>
</html>
<html xmlns:f="http://typo3.org/ns/typo3/cms-fluid/master/ViewHelpers" xmlns:t="http://typo3.org/ns/T3o/T3olayout/ViewHelpers" data-namespace-typo3-fluid="true">
<span><f:format.raw><t:gravatar emailAddress="{user.email}" size="100" /></f:format.raw></span>
<form action="{returnUrl}" method="post">
<div class="hidden">
<input type="hidden" name="logintype" value="logout">
<input type="hidden" name="pid" value="{loginPid}">
<input type="hidden" name="redirect_url" value="{f:uri.page(addQueryString:1)}">
</div>
<h3>Hello {user.name}!</h3>
<p>Everybody can contribute. Get in contact with the teams.</p>
<div class="d-flex justify-content-between">
<button type="submit" class="btn btn-secondary btn-lg">Logout</button>
<f:comment>
<!-- Commented out as both {profilePid} and {myTypo3URL} are not implemented yer -->
<button type="button" class="btn btn-primary btn-lg">
<f:if condition="{profilePid}">
<f:then>
<f:link.page pageUid="{profilePid}">My data</f:link.page>
</f:then>
<f:else>
<f:link.external uri="{myTypo3URL}" target="_blank">My data</f:link.external>
</f:else>
</f:if>
</button>
</f:comment>
</div>
</form>
<f:security.ifAuthenticated>
<f:then>
<span><f:format.raw><t:gravatar emailAddress="{user.email}" size="100" /></f:format.raw></span>
<form action="{returnUrl}" method="post">
<div class="hidden">
<input type="hidden" name="logintype" value="logout">
<input type="hidden" name="pid" value="{loginPid}">
<input type="hidden" name="redirect_url" value="{f:uri.page(addQueryString:1)}">
</div>
<h3>Hello {user.name}!</h3>
<p>Everybody can contribute. Get in contact with the teams.</p>
<div class="d-flex justify-content-between">
<button type="submit" class="btn btn-secondary btn-lg">Logout</button>
<f:comment>
<!-- Commented out as both {profilePid} and {myTypo3URL} are not implemented yer -->
<button type="button" class="btn btn-primary btn-lg">
<f:if condition="{profilePid}">
<f:then>
<f:link.page pageUid="{profilePid}">My data</f:link.page>
</f:then>
<f:else>
<f:link.external uri="{myTypo3URL}" target="_blank">My data</f:link.external>
</f:else>
</f:if>
</button>
</f:comment>
</div>
</form>
</f:then>
<f:else>
<script type="text/javascript">
var rsaScriptUrl = '{f:uri.resource(path: "JavaScript/RsaEncryptionWithLib.min.js", extensionName: "rsaauth", absolute: 0)}';
</script>
<script type="text/javascript">
function rsaauthInit() {
if ( typeof TYPO3RsaEncryptionPublicKeyUrl === 'undefined' ) {
console.log( "loading rsa stuff" );
// load rsauth js
var script = document.createElement( 'script' );
script.src = rsaScriptUrl;
script.onload = function () {
// make sure RSAEncrypt function exists now and set TYPO3RsaEncryptionPublicKeyUrl
if ( typeof RSAEncrypt === 'function' ) {
TYPO3RsaEncryptionPublicKeyUrl = '?eID=RsaPublicKeyGenerationController';
} else {
console.error( "There was an error loading RsaEncryptionWithLib, Login will not work." );
console.error( rsaScriptUrl + " could not be loaded or does not contain the needed functions." );
}
};
document.head.appendChild( script );
}
}
function isEmpty( elem ) {
if ( $( elem ).val().length ) {
$( elem ).addClass( '_touched' );
} else {
$( elem ).removeClass( '_touched' );
}
}
window.onload = function () {
isEmpty( document.getElementById( 'login-user' ) );
isEmpty( document.getElementById( 'login-pass' ) );
}
</script>
<form action="{returnUrl}" onsubmit="return true;" method="post">
<div class="hidden">
<input type="hidden" name="logintype" value="login">
<input type="hidden" name="pid" value="{f:cObject(typoscriptObjectPath:'lib.loginPid')}">
<input type="hidden" name="redirect_url" value="{f:uri.page(addQueryString:1)}">
</div>
<h4>Enter your credentials below to sign in</h4>
<div class="form-control__wrp">
<input class="form-control" name="user" type="text" onfocusout="isEmpty(this)" id="login-user">
<span class="form-control__placeholder">Username</span>
<i class="form-control__icon fa fa-user" aria-hidden="true"></i>
</div>
<div class="form-control__wrp">
<input class="form-control" name="pass" data-rsa-encryption onfocus="rsaauthInit()" onfocusout="isEmpty(this)" type="password" id="login-pass">
<span class="form-control__placeholder">Password</span>
<i class="form-control__icon fa fa-key" aria-hidden="true"></i>
</div>
<div class="d-flex justify-content-end align-items-center form-nav">
<f:if condition="{f:cObject(typoscriptObjectPath:'lib.forgotPasswordPageURL')}">
<a href="{f:cObject(typoscriptObjectPath:'lib.forgotPasswordPageURL')}" class="small">Forgot password?</a>
</f:if>
<button type="submit" class="btn btn-outline-light btn-lg">Login</button>
<f:if condition="{f:cObject(typoscriptObjectPath:'lib.signUpPageURL')}">
<a href="{f:cObject(typoscriptObjectPath:'lib.signUpPageURL')}" class="btn btn-outline-light btn-lg">Sign up</a>
</f:if>
</div>
</form>
</f:else>
</f:security.ifAuthenticated>
</html>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Templates for felogin</title>
</head>
<body>
<h1>Common markers</h1>
<p>These are substituted in all felogin item displaying templates.</p>
<h2>Markers</h2>
<ul>
<li>###ACTION_URI### - URI of the request for the login/logout form</li>
<li>###EXTRA_HIDDEN### - Hook required (additional hidden field used by kb_md5fepw extension by Kraft Bernhard)</li>
<li>###ON_SUBMIT### - Hook required (used by kb_md5fepw extension by Kraft Bernhard)</li>
<li>###PREFIXID### - Same as class name ('tx_felogin_pi1') useful to get a unique classname prefix</li>
<li>###REDIRECT_URL### - URL of redirection upon login</li>
<li>###NOREDIRECT### - if set, no redirect will be done</li>
<li>###STORAGE_PID### - explicit enough I guess (if not : id of the page where user are stored)</li>
<li>###STATUS_HEADER### - depends of the template</li>
<li>###STATUS_MESSAGE### - depends of the template</li>
</ul>
<h2>Wrap parts</h2>
<ul>
<li>###HEADER_VALID### - useful to define what to show/hide</li>
<li>###MESSAGE_VALID### - useful to define what to show/hide</li>
<li>###FORGOTP_VALID### - useful to define what to show/hide</li>
<li>###PERMALOGIN_VALID### - useful to define what to show/hide</li>
</ul>
<h2>felogin Language Markers (see pi/locallang.xlf)</h2>
<ul>
<li>###EMAIL_LABEL### - corresponding to 'your_email'</li>
<li>###FORGOT_PASSWORD### - corresponding to 'forgot_password'</li>
<li>###FORGOT_PASSWORD_BACKTOLOGIN### - corresponding to 'forgot_password_backToLogin'</li>
<li>###FORGOT_PASSWORD_ENTEREMAIL### - corresponding to 'forgot_password_enterEmail'</li>
<li>###LOGIN_LABEL### - corresponding to 'login'</li>
<li>###PASSWORD_LABEL### - corresponding to 'password'</li>
<li>###SEND_PASSWORD### - corresponding to 'send_password'</li>
<li>###USERNAME_LABEL### - corresponding to 'username'</li>
</ul>
<!--###TEMPLATE_LOGIN###-->
###STATUS_HEADER###
###STATUS_MESSAGE###
<!-- ###LOGIN_FORM### -->
<form action="###ACTION_URI###" target="_top" method="post" onsubmit="###ON_SUBMIT###">
<fieldset>
<div>
<label for="user">###USERNAME_LABEL###</label>
<input class="form-control" placeholder="username" type="text" id="user" name="user" value="" />
</div>
<div>
<label for="pass">###PASSWORD_LABEL###</label>
<input class="form-control" placeholder="password" type="password" id="pass" name="pass" value="" data-rsa-encryption="" />
</div>
<!--###PERMALOGIN_VALID###-->
<div>
<label for="permalogin">###PERMALOGIN###</label>
<input name="permalogin" value="0" type="hidden" ###PERMALOGIN_HIDDENFIELD_ATTRIBUTES### id="permaloginHiddenField" />
<input name="permalogin" value="1" type="checkbox" ###PERMALOGIN_CHECKBOX_ATTRIBUTES### id="permalogin" onclick="document.getElementById('permaloginHiddenField').disabled = this.checked;" />
</div>
<!--###PERMALOGIN_VALID###-->
<div>
<input class="btn btn-primary" type="submit" name="submit" value="###LOGIN_LABEL###" />
</div>
<div class="felogin-hidden">
<input type="hidden" name="logintype" value="login" />
<input type="hidden" name="pid" value="###STORAGE_PID###" />
<input type="hidden" name="redirect_url" value="###REDIRECT_URL###" />
<input type="hidden" name="###PREFIXID###[noredirect]" value="###NOREDIRECT###" />
###EXTRA_HIDDEN###
</div>
</fieldset>
</form>
<!-- ###LOGIN_FORM### -->
<!--###TEMPLATE_LOGIN###-->
<!--###TEMPLATE_LOGOUT###-->
###STATUS_HEADER###
###STATUS_MESSAGE###
<form action="###ACTION_URI###" target="_top" method="post">
<fieldset>
<div>
<label>###USERNAME_LABEL###</label>
###USERNAME###
</div>
<div>
<input class="btn btn-primary" type="submit" name="submit" value="###LOGOUT_LABEL###" />
</div>
<div class="felogin-hidden">
<input type="hidden" name="logintype" value="logout" />
<input type="hidden" name="pid" value="###STORAGE_PID###" />
<input type="hidden" name="###PREFIXID###[noredirect]" value="###NOREDIRECT###" />
</div>
</fieldset>
</form>
<!--###TEMPLATE_LOGOUT###-->
<!--###TEMPLATE_FORGOT###-->
<!-- removed template, because forgot is only available at my.typo3.org -->
<!--###TEMPLATE_FORGOT###-->
<!--###TEMPLATE_CHANGEPASSWORD###-->
###STATUS_HEADER###
###STATUS_MESSAGE###
<!-- ###CHANGEPASSWORD_FORM### -->
<!-- removed template, because forgot is only available at my.typo3.org -->
<!-- ###CHANGEPASSWORD_FORM### -->
###BACKLINK_LOGIN###
<!--###TEMPLATE_CHANGEPASSWORD###-->
<html xmlns:f="http://typo3.org/ns/typo3/cms-fluid/master/ViewHelpers" xmlns:t="http://typo3.org/ns/T3o/T3olayout/ViewHelpers" data-namespace-typo3-fluid="true">
<f:spaceless>
<f:link.typolink parameter="{loginFormPid}" class="main-nav__list-item_link js__main-nav__list-item_link" additionalAttributes="{data-id: loginFormPid, data-level: '1', data-sub: '1'}">
<f:format.raw><t:gravatar emailAddress="{user.email}" size="60" /></f:format.raw>
<span class="ml-2 sr-only">{user.name}</span>
</f:link.typolink>
</f:spaceless>
<f:security.ifAuthenticated>
<f:then>
<f:spaceless>
<f:link.typolink parameter="{loginFormPid}" class="main-nav__list-item_link js__main-nav__list-item_link" additionalAttributes="{data-id: loginFormPid, data-level: '1', data-sub: '1'}">
<f:format.raw>
<t:gravatar emailAddress="{user.email}" size="60" />
</f:format.raw>
<span class="ml-2 sr-only">{user.name}</span>
</f:link.typolink>
</f:spaceless>
</f:then>
<f:else>
<f:link.typolink parameter="{loginFormPid}" class="main-nav__list-item_link js__main-nav__list-item_link" additionalAttributes="{data-id: loginFormPid, data-level: '1', data-sub: '1'}">
<span class="d-lg-none d-xl-none">Login</span>
</f:link.typolink>
</f:else>
</f:security.ifAuthenticated>
</html>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment