Passwort vergessen Funktion

Fragen zum Erstellen von Templates für webEdition.
dehrich
Member
Beiträge: 44
Registriert: Mo 2. Dez 2013, 17:36

Passwort vergessen Funktion

Beitragvon dehrich » Fr 8. Jun 2018, 10:23

Hallo allerseits,

ich habe eine "Passwort vergessen" Funktion nach dieser Vorlage (http://documentation.webedition.org/wik ... r-password) erstellt:

Code: Alles auswählen

<we:setVar to="global" nameto="showFormEmail" value="true" comment="zeige Formular fuer die Eingabe des Usernames oder E-Mail"/>
<we:setVar to="global" nameto="showFormPassword" value="false" comment="zeige Formular fuer die Eingabe des neuen Passwortes"/>
<we:setVar to="global" nameto="errorToken" value="false"/>
<we:setVar to="global" nameto="errorWrongEmail" value="false"/>
<we:setVar to="global" nameto="errorRequiredFields" value="false"/>
<we:setVar to="global" nameto="errorPasswordMismatch" value="false"/>
<we:setVar to="global" nameto="successSendEmail" value="false"/>
<we:setVar to="global" nameto="successResetPassword" value="false"/>
 
<?php 
$GLOBALS['Username'] = isset($_REQUEST['s']['Username']) ? $_REQUEST['s']['Username'] : '';
$GLOBALS['Password'] = isset($_REQUEST['s']['Password']) ? $_REQUEST['s']['Password'] : '';
?>
 
<we:ifVarNotEmpty type="request" match="token">
	<we:ifVarNotEmpty type="request" match="user">
		<we:ifVarNotEmpty type="global" match="Password">
			<we:customerResetPassword type="resetFromMail" loadFields="Forename,Surname,Username"/>
			<we:ifNotCustomerResetPassword>
				<we:ifNotCustomerResetPassword type="token">
					<we:setVar to="global" nameto="errorToken" value="true"/>
				</we:ifNotCustomerResetPassword>
				<we:ifNotCustomerResetPassword type="required">
					<we:setVar to="global" nameto="errorRequiredFields" value="true"/>
					<we:setVar to="global" nameto="showFormPassword" value="true"/>
					<we:setVar to="global" nameto="showFormEmail" value="false"/>
				</we:ifNotCustomerResetPassword>
				<we:ifNotCustomerResetPassword type="passwordMismatch">
					<we:setVar to="global" nameto="errorPasswordMismatch" value="true"/>
					<we:setVar to="global" nameto="showFormPassword" value="true"/>
					<we:setVar to="global" nameto="showFormEmail" value="false"/>
				</we:ifNotCustomerResetPassword>
			<we:else comment="Passwort erfolgreich zurueckgesetzt"/>
				<we:setVar to="global" nameto="showFormEmail" value="false"/>
				<we:setVar to="global" nameto="successResetPassword" value="true"/>
			</we:ifNotCustomerResetPassword>
		<we:else comment="link in bestaetiugungs email wurde aufgerufen, jetzt muss noch das passwort geaendert werden"/>
			<we:setVar to="global" nameto="showFormPassword" value="true"/>
			<we:setVar to="global" nameto="showFormEmail" value="false"/>
		</we:ifVarNotEmpty>
	</we:ifVarNotEmpty>
<we:else comment="es wurde noch keine confirmation email versandt"/>
	<we:ifVarNotEmpty type="global" match="Username">
		<we:customerResetPassword type="email" required="Username" customerEmailField="Kontakt_Email" loadFields="Forename,Surname,Username"/>
		<we:ifNotCustomerResetPassword>
			<we:ifNotCustomerResetPassword type="required">
				<we:setVar to="global" nameto="errorRequiredFields" value="true"/>
			</we:ifNotCustomerResetPassword>
		<we:else comment="Username wurde angegeben und in der KV gefunden, jetzt versenden wir eine E-Mail"/>
			<we:setVar to="global" nameto="showForm" value="false"/>
			<we:sessionField type="print" name="Username" to="global" nameto="recipientEmail"/>
 
			<we:sendMail id="407" subject="Neues Passwort anfordern" recipient="\$recipientEmail" from="info@test.de" charset="utf-8" comment="id enthaelt die ID des webEdition Dokuments, welches auf der nachfolgenden Vorlage basiert"/>
 
			<we:setVar to="global" nameto="showFormEmail" value="false"/>
			<we:setVar to="global" nameto="successSendEmail" value="true"/>
		</we:ifNotCustomerResetPassword>
	</we:ifVarNotEmpty>
</we:ifVarNotEmpty>
 
<article class="clearfix">
	<h1>Passwort vergessen</h1>
	<we:ifVar type="global" name="successResetPassword" match="true" operator="equal">
		<strong class="success">Ihr neues Passwort wurde erfolgreich gespeichert</strong>
	</we:ifVar>
 
	<we:ifVar type="global" name="successSendEmail" match="true" operator="equal">
		<strong class="success">Wir haben Ihnen soeben eine Best&auml;tigungs-E-Mail zugesandt. Bitte klicken Sie den dort enthaltenen Link.</strong>
	</we:ifVar>
 
	<we:ifVar type="global" name="errorWrongEmail" match="true" operator="equal">
		<strong class="error">Die angegebene E-Mail-Adresse ist in unserem System nicht hinterlegt!</strong>
	</we:ifVar>
 
	<we:ifVar type="global" name="errorRequiredFields" match="true" operator="equal">
		<strong class="error">Bitte f&uuml;llen Sie alle Felder aus!</strong>
	</we:ifVar>
 
	<we:ifVar type="global" name="errorPasswordMismatch" match="true" operator="equal">
		<strong class="error">Die eingegebenen Passw&ouml;ter stimmen nicht &uuml;berein.</strong>
	</we:ifVar>
 
	<we:ifVar type="global" name="errorToken" match="true" operator="equal">
		<strong class="error">Die Verifizierung ist nicht mehr möglich. Eventuell ist die erlaubte Zeitspanne überschritten. Bitte starten Sie den Prozess erneut.</strong>
	</we:ifVar>
 
	<we:ifVar type="global" name="showFormEmail" match="true" operator="equal">
		<we:form id="self" method="post">
			<input type="hidden" name="notfirst" value="true"/>
			<label for="Username">E-Mail-Adresse</label>
			<we:sessionField type="textinput" name="Username" id="Username" placeholder="E-Mail-Adresse"/>
			<input type="submit" value="Passwort zur&uuml;cksetzen"/>
		</we:form>
	</we:ifVar>
 
	<we:ifVar type="global" name="showFormPassword" match="true" operator="equal">
		<h3>Sie k&ouml;nnen jetzt Ihr Passwort neu vergeben.</h3>
		<we:form id="self" method="post">
			<we:comment>token aus email-link wird fuer passwort aendern benoetigt</we:comment>
			<we:hidden name="token" type="request" xml="true" />
 
			<we:comment>user aus email-link wird fuer passwort aendern benoetigt</we:comment>
			<we:hidden name="user" type="request" xml="true" />
 
			<label for="Password">Passwort</label>
			<we:sessionField type="password" name="Password" id="Password" placeholder="Neues Passwort"/><br/><br/>
			<label for="Password2">Passwort wiederholen</label>
			<we:sessionField type="password" name="Password2" id="Password2" placeholder="Passwort wiederholen" comment="es ist wichtig, dass dieses Feld 'Password2' heisst"/>
			<input type="submit" value="Passwort neu setzen"/>
		</we:form>
	</we:ifVar>
</article>
Selbiges Formular haben wir bereits in einem anderen Projekt am laufen, dort funktioniert es einwandfrei.

Hier funktioniert alles soweit, bis man das neue Passwort vergeben muss. Nach der Eingabe von "Password" und "Password2" springt er immer in den Fall "passwordMismatch", obwohl beide Passwörter gleich sind.

Da es in älteren Versionen funktioniert, kann es sich hier um einen Bug handeln?

webEdition Version 8.0.2

Zurück zu „webEdition Templates erstellen (we:Tags)“

Wer ist online?

Mitglieder in diesem Forum: 0 Mitglieder und 2 Gäste