# Login

The login page is the first page the user sees when opening LAM. It manages LDAP authentication and checks the environment of the user.

## login.php

The login page offers authentication, language selection and profile selection. There are also some environment checks.

### Authentication

The list of possible users is loaded from the current active profile. Only the RDN value is offered for selection by the user.
When the user submits his password then a new Ldap object is created and LAM tries to connect to the LDAP server.
If the connection was successful the user is forwarded to the main frame (main.php). The session variable $_SESSION['loggedIn'] is set to true. This informs the other PHP scripts that a valid user is connected (e.g. the user is allowed to create account profiles).

### Language selection

The list of possible languages is read from config/language. The current active profile defines the preselected language and the language of the login page itself.

### Profile selection

The user can change the active configuration profile at login. A list of possible profiles is retrieved by getConfigProfiles().
If the profile is changed then the login replaces the config object in $_SESSION['config'] by a new one. Then the main login page is loaded and uses the new values.

### Environment checks

LAM checks if all needed PHP extensions are installed.

- LDAP: PHP needs LDAP support
- Gettext: needed for translation