The user interface has been simplified in Dreamweaver CC and later. As a result, you may not find some of the options described in this article in Dreamweaver CC and later. For more information, see this article.
Your web application can contain a page that lets registered users log in to the site.
A login page is made up of the following building blocks:
A database table of registered users
An HTML form to let users enter a user name and password
A Log In User server behavior to make sure the entered user name and password are valid
A session variable consisting of the user name is created for the user when the user logs in successfully.
You need a database table of registered users to verify that the user name and password entered in the login page are valid.
- Add an HTML form by placing the insertion point where you want the form to appear and choosing Form from the Insert menu.
- Name the HTML form by clicking the <form> tag at the bottom of the Document window to select the form, opening the Property inspector (Window > Properties), and entering a name in the Form Name box.
You can change the label of the Submit button by selecting the button, opening the Property inspector (Window > Properties), and entering a new value in the Label box.
The next step in building a login page is to add the Log In User server behavior to verify that the entered user name and password are valid.
You must add a Log In User server behavior to the login page to ensure that the user name and password that a user enters are valid.
When a user clicks the Submit button on the login page, the Log In User server behavior compares the values entered by the user against the values for registered users. If the values match, the server behavior opens one page (usually the site’s Welcome screen). If the values do not match, the server behavior opens another page (usually a page alerting the user that the login attempt failed).
- If you want users forwarded to the login page after attempting to access a restricted page to return to that restricted page after logging in, select the Go To Previous URL option.
If a user tries to access your site by opening a restricted page without first logging in, the restricted page can forward the user to the login page. After the user logs in successfully, the login page redirects the user to the restricted page that forwarded them to the login page in the first place.
When you complete the dialog box for the Restrict Access To Page server behavior on these pages, ensure that you specify your login page in the If Access Denied, Go To box.