# documentation:2.0:portalcustom
Keywords: documentation,2.0,portalcustom

# Portal customization

The portal is the visible part of LemonLDAP::NG, all user interactions are displayed on it.

## Skin

LemonLDAP::NG is shipped with 4 skins:

- pastel
- impact
- dark
- bootstrap

It is recommended to use `bootstrap` skin, as other may be deprecated in the future.

But you can make your own, see Skin customization below.

### Default skin

You can change the default skin in Manager: `General Parameters` > `Portal` > `Customization` > `Default skin`.

Select the `Custom` skin, then set the name of the skin you want to use in the input below.

### Skin background

Go in `General Parameters` > `Portal` > `Customization` > `Skin background`. You can define a background by selecting one of the available image. Use `None` to use the default skin background configuration.

### Skin rules

You might want to display different skin depending on the URL that was called before being redirected to the portal, or the IP address of the user.

To achieve this, you can create a rule in the Manager: select `General Parameters` > `Portal` > `Customization` > `Skin display rules` on click on “New key”. Then fill the two fields;

- Rule: a Perl expression (you can use %ENV hash to get environment variables, or $_url to get URL called before redirection, or $ipAddr to use user IP address). If the rule evaluation is true, the corresponding skin is applied.
- Skin: the name of the skin to use.

### Skin files

A skin is composed of different files:

- .tpl: Perl HTML::Template files, for HTML content
- .css: CSS (styles)
- .js: Javascript
- images and other media files

A skin will often refer to the `common` skin, which is not a real skin, but shared skin objects (like scripts, images and CSS).

### Skin customization

If you modify directly the skin files, your modifications will certainly be erased on the next upgrade.

To customize a skin, the simplest way is to create a new skin folder:

    cd portal/skins
    mkdir myskin
    mkdir myskin/css
    mkdir myskin/images

Then create symbolic links on template files, as you might not want to rewrite all HTML code (else, do as you want).

    cd myskin
    ln -s ../pastel/*.tpl .

We include some template files that can be customized:

- customhead.tpl : HTML header markups (like CSS, js inclusion)
- customheader.tpl : HTML code int the header div
- customfooter.tpm : HTML code in the footer div

To use custom files, delete links and copy them into your skin folder:

    rm custom*
    cp ../pastel/custom* .

Then you only have to write `myskin/css/styles.css` and add your media to `myskin/images`. Put all custom HTML code in the custom template files.

To configure your new skin in Manager, select the custom skin, and enter your skin name in the configuration field.

### Messages

Messages are defined in source code. If they really do not please you, override them! You just need to know the ID of the message (look at Portal/Simple.pm) and then add to `lemonldap-ng.ini`:

    [portal]

    # Custom error messages
    error_0 = Big brother is watching you, authenticated user

    # Custom standard messages
    msg_22 = Your last connections

You can alse define messages in several languages:

    [portal]
    error_en_0 = Big brother is watching you, authenticated user
    error_fr_0 = Souriez vous êtes surveillés !

### Template parameters

Template parameters are defined in source code. If you need to add a template parameter for your customization, then add to `lemonldap-ng.ini`:

    [portal]

    # Custom template parameters
    tpl_myparam = world

Then you will be able to use it in your template like this:

    Hello <TMPL_VAR NAME="myparam">!

## Buttons

This node allows to enable/disable buttons on the login page:

- Check last logins: displays a checkbox on login form, allowing user to check his login history right after opening session
- Reset password: display a link to reset your password page (for password based authentication backends)
- Register: display a link to register page (for password based authentication backends)

## Password management

- Require old password: used only in the password changing module of the menu, will check the old password before updating it
- Hide old password: used only if the password need to be reset by the user (LDAP password policy), will hide the old password input
- Send mail on password change: send a mail if the password is changed from the Menu, or from forced password reset (LDAP password policy)

## Other parameters

- User attribute: which session attribute will be used to display `Connected as` in the menu
- New window: open menu links in new window
- Anti iframe protection: will kill parent frames to avoid some well known attacks
- Ping interval: Number of milliseconds between each ping (Ajax request) on the portal menu. Set to 0 to dismiss checks.