Prepare to add functions to validate passwords.

This commit is contained in:
Laurent Destailleur 2009-08-21 17:08:15 +00:00
parent 6cf39c7a91
commit dace319301
3 changed files with 53 additions and 27 deletions

View File

@ -80,14 +80,23 @@ class modGeneratePassNone extends ModeleGenPassword
} }
/** /**
* \brief G<EFBFBD>n<EFBFBD>re le mot de passe * \brief Build new password
* \return string Renvoi mot de passe g<EFBFBD>n<EFBFBD>r<EFBFBD> * \return string Return a new generated password
*/ */
function getNewGeneratedPassword() function getNewGeneratedPassword()
{ {
return ""; return "";
} }
/**
* \brief Validate a password
* \return int 0 if KO, >0 if OK
*/
function validatePassword($password)
{
return 1;
}
} }
?> ?>

View File

@ -80,8 +80,8 @@ class modGeneratePassStandard extends ModeleGenPassword
} }
/** /**
* \brief Genere le mot de passe * \brief Build new password
* \return string Renvoi mot de passe genere * \return string Return a new generated password
*/ */
function getNewGeneratedPassword() function getNewGeneratedPassword()
{ {
@ -114,6 +114,15 @@ class modGeneratePassStandard extends ModeleGenPassword
return $password; return $password;
} }
/**
* \brief Validate a password
* \return int 0 if KO, >0 if OK
*/
function validatePassword($password)
{
if (strlen($password) < $this->length) return 0;
return 1;
}
} }
?> ?>

View File

@ -1,5 +1,5 @@
<?php <?php
/* Copyright (C) 2007 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2007-2009 Laurent Destailleur <eldy@users.sourceforge.net>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -18,20 +18,18 @@
*/ */
/** /**
\file htdocs/includes/modules/facture/modules_genpassword.php * \file htdocs/includes/modules/security/generate/modules_genpassword.php
\ingroup core * \ingroup core
\brief Fichier contenant la classe mère de generation des mots de passe * \brief Fichier contenant la classe m<EFBFBD>re de generation des mots de passe
\version $Id$ * \version $Id$
*/ */
require_once(DOL_DOCUMENT_ROOT.'/lib/functions.lib.php'); require_once(DOL_DOCUMENT_ROOT.'/lib/functions.lib.php');
/** /**
\class ModeleGenPassword * \class ModeleGenPassword
\brief Classe mère des modèles de generation des mots de passe * \brief Parent class for password rules/management modules
*/ */
class ModeleGenPassword class ModeleGenPassword
{ {
var $error=''; var $error='';
@ -65,14 +63,24 @@ class ModeleGenPassword
} }
/** /**
* \brief Génère le mot de passe * \brief Build new password
* \return string Renvoi mot de passe généré * \return string Return a new generated password
*/ */
function getNewGeneratedPassword() function getNewGeneratedPassword()
{ {
global $langs; global $langs;
return $langs->trans("NotAvailable"); return $langs->trans("NotAvailable");
} }
/**
* \brief Validate a password
* \return int 0 if KO, >0 if OK
*/
function validatePassword($password)
{
return 1;
}
} }
?> ?>