modGeneratePassNone.class.php 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. <?php
  2. /* Copyright (C) 2006-2011 Laurent Destailleur <eldy@users.sourceforge.net>
  3. *
  4. * This program is free software; you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License as published by
  6. * the Free Software Foundation; either version 3 of the License, or
  7. * (at your option) any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  16. * or see http://www.gnu.org/
  17. */
  18. /**
  19. * \file htdocs/core/modules/security/generate/modGeneratePassNone.class.php
  20. * \ingroup core
  21. * \brief File to manage no password generation.
  22. */
  23. require_once DOL_DOCUMENT_ROOT .'/core/modules/security/generate/modules_genpassword.php';
  24. /**
  25. * \class modGeneratePassNone
  26. * \brief Class to generate a password according to rule 'no password'
  27. */
  28. class modGeneratePassNone extends ModeleGenPassword
  29. {
  30. /**
  31. * @var int ID
  32. */
  33. public $id;
  34. public $length;
  35. /**
  36. * @var DoliDB Database handler.
  37. */
  38. public $db;
  39. public $conf;
  40. public $lang;
  41. public $user;
  42. /**
  43. * Constructor
  44. *
  45. * @param DoliDB $db Database handler
  46. * @param Conf $conf Handler de conf
  47. * @param Translate $langs Handler de langue
  48. * @param User $user Handler du user connecte
  49. */
  50. function __construct($db, $conf, $langs, $user)
  51. {
  52. $this->id = "none";
  53. $this->length = 0;
  54. $this->db=$db;
  55. $this->conf=$conf;
  56. $this->langs=$langs;
  57. $this->user=$user;
  58. }
  59. /**
  60. * Return description of module
  61. *
  62. * @return string Description of text
  63. */
  64. function getDescription()
  65. {
  66. global $langs;
  67. return $langs->trans("PasswordGenerationNone");
  68. }
  69. /**
  70. * Return an example of password generated by this module
  71. *
  72. * @return string Example of password
  73. */
  74. function getExample()
  75. {
  76. return $this->langs->trans("None");
  77. }
  78. /**
  79. * Build new password
  80. *
  81. * @return string Return a new generated password
  82. */
  83. function getNewGeneratedPassword()
  84. {
  85. return "";
  86. }
  87. /**
  88. * Validate a password
  89. *
  90. * @param string $password Password to check
  91. * @return int 0 if KO, >0 if OK
  92. */
  93. function validatePassword($password)
  94. {
  95. return 1;
  96. }
  97. }