Custom Login Page

Register And Password Forms

Register, lost-password, and reset-password screens use the same form helpers as normal TemplateX forms.

Register#

phpresources/views/auth/register.php
{{ form:register }}  <form>    {{ form:errors }}    <label>Username</label>    <input name="user_login" required>    <label>Email</label>    <input name="user_email" type="email" required>    {{ form:success }}      <p>Check your email for the next step.</p>    {{ /form:success }}    <button type="submit">Register</button>    <a href="{{ auth_login_url }}">Log in</a>  </form>{{ /form:register }}

If you include a password field named user_pass, password, or pwd, TemplateX creates the user with that password. If not, WordPress sends its normal account setup email.

Registration only works when WordPress user registration is open.

Lost Password#

phpresources/views/auth/forgot-password.php
{{ form:forgot_password }}  <form>    {{ form:errors }}    <label>Email or username</label>    <input name="user_login" required>    {{ form:success }}      <p>Check your email for the reset link.</p>    {{ /form:success }}    <button type="submit">Send reset link</button>    <a href="{{ auth_login_url }}">Log in</a>  </form>{{ /form:forgot_password }}

This calls WordPress retrieve_password().

Reset Password#

phpresources/views/auth/reset-password.php
{{ form:reset_password }}  <form>    {{ form:errors }}    <label>New password</label>    <input name="pass1" type="password" required>    <label>Confirm password</label>    <input name="pass2" type="password" required>    <button type="submit">Save password</button>  </form>{{ /form:reset_password }}

TemplateX keeps the reset key and login from the WordPress reset link and passes them through hidden fields.