mirror of
https://github.com/YunoHost-Apps/paheko_ynh.git
synced 2024-09-03 19:56:22 +02:00
fix
This commit is contained in:
parent
548379dbc5
commit
0d6fed4707
2 changed files with 6 additions and 50 deletions
|
@ -58,56 +58,9 @@ const SECRET_KEY = '__SECRET_KEY__';
|
||||||
|
|
||||||
//const LOCAL_LOGIN = null;
|
//const LOCAL_LOGIN = null;
|
||||||
|
|
||||||
const LDAP_HOST = 'localhost';
|
const LOCAL_LOGIN = [
|
||||||
const LDAP_DN = 'cn=%s,ou=users,dc=yunohost,dc=org';
|
|
||||||
|
|
||||||
session_start();
|
|
||||||
|
|
||||||
if (empty($_SESSION['ldap_user']) && !empty($_POST['ldap_login']) && !empty($_POST['ldap_password'])) {
|
|
||||||
$l = ldap_connect(LDAP_HOST) || die('Connexion impossible');
|
|
||||||
ldap_set_option($l, LDAP_OPT_PROTOCOL_VERSION, 3);
|
|
||||||
ldap_set_option($l, LDAP_OPT_REFERRALS, 0);
|
|
||||||
ldap_set_option($l, LDAP_OPT_NETWORK_TIMEOUT, 10);
|
|
||||||
|
|
||||||
$login = trim($_POST['ldap_login']);
|
|
||||||
|
|
||||||
if (ldap_bind($l, sprintf(LDAP_DN, $login), $_POST['ldap_password'])) {
|
|
||||||
$_SESSION['ldap_user'] = $login;
|
|
||||||
}
|
|
||||||
|
|
||||||
ldap_close($l);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (empty($_SESSION['ldap_user'])) {
|
|
||||||
echo '<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<body>
|
|
||||||
<form method="post" action="">';
|
|
||||||
|
|
||||||
if (!empty($_POST['ldap_login'])) {
|
|
||||||
echo '<p style="color: red">Identifiants invalides</p>';
|
|
||||||
}
|
|
||||||
|
|
||||||
echo '
|
|
||||||
<fieldset>
|
|
||||||
<legend>Connexion</legend>
|
|
||||||
<dl>
|
|
||||||
<dt>Login</dt>
|
|
||||||
<dd><input type="text" name="ldap_login" required /></dd>
|
|
||||||
<dt>Mot de passe</dt>
|
|
||||||
<dd><input type="password" name="ldap_password" required /></dd>
|
|
||||||
</dl>
|
|
||||||
<p><input type="submit" value="Connexion" /></p>
|
|
||||||
</fieldset>
|
|
||||||
</form>
|
|
||||||
</body>
|
|
||||||
</html>';
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
define('Garradin\LOCAL_LOGIN', [
|
|
||||||
'user' => [
|
'user' => [
|
||||||
'_name' => $_SESSION['ldap_user'],
|
'_name' => '__ADMIN__',
|
||||||
],
|
],
|
||||||
'permissions' => [
|
'permissions' => [
|
||||||
'users' => 9,
|
'users' => 9,
|
||||||
|
@ -116,7 +69,7 @@ define('Garradin\LOCAL_LOGIN', [
|
||||||
'documents' => 9,
|
'documents' => 9,
|
||||||
'config' => 9,
|
'config' => 9,
|
||||||
],
|
],
|
||||||
]);
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Autoriser (ou non) l'import de sauvegarde qui a été modifiée ?
|
* Autoriser (ou non) l'import de sauvegarde qui a été modifiée ?
|
||||||
|
|
|
@ -38,6 +38,9 @@ ram.runtime = "50M"
|
||||||
type = "group"
|
type = "group"
|
||||||
default = "visitors"
|
default = "visitors"
|
||||||
|
|
||||||
|
[install.admin]
|
||||||
|
type = "user"
|
||||||
|
|
||||||
[resources]
|
[resources]
|
||||||
[resources.sources.main]
|
[resources.sources.main]
|
||||||
url = "https://fossil.kd2.org/paheko/uv/paheko-1.3.0.tar.gz"
|
url = "https://fossil.kd2.org/paheko/uv/paheko-1.3.0.tar.gz"
|
||||||
|
|
Loading…
Add table
Reference in a new issue