The Login

From Wiki

Jump to: navigation, search

WebRatio provides two different ways to log in a Web application.

  • the explicit login. This login is used when you explicitely model in your Web project the login form. The pattern is composed by an Entry Unit having two fields (username and password) and the Login Unit. Remember that it is important to model the KO link outgoing from the Login Unit, because it tells the Web application where to redirect the user if he types in uncorrect data. The OK link of the Login Unit, instead, usually it is not necessary. The only case in which this link is considered, is when the user that tries to log in belongs to a group for which a default protected module is not defined. So, in this case, you can redirect the user explicitely to a page, connecting the page with the Login Unit. The following figure shows a complete example. This type of login is useful when you want to model the login form in a page of your Web application which shows other content. If you have to model a single page for the login, use the implicit login instead.
  • the implicit login. WebRatio automatically generates a login page for each module you defined as protected using the Protected property in the Properties View. This page is shown to the user when the Web application can not find the user rights for that module. This are the steps used by the Web application to check user access rights
    1. Consider the default group of the user.
    2. If the default group has the current module as default module, the user is redirected to the protected module.
    3. If the default group has not the current module as default one, then all other modules connected to the default groups are considered.
    4. If there isn't a connection between the default group and the current module, all the other groups connected to the current user are considered.
    5. If there is a connection between one of the groups and the current module, the user is redirected to the protected module.
    6. If any connection has been found, the user is redirected to the login page generated for the current module.


WebRatio allows you to customize the rendering of the login pages automatically generated. This is possible thanks to the Login Template. To create a new Login Template you have to:

  1. Select Menu -> New -> Other -> Special Style Page from the main menu
  2. Select "Login" for the Page Type
  3. Choose the Style Project in which you want to place the template
  4. Type a name for the template
  5. Click on the Finish button

After you completed these steps, WebRatio automatically creates a new template with all the HTML code necessary to render a login form. This template is particular because you can write only HTML, JSP and JSTL code. You can not use WR tags and script Groovy. The reason is that what you want to do is to change only the graphic of the page. This template is used by WebRatio to generate the login pages. Using this template, you can also add JSTL code in order to redirect the Web application to your specific login page that you have modeled in your Web project and let the user do the explicit login. Here is the code you need to write to do the redirect:

<c:redirect url="pageX.do"/>

where pageX is the Id of the login page in your Web model.

Personal tools