original_string: public function get_password_restriction_status($userpassword) {
          global $USER;
          if ($this->can_manage()) {
              return false;
          }
  
          if ($this->properties->usepassword && empty($USER->lessonloggedin[$this->id])) {
              $correctpass = false;
              if (!empty($userpassword) &&
                      (($this->properties->password == md5(trim($userpassword))) || ($this->properties->password == trim($userpassword)))) {
                  // With or without md5 for backward compatibility (MDL-11090).
                  $correctpass = true;
                  $USER->lessonloggedin[$this->id] = true;
              } else if (isset($this->properties->extrapasswords)) {
                  // Group overrides may have additional passwords.
                  foreach ($this->properties->extrapasswords as $password) {
                      if (strcmp($password, md5(trim($userpassword))) === 0 || strcmp($password, trim($userpassword)) === 0) {
                          $correctpass = true;
                          $USER->lessonloggedin[$this->id] = true;
                      }
                  }
              }
              return !$correctpass;
          }
          return false;
      }
code: public function get_password_restriction_status($userpassword) {
          global $USER;
          if ($this->can_manage()) {
              return false;
          }
  
          if ($this->properties->usepassword && empty($USER->lessonloggedin[$this->id])) {
              $correctpass = false;
              if (!empty($userpassword) &&
                      (($this->properties->password == md5(trim($userpassword))) || ($this->properties->password == trim($userpassword)))) {
                  // With or without md5 for backward compatibility (MDL-11090).
                  $correctpass = true;
                  $USER->lessonloggedin[$this->id] = true;
              } else if (isset($this->properties->extrapasswords)) {
                  // Group overrides may have additional passwords.
                  foreach ($this->properties->extrapasswords as $password) {
                      if (strcmp($password, md5(trim($userpassword))) === 0 || strcmp($password, trim($userpassword)) === 0) {
                          $correctpass = true;
                          $USER->lessonloggedin[$this->id] = true;
                      }
                  }
              }
              return !$correctpass;
          }
          return false;
      }
code_tokens: public function get_password_restriction_status ( $ userpassword ) { global $ USER ; if ( $ this -> can_manage ( ) ) { return false ; } if ( $ this -> properties -> usepassword && empty ( $ USER -> lessonloggedin [ $ this -> id ] ) ) { $ correctpass = false ; if ( ! empty ( $ userpassword ) && ( ( $ this -> properties -> password == md5 ( trim ( $ userpassword ) ) ) || ( $ this -> properties -> password == trim ( $ userpassword ) ) ) ) { // With or without md5 for backward compatibility (MDL-11090). $ correctpass = true ; $ USER -> lessonloggedin [ $ this -> id ] = true ; } else if ( isset ( $ this -> properties -> extrapasswords ) ) { // Group overrides may have additional passwords. foreach ( $ this -> properties -> extrapasswords as $ password ) { if ( strcmp ( $ password , md5 ( trim ( $ userpassword ) ) ) === 0 || strcmp ( $ password , trim ( $ userpassword ) ) === 0 ) { $ correctpass = true ; $ USER -> lessonloggedin [ $ this -> id ] = true ; } } } return ! $ correctpass ; } return false ; }
docstring: Check if password restriction is applied.
  
  @param string $userpassword the user password to check (if the restriction is set)
  @return mixed false if there aren't restrictions or an object with the restriction information
  @since  Moodle 3.3
docstring_tokens: Check if password restriction is applied .