Zum Inhalt springen

Eigenes Loginformular in Extbase / Fluid | Problem mit ViewHelpern

Erstellt am 29. Mai 2013 · Noch keine Antworten

Tags: Frage

hoobeN ·

Hallo,

da mir die Funktionalität von der fe_login extension nicht ausreicht und ich nicht in einer sysext meinen eigenen Code mit reinpfuschen möchte, habe ich mich dazu entschlossen einfach meine eigene Login EXT zu schreiben. Sollte eigentlich nicht weiter schwierig sein dachte ich...aber offensichtlich funktionieren die ViewHelper nicht so wie ich es mir erhofft hatte.

Controller:

/**
	 * redirect action
	 * 
	 * @return void
	 */
	public function redirectAction() {
                //zum test erst mal auf google redirecten ...
		\TYPO3\CMS\Core\Utility\HttpUtility::redirect('http://www.google.at');
	}

/**
	 * action index
	 * 
	 * @return void
	 */
	public function showLoginFormularAction() {
		if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['felogin']['loginFormOnSubmitFuncs'])) {
			$_params = array();
			foreach($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['felogin']['loginFormOnSubmitFuncs'] as $funcRef) {
				list($onSub, $hid) = \TYPO3\CMS\Core\Utility\GeneralUtility::callUserFunction($funcRef, $_params, $this);
				$onSubmitAr[] = $onSub;
				$extraHiddenAr[] = $hid;
			}
		}
		
		if (count($onSubmitAr)) {
			$onSubmit = implode('; ', $onSubmitAr).'; return true;';
		}
		
		if (count($extraHiddenAr)) {
			$extraHidden = implode(LF, $extraHiddenAr);
		}
		
		$this->view->assign('onSubmit', $onSubmit);
		$this->view->assign('extraHidden', $extraHidden);
	}

Fluid 'code':

<f:layout name="Login"/>
<f:section name="content">
<f:form action="{f:uri.action(action: 'redirect')}" method="post" id="login" class="primary" onsubmit="{onsubmit}">
<div id="login-headline">
<!-- dieses <f:uri.action ist nur zu testzwecken da... -->
<h2><f:uri.action action="redirect"><f:translate id="loginLabel">User login</f:translate></f:uri.action></h2>
</div>
<div id="login-body">
<div id="login-form-fields">
	<div class="login-field">
		<f:form.textfield  id="user" name="user" >
		</f:form.textfield>
	</div>
	<div class="login-field">
		<f:form.password  id="pass" name="pass" >
		</f:form.password>
	</div>
	<div class="login-field clearfix">
		<f:form.submit name="submit" class="login-submit" value="{f:translate(key: 'loginButtonLabel', default: 'Login')}" />
	</div>

	<div class="felogin-hidden">
		<f:form.hidden name="logintype" value="login" />
		<f:form.hidden name="pid" value="2" />
		<f:form.hidden name="redirect_url" value="{settings.redirectUrl}" />
		<f:format.html parseFuncTSPath="">{extraHidden}</f:format.html>
	</div>
</div>
</div>
</f:form>
</f:section>
#constants
plugin.tx_pllogin {
	view {
		# cat=plugin.tx_pllogin/file; type=string; label=Path to template root (FE)
		templateRootPath = EXT:pl_login/Resources/Private/Templates/
		# cat=plugin.tx_pllogin/file; type=string; label=Path to template partials (FE)
		partialRootPath = EXT:pl_login/Resources/Private/Partials/
		# cat=plugin.tx_pllogin/file; type=string; label=Path to template layouts (FE)
		layoutRootPath = EXT:pl_login/Resources/Private/Layouts/
	}
	persistence {
		# cat=plugin.tx_pllogin//a; type=string; label=Default storage PID
		storagePid = 2
	}
	settings {
		redirectUrl = http://google.at
	}
}

#setup
plugin.tx_pllogin {
	view {
		templateRootPath = {$plugin.tx_pllogin.view.templateRootPath}
		partialRootPath = {$plugin.tx_pllogin.view.partialRootPath}
		layoutRootPath = {$plugin.tx_pllogin.view.layoutRootPath}
	}
	persistence {
		storagePid = 2
	}
	features {
		# uncomment the following line to enable the new Property Mapper.
		# rewrittenPropertyMapper = 1
	}
	settings {
		redirectUrl = {$plugin.tx_pllogin.settings.redirectUrl}
	}
}

Problem 1:
{settings.redirectUrl} wird nicht übergeben und ich weiß nicht warum..???
Problem 2:
der die action 'redirect' wird offensichtlich niemals angesprochen. wenn das formular abgesendet wird passiert nämlich gar nichts ?!
Problem 3:
wenn ich bei den ViewHelpern '<f:form.textfield>' placeholder & required mitschicke (also '<f:form.textfield placeholder="{f:translate(id: 'foo', default: 'bar')}" required="1"/>), bekomme ich eine Fehlermeldung, dass das Argument required nicht registriert wurde. Wenn ich dann einfach in den ViewHelper gehe und es dort registriere in der initialize function, dann sagt er mir, dass es nicht registriert werden soll, weil es bereits registriert ist.. ??

Ich weiß einfach nicht wieso und hoffe auf kompetente Hilfe.

Lg
hoobeN