示例#1
0
 /**
  * @see parent::check()
  */
 function check()
 {
     // Standard check
     if ($msg = parent::check()) {
         return $msg;
     }
     // Creation d'un patient
     $manage_identity_status = CAppUI::conf("dPpatients CPatient manage_identity_status", CGroups::loadCurrent());
     if (!$this->_merging && !$manage_identity_status) {
         if ($this->loadMatchingPatient(true, false) > 0) {
             return "Doublons détectés";
         }
     }
     if ($manage_identity_status && $this->status == "VALI" && !CAppUI::pref("allowed_identity_status")) {
         if ($this->fieldModified("nom") || $this->fieldModified("prenom") || $this->fieldModified("naissance") || $this->fieldModified("nom_jeune_fille")) {
             return "Vous n'avez pas les droits pour modifier les traits strict du patient";
         }
     }
     return null;
 }
 /**
  * @see parent::check()
  */
 function check()
 {
     // TODO: voir a fusionner cette fonction avec celle de admin.class.php qui est exactement la meme
     // Chargement des specs des attributs du mediuser
     $this->updateSpecs();
     $specs = $this->getSpecs();
     // On se concentre dur le mot de passe (_user_password)
     $pwdSpecs = $specs['_user_password'];
     $pwd = $this->_user_password;
     // S'il a été défini, on le contréle (necessaire de le mettre ici a cause du md5)
     if ($pwd) {
         // minLength
         if ($pwdSpecs->minLength > strlen($pwd)) {
             return "Mot de passe trop court (minimum {$pwdSpecs->minLength})";
         }
         // notContaining
         if ($target = $pwdSpecs->notContaining) {
             if ($field = $this->{$target}) {
                 if (stristr($pwd, $field)) {
                     return "Le mot de passe ne doit pas contenir '{$field}'";
                 }
             }
         }
         // notNear
         if ($target = $pwdSpecs->notNear) {
             if ($field = $this->{$target}) {
                 if (levenshtein($pwd, $field) < 3) {
                     return "Le mot de passe ressemble trop à '{$field}'";
                 }
             }
         }
         // alphaAndNum
         if ($pwdSpecs->alphaAndNum) {
             if (!preg_match("/[A-z]/", $pwd) || !preg_match("/\\d+/", $pwd)) {
                 return 'Le mot de passe doit contenir au moins un chiffre ET une lettre';
             }
         }
     } else {
         $this->_user_password = null;
     }
     return parent::check();
 }