File: login.php

package info (click to toggle)
phpldapadmin 1.2.6.3-0.3%2Bdeb12u1
  • links: PTS
  • area: main
  • in suites: bookworm
  • size: 6,836 kB
  • sloc: php: 17,571; javascript: 5,299; xml: 1,498; sh: 346; makefile: 26
file content (54 lines) | stat: -rw-r--r-- 1,650 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<?php
/**
 * Log the user in.
 *
 * @package phpLDAPadmin
 * @subpackage Page
 */

/**
 */

require './common.php';

$pass = true;
if ($_SESSION[APPCONFIG]->getValue('session', 'reCAPTCHA-enable')) {
    $pass = !IsRobot(get_request('g-recaptcha-response'));
}

if ($pass) {
    $user             = array();
    $user['login']    = get_request('login');
    $user['password'] = get_request('login_pass', 'POST', false, '');

    if ($user['login'] && !strlen($user['password'])) {
        system_message(array(
            'title' => _('Authenticate to server'),
            'body'  => _('You left the password blank.'),
            'type'  => 'warn'),
            sprintf('cmd.php?cmd=login_form&server_id=%s', get_request('server_id', 'REQUEST')));
    }

    if ($app['server']->login($user['login'], $user['password'], 'user')) {
        system_message(array(
            'title' => _('Authenticate to server'),
            'body'  => _('Successfully logged into server.'),
            'type'  => 'info'),
            sprintf('cmd.php?server_id=%s', get_request('server_id', 'REQUEST')));
    } else {
        system_message(array(
            'title' => _('Failed to Authenticate to server'),
            'body'  => _('Invalid Username or Password.'),
            'type'  => 'error'),
            sprintf('cmd.php?cmd=login_form&server_id=%s', get_request('server_id', 'REQUEST')));
    }

} else {
    system_message(array(
        'title' => _('Authenticate to server'),
        'body'  => _('Incorrect captcha.'),
        'type'  => 'warn'),
        sprintf('cmd.php?cmd=login_form&server_id=%s', get_request('server_id', 'REQUEST')));
}

?>