Startseite > Template- und Themeprogrammierung > Account- & Passwort-Reset-Templates > password_reset / set_new_password.liquid

set_new_password.liquid

Das Template <keyword>set_new_password.liquid</keyword> rendert den Set-New-Password-Step des Passwort-Reset-Workflows.

Speicherort

Das Template muss unter <keyword>templates/password_reset/set_new_password.liquid</keyword> abgelegt werden.

Verfügbare Objekte

Innerhalb des <keyword>request.liquid</keyword> Templates stehen folgende Objekte zur Verfügung:

Beispiel-Template

Das nachfolgende Beispiel zeigt die Anzeige eines Formulars für das Zurücksetzen des Account-Passworts auf einen neuen Wert

<h2>Set new password</h2>

{% assign form = workflow.current_step.forms.password_reset %}
{% if form.post_successful == true %}
  {% comment %}Success message{% endcomment %}
  <p><b>Your password has been changed successfully! You can now login with it.</b></p>
 
{% elsif reset_status == 'link_used' %}
  {% comment %}Link already used message{% endcomment %}
  <p><b>The link for changing the password is invalid, because the password has already been changed.</b></p>
  <p>You can request a new link for changing the password here: <a href="/password_reset/request">I forgot my password</a></p>
 
{% elsif reset_status == 'link_expired' %}
  {% comment %}Link expired message{% endcomment %}
  <p><b>The link for changing the password is invalid, because {{ workflow.current_step.link_duration }} hours have been exceeded.</b></p>
  <p>You can request a new link for changing the password here: <a href="/password_reset/request">I forgot my password</a></p>
 
{% elsif reset_status == 'link_ok' %}
  {% comment %}Set new password form{% endcomment %}

  <p>Please enter a new password. Please note that the new password should be at least {{ shop.config.password_min_length }} characters long</p>

  <form method="post" action="">
 
    {% unless form.valid %}
      <p><b>There are errors in this form.</b></p>
    {% endunless %}
          
    <ul>
      <li>
        {% comment %}Field for new password{% endcomment %}
        <label for="{{ form.fields.password.name }}">New password *</label>
        <input type="password"
               {% if form.fields.password.required %}required{% endif %}
               {% if form.fields.password.max_length %}maxlength="{{ form.fields.password.max_length }}"{% endif %}
               name="{{ form.fields.password.name }}"
               value="{{ form.fields.password.value }}" />
      </li>
      <li>
        {% comment %}Field for repeat new password {% endcomment %}
        <label for="{{ form.fields.password_confirm.name }}">Repeat new password *</label>
        <input type="password"
               {% if form.fields.password_confirm.required %}required{% endif %}
               {% if form.fields.password_confirm.max_length %}maxlength="{{ form.fields.password_confirm.max_length }}"{% endif %}
               name="{{ form.fields.password_confirm.name }}"
               value="{{ form.fields.password_confirm.value }}" />
      </li>
    </ul>

    {% comment %}Submit-Button{% endcomment %}
    <input type="submit" value="Continue">
  </form>
{% endif %}