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="text" 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. |