DotAdmin User Guide
The Login / Logout Template

The Login Template
The login page can be presented to the visitor for a number of reasons. The visitor may request the Login page directly, or it may be shown because the visitor requested a page in a protected area which he does not have access to. The Login template also displays messages for a successful login attempt, and a “logged out” message.
Because this template has to display so many different messages, it uses a lot of conditional instructions to only display the appropriate messages each time it is displayed. Below, we will cover each condition in turn, and any placeholders relevant to those conditions.
Logout Messages
At the top of the Login template are the Logout messages. The Login form is also displayed immediately following a successful logout.
|
Placeholder
|
Output
|
|
IF {logout}
|
Displayed following a successful logout.
|
|
IF {not_logged_in}
|
Displayed if a user tries to log out when he/she is not logged in.
|
|
IF {logout_failed}
|
Displayed if a user tried to logout but the system failed to log him out (unlikely).
|
Restricted Access Messages
If the user tries to view a page which he/she is not permitted to view, the Login page is called to inform the user exactly why he/she couldn't view that page. The login form may also be displayed if the visitor is not already logged-in.
If the requested page is within a “Privileged” zone, we can display a different form to logged-in users, allowing them to apply for access to that zone.
<!-- IF {privileged} -->
<!-- BLOCK {priv_apply} -->
<form method="post" action="/content/{ref}">
<input type="hidden" name="form" value="apply" />
<input type="checkbox" name="priv_{ref}" /> I would like
to apply for access to the content within the {ref_title}
section of this site.
<input type="submit" name="Submit" value="apply" />
</form>
<!-- /BLOCK {priv_apply} -->
<!-- BLOCK {priv_applied} -->
<p>Your access request has been received.</p>
<!-- /BLOCK {priv_applied} -->
<!-- /IF {privileged} -->
A Privilege Application Form.
Note that the the name of the form is “apply” and the name of the checkbox is “priv_{ref}”. These names must always be used, to tell the Login page that it is processing an application, not a login attempt.
Note also that there are two placeholders in use in the example above. The first, {ref}, is the ID (url) of the page the user is requesting access to. The second, {ref_title} is, predictably, the title of that page.
|
Placeholder
|
Output
|
|
IF {title_priv}
|
Displays a “Not Authorised” title instead of a “Login” title, if the user is logged-in but has not been granted access to view this page.
|
|
IF {members}
|
Displayed if the page requested is members-only and the user is not logged in. The default offers a link to the User Signup page.
|
|
IF {privileged}
|
Displayed if the page requested is only available to privileged users (access granted by a site admin), and the user is either not logged in or does not have access.
|
|
BLOCK {priv_apply}
|
If the user is logged-in, but does not have access, we can display a form here for requesting access.
|
|
{ref}
|
BLOCK {priv_apply} only: Placeholder denotes the page (url) this user is applying for access to.
|
|
{ref_title}
|
BLOCK {priv_apply} only: Placeholder for the title of the page this user is applying for access to.
|
|
BLOCK {priv_applied}
|
Display a message to state that the privilege application has been received.
|
|
IF {priv_login}
|
Displayed if the user is not logged-in and has requested a privileged page, to ask the user to log-in, or create an account.
|
Login Messages
Finally we come to the standard Login form and its messages. The basic Login section is at the end of the template because the Login form is often required to be displayed after the messages covered in the previous sections.
Important! The form field names in a login template must not be changed.
<form method="post" action="/content/{ref}">
<input type="hidden" name="form" value="login">
<input type="hidden" name="nextpage" value="{nextpage}">
Username: <input type="text" name="input_uname" maxlength="12">
Password: <input type="password" name="input_pword"><br>
(<a href="/content/recover_pwd/">Forgotten your password</a>?)
<b>Remember Me: </b><input type="checkbox" name="remember">
<input type="submit" name="submit" value="Login">
</form>
The Login Form.
The login form, shown above, has the same action attribute as the privilege application form: “/content/{ref}”. It also has two required fields which pass the name of the form being submitted (“login”), and the page to be displayed following a successful login (filled in by the system using the placeholder {nextpage})
There are of course also a handful of conditional instructions to display various messages to the user during the login process. These and all other login-related template elements are described in the table below.
|
Placeholder
|
Output
|
|
IF {login_failed}
|
Displayed if the username and password supplied are not valid.
|
|
IF {login}
|
Used to display a “Please log in” courtesy message along with the form.
|
|
IF {logged_in}
|
Displayed if the page requested is only available to privileged users (access granted by a site admin), and the user is either not logged in or does not have access.
|
|
IF {login_successful}
|
Displays a success message, and a link to the edit user details page.
|
|
BLOCK {form}
|
Contains the Login form.
|
|
{ref}
|
BLOCK {login} only: The ID (url) of the page which is sending the login request.
|
|
{nextpage}
|
BLOCK {login} only: The ID (url) of the page to display following a successful login.
|
|
IF {returning}
|
Used for displaying a link back to the home page.
|
|