_identification.php 3.28 KB
Newer Older
1
<?php
2 3 4
/**
 * Copyright (c) 2012, Agence Française Informatique (AFI). All rights reserved.
 *
Laurent's avatar
Laurent committed
5
 * BOKEH is free software; you can redistribute it and/or modify
6 7 8 9 10 11
 * it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE as published by
 * the Free Software Foundation.
 *
 * There are special exceptions to the terms and conditions of the AGPL as it
 * is applied to this software (see README file).
 *
Laurent's avatar
Laurent committed
12
 * BOKEH is distributed in the hope that it will be useful,
13 14 15 16 17
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU AFFERO GENERAL PUBLIC LICENSE for more details.
 *
 * You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE
Laurent's avatar
Laurent committed
18
 * along with BOKEH; if not, write to the Free Software
19
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA
20
 */
21

22 23 24
if (isset($_REQUEST['admin_login'])) {
  $user = trim($_REQUEST['admin_login']);
  $passe = trim($_REQUEST['admin_pwd']);
25 26
}

27 28 29 30 31 32 33 34 35 36 37 38 39
function cosmo_auth($user, $passe, $cfg) {
  $sgbd_user = getVariable('admin_login');
  $sgbd_passe = getVariable('admin_pwd');

  if ($user == $sgbd_user && $passe == $cfg['pwd_master'])
    return 'admin_systeme';

  if ($user == $sgbd_user && $passe == $sgbd_passe )
    return 'admin_portail';

  if ($user == getVariable('catalog_login') && $passe == getVariable('catalog_pwd'))
    return 'catalogueur';

40 41
  if (($bokeh_user = Class_Users::findFirstBy(['login' => $user]))
      && $bokeh_user->verifyPassword($passe)
42 43 44 45 46
      && $bokeh_user->isSuperAdmin())
    return 'admin_systeme';
}


47
// Controle de l'identification
48 49 50 51 52 53
if ($user
    && ($_SESSION['passe'] = cosmo_auth($user, $passe, $cfg))) {
  if ($mode_cron || $mode_web_service)
    return;

  redirection(URL_BASE);
54 55 56
}

// Add CG
57 58
if ($argc > 1)
  return true ;
59 60

// Mode web_service on renvoie une erreur
61 62 63 64
if($mode_web_service) {
  require_once 'classe_transaction_opac.php';
  $transac = new transaction_opac();
  $transac->erreur('Identification user ou mot de passe incorrect');
65 66 67
}

// On demande l'identification
68 69
if (!defined('APPLI'))
  exit;
70 71 72
?>
<html>
<head>
73 74 75
  <meta http-equiv="Content-Type" content="text/html;charset="UTF-8">
  <link rel="stylesheet" type="text/css" media="screen" href="<?php print(URL_BASE) ?>css/main.css"/>
  <link rel="stylesheet" type="text/css" media="screen" href="<?php print(URL_BASE) ?>css/form.css"/>
76 77 78
</head>
<body overflow="hidden">
<div  style="background-color:#f0f2f0" width="100%">
79
  <img src="<?php print(URL_IMG) ?>banniere.png">
80 81 82 83
</div>
<br><br><br><br><br><br>
<center>
<div class="form" style="width:350px;">
84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101
<form method="post" action="<?php print(URL_BASE) ?>index.php">
  <table class="form" width="100%" align="center">
    <tr>
      <th class="form" colspan="2">Identification administrateur du portail</td>
    </tr>
    <tr><td class="form">&nbsp;</td></tr>
    <tr>
      <td class="form" align="right">Utilisateur</td>
      <td class="form"><input type="text" name="admin_login"></td>
    </tr>
    <tr>
      <td class="form" align="right" style="height:50px">Mot de passe</td>
      <td class="form" style="height:50px"><input type="password" name="admin_pwd"></td>
    </tr>
    <tr>
      <th class="form" colspan="2"><input type="submit" class="bouton" value="Valider"></th>
    </tr>
  </table>
102 103
</form>
</div>
104 105
</body>
</html>
106

107
<?php
108 109
exit;
?>