Radical Design Course by Jack McDade

From the creator of Statamic

Learn how to make your websites standout and be remembered.

This course is the most refreshing take on teaching design that I've come across.

— Mikaël Sévigny, Developer

User:Login_Form Tag

If you want to build a login form for your users, this is the easiest way to do it.

Overview

User tags are designed for sites that have areas or features behind a login. The user:login_form tag helps you build that login form.

The tag will render the opening and closing <form> HTML elements for you. The rest of the form markup is up to you as long as you have an email and password input field.

Example

{{ user:login_form }}
 
{{ if errors }}
<div class="bg-red-300 text-white p-2">
{{ errors }}
{{ value }}<br>
{{ /errors }}
</div>
{{ /if }}
 
{{ if success }}
<div class="bg-green-300 text-white p-2">
{{ success }}<br>
</div>
{{ /if }}
 
<label>Email</label>
<input type="email" name="email" value="{{ old:email }}" />
 
<label>Password</label>
<input type="password" name="password" value="{{ old:password }}" />
 
<button type="submit">Log in</button>
 
{{ /user:login_form }}

Parameters

redirect

string

Where the user should be taken after successfully logging in.

error_redirect

string

The same as redirect, but for failed logins.

allow_request_redirect

boolean

When set to true, the redirect and error_redirect parameters will get overridden by redirect and error_redirect query parameters in the URL.

HTML Attributes

Set HTML attributes as if you were in an HTML element. For example, class="required" id="login-form".

Variables

Variable Type Description

errors

array

An array of validation errors.

old

array

An array of previously submitted values.

success

string

A success message.

Docs feedback

Submit improvements, related content, or suggestions through Github.

Betterify this page →
Hello there! Are you looking for the Statamic v2 documentation?