* Function should return all information available. If you are saving
* this information to moodle user-table you should honor syncronization flags
*
- * @param string $username username (with system magic quotes)
+ * @param string $username username
*
* @return mixed array with no magic quotes or false on error
*/
function get_userinfo($username) {
$textlib = textlib_get_instance();
- $extusername = $textlib->convert(stripslashes($username), 'utf-8', $this->config->ldapencoding);
+ $extusername = $textlib->convert($username, 'utf-8', $this->config->ldapencoding);
$ldapconnection = $this->ldap_connect();
$attrmap = $this->ldap_attributes();
$result = array();
* Reads any other information for a user from external database,
* then returns it in an array
*
- * @param string $username (with system magic quotes)
+ * @param string $username
*
* @return array without magic quotes
*/
global $CFG;
$textlib = textlib_get_instance();
- $extusername = $textlib->convert(stripslashes($username), 'utf-8', $this->config->extencoding);
+ $extusername = $textlib->convert($username, 'utf-8', $this->config->extencoding);
$authdb = $this->db_init();
* @return bool Authentication success or failure.
*/
function user_login ($username, $password) {
- global $CFG;
- if ($user = get_record('user', 'username', $username, 'mnethostid', $CFG->mnet_localhost_id)) {
+ global $CFG, $DB;
+ if ($user = $DB->get_record('user', array('username'=>$username, 'mnethostid'=>$CFG->mnet_localhost_id))) {
return validate_internal_user_password($user, $password);
}
return false;
}
error_reporting(0);
- $connection = imap_open($host, stripslashes($username), stripslashes($password), OP_HALFOPEN);
+ $connection = imap_open($host, $username, $password, OP_HALFOPEN);
error_reporting($CFG->debug);
if ($connection) {
* Function should return all information available. If you are saving
* this information to moodle user-table you should honor syncronization flags
*
- * @param string $username username (with system magic quotes)
+ * @param string $username username
*
* @return mixed array with no magic quotes or false on error
*/
function get_userinfo($username) {
$textlib = textlib_get_instance();
- $extusername = $textlib->convert(stripslashes($username), 'utf-8', $this->config->ldapencoding);
+ $extusername = $textlib->convert($username, 'utf-8', $this->config->ldapencoding);
$ldapconnection = $this->ldap_connect();
$attrmap = $this->ldap_attributes();
* @return bool Authentication success or failure.
*/
function user_login ($username, $password) {
- global $CFG;
- if ($user = get_record('user', 'username', $username, 'mnethostid', $CFG->mnet_localhost_id)) {
+ global $CFG, $DB;
+ if ($user = $DB->get_record('user', array('username'=>$username, 'mnethostid'=>$CFG->mnet_localhost_id))) {
return validate_internal_user_password($user, $password);
}
return false;
* Returns true if the username and password work and false if they are
* wrong or don't exist.
*
- * @param string $username The username (with system magic quotes)
- * @param string $password The password (with system magic quotes)
+ * @param string $username The username
+ * @param string $password The password
* @return bool Authentication success or failure.
*/
function user_login ($username, $password) {
$host = '{' . trim($host) . ':' . $this->config->port . '/nntp}';
error_reporting(0);
- $connection = imap_open($host, stripslashes($username), stripslashes($password), OP_HALFOPEN);
+ $connection = imap_open($host, $username, $password, OP_HALFOPEN);
error_reporting($CFG->debug);
if ($connection) {
* @return bool Authentication success or failure.
*/
function user_login ($username, $password) {
- global $CFG;
- if ($user = get_record('user', 'username', $username, 'mnethostid', $CFG->mnet_localhost_id)) {
+ global $CFG, $DB;
+ if ($user = $DB->get_record('user', array('username'=>$username, 'mnethostid'=>$CFG->mnet_localhost_id))) {
return validate_internal_user_password($user, $password);
}
return true;
* Returns true if the username and password work and false if they are
* wrong or don't exist.
*
- * @param string $username The username (with system magic quotes)
- * @param string $password The password (with system magic quotes)
+ * @param string $username The username
+ * @param string $password The password
* @return bool Authentication success or failure.
*/
function user_login ($username, $password) {
// call_time_pass_reference of errormessage is deprecated - throws warnings in multiauth
//if (pam_auth($username, $password, &$errormessage)) {
- if (pam_auth(stripslashes($username), stripslashes($password))) {
+ if (pam_auth($username, $password)) {
return true;
}
else {
* Returns true if the username and password work and false if they are
* wrong or don't exist.
*
- * @param string $username The username (with system magic quotes)
- * @param string $password The password (with system magic quotes)
+ * @param string $username The username
+ * @param string $password The password
* @return bool Authentication success or failure.
*/
function user_login($username, $password) {
}
error_reporting(0);
- $connection = imap_open($host, stripslashes($username), stripslashes($password));
+ $connection = imap_open($host, $username, $password);
error_reporting($CFG->debug);
if ($connection) {
* Returns true if the username and password work and false if they are
* wrong or don't exist.
*
- * @param string $username The username (with system magic quotes)
- * @param string $password The password (with system magic quotes)
+ * @param string $username The username
+ * @param string $password The password
* @return bool Authentication success or failure.
*/
function user_login ($username, $password) {
// printf("nasport: $this->config->nasport <br/>");
// printf("secret: $this->config->secret <br/>");
- $rauth = new Auth_RADIUS_PAP(stripslashes($username), stripslashes($password));
+ $rauth = new Auth_RADIUS_PAP($username, $password);
$rauth->addServer($this->config->host, $this->config->nasport, $this->config->secret);
if (!$rauth->start()) {
* Returns true if the username and password work and false if they are
* wrong or don't exist.
*
- * @param string $username The username (with system magic quotes)
- * @param string $password The password (with system magic quotes)
+ * @param string $username The username
+ * @param string $password The password
* @return bool Authentication success or failure.
*/
function user_login($username, $password) {
* Function should return all information available. If you are saving
* this information to moodle user-table you should honor syncronization flags
*
- * @param string $username username (with system magic quotes)
+ * @param string $username username
*
* @return mixed array with no magic quotes or false on error
*/
return get_complete_user_data('username', $username);
}
+/**
+ * will truncate userinfo as it comes from auth_get_userinfo (from external auth)
+ * which may have large fields
+ */
function truncate_userinfo($info) {
-/// will truncate userinfo as it comes from auth_get_userinfo (from external auth)
-/// which may have large fields
-
// define the limits
$limit = array(
'username' => 100,
update_login_count();
// ignore submitted username
- if (!$user = authenticate_user_login($USER->username, $data['password'])) {
+ if (!$user = authenticate_user_login($USER->username, stripslashes($data['password']))) { // TODO: remove soon
$errors['password'] = get_string('invalidlogin');
return $errors;
}
if ($user) {
$frm->username = $user->username;
} else {
- $frm = data_submitted();
+ $frm = data_submitted(false);
}
} else {
- $frm = data_submitted();
+ $frm = data_submitted(false);
}
/// Check if the user has actually submitted login data to us
<div class="loginform">
<div class="form-label"><label for="username"><?php print_string("username") ?></label></div>
<div class="form-input">
- <input type="text" name="username" id="username" size="15" value="<?php p($frm->username, true) ?>" />
+ <input type="text" name="username" id="username" size="15" value="<?php p($frm->username) ?>" />
</div>
<div class="clearer"><!-- --></div>
<div class="form-label"><label for="password"><?php print_string("password") ?></label></div>