diff options
author | ramon <ramongomez@us.es> | 2012-11-06 12:56:20 +0000 |
---|---|---|
committer | ramon <ramongomez@us.es> | 2012-11-06 12:56:20 +0000 |
commit | df440ce7a78ba6bbe51008980d39c105147d2f56 (patch) | |
tree | aae2557ef7fb8366a5af94cf1959f7a87abef3bd /admin/WebConsole/validacion/html | |
parent | e79394ebd9a818eaee87169576c821451ff81206 (diff) |
Versión 1.0.5, #453: Integrar código del ticket:453, autenticación para acceso a clientes.
git-svn-id: https://opengnsys.es/svn/branches/version1.0@3397 a21b9725-9963-47de-94b9-378ad31fedc9
Diffstat (limited to 'admin/WebConsole/validacion/html')
-rw-r--r-- | admin/WebConsole/validacion/html/close.php | 5 | ||||
-rw-r--r-- | admin/WebConsole/validacion/html/images/opengnsys.png | bin | 0 -> 7003 bytes | |||
-rw-r--r-- | admin/WebConsole/validacion/html/login_prueba.php | 102 | ||||
-rw-r--r-- | admin/WebConsole/validacion/html/validacion_ldap.php | 75 | ||||
-rw-r--r-- | admin/WebConsole/validacion/html/validacion_prueba.php | 24 | ||||
-rw-r--r-- | admin/WebConsole/validacion/html/validacion_template.php | 20 |
6 files changed, 226 insertions, 0 deletions
diff --git a/admin/WebConsole/validacion/html/close.php b/admin/WebConsole/validacion/html/close.php new file mode 100644 index 00000000..11a3c2e8 --- /dev/null +++ b/admin/WebConsole/validacion/html/close.php @@ -0,0 +1,5 @@ +<? +session_start(); +$_SESSION["validated"] = false; +?> + diff --git a/admin/WebConsole/validacion/html/images/opengnsys.png b/admin/WebConsole/validacion/html/images/opengnsys.png Binary files differnew file mode 100644 index 00000000..72e5df72 --- /dev/null +++ b/admin/WebConsole/validacion/html/images/opengnsys.png diff --git a/admin/WebConsole/validacion/html/login_prueba.php b/admin/WebConsole/validacion/html/login_prueba.php new file mode 100644 index 00000000..78b3c5ae --- /dev/null +++ b/admin/WebConsole/validacion/html/login_prueba.php @@ -0,0 +1,102 @@ +<? +$path_parts = pathinfo(__FILE__); +?> + +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> +<title>OpenGnSys :::: Inicio de equipo - Men de opciones</title> +<style> + body { + margin:0; + padding:0; + background-color:#FFFFFF; +} +#contenedor{ + position:absolute; + /*width:1270px; + height:1014px; + */ + margin:0; + padding:0; +/* + left: 50%; + top: 50%; + margin-top: -512px; + margin-left: -640px; +*/ + overflow:hidden; +} +.boton{ + margin:0 0 0 40px; +} +#form1{ + margin:120px 0 0 200px; +} +img { + vertical-align:middle; +} +a:link, a:visited { text-decoration: none; color:#ffffff; } +a:hover, a:active { color:#ffff00; } +/*#menu{ + width:800px; + height:600px; + +}*/ +h1{ + margin:120px auto 0px auto; + padding:0; + width:624px; + height:0px; + /*background:url(../menus/imagenes/titulo.png);*/ +} + +.tituloElementoLista { + padding:0 0 0 10px; +} +.descripcionElementoLista { + color:#acd6ff; + position:absolute; + left:360px; + padding-top:15px; +} +</style> + +</head> + +<body> + <div id="contenedor" style="margin: 10px 300px 15px 300px"> + <div align="center"> + <h1> + <div style="float:left"> + <img src="../validacion/html/images/opengnsys.png" /> + </div> + Validación de usuario</h1> + </div> + <div id="menu" style="margin: 0px auto 0px auto"> + <h1></h1> + <form id="form1" name="form1" method="post" action="../validacion/access_controller.php"> + <div> + usuario: + </div> + <div> + <input type="text" name="login" id="login"> + </div> + <br /> + <div> + password: + </div> + <div> + <input type="password" name="password" id="password"> + </div> + <br /> + <p><span class="boton"><input type="submit" name="access_button" id="access_button" value="Acceder" /></span></p> + <input name="action" type="hidden" value="validate" /> + </form> + <span class="descripcionElementoLista"><?php if(isset($_error)) echo $_error; ?></span> + </div> + </div> +</body> +</html> + diff --git a/admin/WebConsole/validacion/html/validacion_ldap.php b/admin/WebConsole/validacion/html/validacion_ldap.php new file mode 100644 index 00000000..992bca05 --- /dev/null +++ b/admin/WebConsole/validacion/html/validacion_ldap.php @@ -0,0 +1,75 @@ +<? + +function connect_to_ldap(){ + $server = "IP_SERVIDOR"; + $port = '389'; + $user = "USUARIO"; + $pass = "PASSWORD"; + + $result = null; + $ds=ldap_connect($server,$port); + if ($ds){ + if ($r=@ldap_bind($ds,$user,$pass)) + $result = $ds; + } + return $result; +} + +function validate_user($user,$password){ + if (($user=='') || ($password=='')){ + $result['validation'] = -1; + }else{ + if($ds = connect_to_ldap()){ + $dc = "dc=uhu, dc=es"; + $search = "uid=".$user; + $sr=@ldap_search($ds,$dc,$search); + $info = @ldap_get_entries($ds, $sr); + + if ($info["count"]==1){ + $thedata = $info[0]["dn"]; + if ($r=@ldap_bind($ds,$thedata,$password)){ + $result['validation'] = 1; + // A parte de la validacion, se podrían coger otros datos... + /* + $result['name'] = $info[0]["cn"][0]; + $result['dni'] = $info[0]["uhuuserdni"][0]; + $result['email'] = $info[0]["mail"][0]; + */ + } + else{ + $result['validation'] = -1; + } + } + else{ + $result['validation'] = -1; + } + } + ldap_close($ds); + } + return $result; +} + +/** + * Sincroniza una base de datos externa con la de opengnsys. + * No es necesaria su implementacion, puede dejarse en blanco + */ +function synchronize($validation){ + +} + + +/** + * Funcion de validacion para el cliente opengnsys. + * Recibe como parametros la variable $_POST proveniente de la pagina de login + * debe devolver true o false + */ +function validate($VARS){ + $result=false; + $validationInfo = validate_user($VARS["login"], $VARS["password"]); + if($validationInfo["validation"] == 1){ + $result = true; + } + return $result; +} + +?> diff --git a/admin/WebConsole/validacion/html/validacion_prueba.php b/admin/WebConsole/validacion/html/validacion_prueba.php new file mode 100644 index 00000000..35c6c033 --- /dev/null +++ b/admin/WebConsole/validacion/html/validacion_prueba.php @@ -0,0 +1,24 @@ +<? +/** + * Sincroniza una base de datos externa con la de opengnsys. + * No es necesaria su implementacion, puede dejarse en blanco + */ +function synchronize($validation){ + +} + + +/** + * Funcion de validacion para el cliente opengnsys. + * Recibe como parametros la variable $_POST proveniente de la pagina de login + * debe devolver true o false + */ +function validate($VARS){ + $result = false; + if($VARS["login"] == "usuprueba" && $VARS["password"] == "prueba"){ + $result = true; + } + return $result; +} + +?> diff --git a/admin/WebConsole/validacion/html/validacion_template.php b/admin/WebConsole/validacion/html/validacion_template.php new file mode 100644 index 00000000..77672a91 --- /dev/null +++ b/admin/WebConsole/validacion/html/validacion_template.php @@ -0,0 +1,20 @@ +<? +/** + * Sincroniza una base de datos externa con la de opengnsys. + * No es necesaria su implementacion, puede dejarse en blanco + */ +function synchronize($validation){ + +} + + +/** + * Funcion de validacion para el cliente opengnsys. + * Recibe como parametros la variable $_POST proveniente de la pagina de login + * debe devolver true o false + */ +function validate($VARS){ + return true; +} + +?> |