public function user_login($username, $password) {I've tried adding methods for get_userinfo and user_exists still with no luck.
global $CFG, $DB;
return false;
// Validate the login by using the Moodle user table.
// Remove if a different authentication method is desired.
$user = $DB->get_record_sql(
"
SELECT * FROM mdl_user where id IN (
SELECT
userid
FROM `mdl_user_info_data`
WHERE fieldid IN (
SELECT id FROM `mdl_user_info_field` WHERE shortname = 'additionalemail1'
or shortname = 'additionalemail2'
or shortname = 'additionalemail3'
or shortname = 'additionalemail4'
)
and data = ?
)
",
array($username)
);
// User does not exist.
if (!$user) {
return false;
}
return validate_internal_user_password($user, $password);
}
You should use a nologin as base.
The methods you need to implement are:
// Verify if user exists
$is_user = $DB->get_record('user', array('uid'));
if (!$is_user) {
$is_user = create_user_record($uid, $password, $this->authtype);
}
if ($is_user) {
$USER = get_complete_user_data('username', $is_user->username);
} else {
$this->error_page(get_string('error_create_user', self::COMPONENT_NAME));
}
public function do_login($urltogo) {
global $USER, $CFG;
complete_user_login($USER);
$USER->loggedin = true;
$USER->site = $CFG->wwwroot;
set_moodle_cookie($USER->username);
/**
* If we are not on the page we want, then redirect to it.
*/
if (qualified_me() !== $urltogo) {
redirect($urltogo);
exit;
}
}
try to read the auth.php from my saml2 auth plugin and understand the procedure to authenticate a user
Dear Team,
I have facing below issue...plz suggest me.
Moodle 2.9
Cannot use POP3 authentication. The PHP IMAP module is not installed.
More information about this error
Regards,
Amit Anant Jadhav.