Quantcast
Channel: Authentication
Viewing all 8272 articles
Browse latest View live

LDAP users sync job not working on version 3.3

$
0
0

by marisol castro.  

We are running Moodle 3.3 on Windows Server 2012r2 with PHP 5.6 and using AD for LDAP authentication.  The LDAP settings are all correct with the bind user name and password.  It is working because I was able to login with my AD account and the system did create it and pulled field info that I had set on Moodle (description, phone, etc).

When I run the sync from Site Admin > Server > Scheduled Tasks > LDAP users sync job I receive the following error:

LDAP users sync job

Execute scheduled task: LDAP users sync job (auth_ldap\task\sync_task)
... started 09:03:30. Current memory use 27MB.
Connecting to LDAP server...
Creating temporary table tmp_extuser
Did not get any users from LDAP -- error? -- exiting


I have been battling with my Security team to check the MaxPageSize and increase it if it is set to 1000 because we have over 4500 users.  He seems to think this is not the issue.  Can anyone provide some insight on this?  Any assistance would be greatly appreciated.




Re: LDAP users sync job not working on version 3.3

$
0
0

by marisol castro.  

Looks like I found the issue!  Under the LDAP settings in Moodle you must set the Page Size to 250.  Mine was set to 0 and once I changed this the sync worked!  Hope this helps for others on this forum.

Re: LDAP users sync job not working on version 3.3

$
0
0

by Emma Richardson.  

Are you still able to log in?  Have you tried logging in with another user?

Just checking that something did not inadvertently get changed on your settings like the context for example...

Re: Facing issue in ADFS (IDP) to moodle (Sp) unable to authenticate moodle

Re: LDAP users sync job not working on version 3.3

$
0
0

by marisol castro.  

I found the issue with the sync.  It had to do with the Page Size under the LDAP settings in Moodle.  It was set to 0 and when I changed it to 250 the sync worked and pulled over all of our AD accounts.

Re: Email Notification for each course enrollment

$
0
0

by marisol castro.  

The code works perfectly but how do you make the $courselink clickable in the email?  I have tried so many ways but I keep getting syntax errors.  Any ideas??

Here is the code I did to try making the link clickable.  There must be a period or quote missing somewhere.  Please help!

require_once($CFG->libdir.'/moodlelib.php');
global $CFG;

$courselink = $CFG->wwwroot . "/course/view.php?id=" . $course->id;
$url = $CFG->wwwroot . "/course/view.php?id=" . $course->id;
$body = "You have been enrolled to course"."".$course->fullname."."<br/><br/>"."Please login to start your course."."<br/><br/>echo <a href =". $url ."></a><br/><br/>"."Thanks,"."<br/>Admin";
email_to_user($user,$USER,'Enrollment Notification','The text of the message',$body);
echo json_encode($outcome);

Re: Encrypted Moodle password in database

$
0
0

by tlili ahmed.  

Dear Dave,

Perfect! It worked. Thank you so much.

Kind regards,

      Ahmed

Re: Email Notification for each course enrollment

$
0
0

by Nidhi Tiwari.  

Try this:

echo <a href =". $courselink ."></a>;


Re: LDAP users sync job not working on version 3.3

$
0
0

by Iñaki Arenaza.  

Hi Marisol,

250 is just a conservative default value, to make sure it works with (almost) all LDAP servers out of the box. But if you are using Active Directory (AD) and your AD administrators haven't lowered the default page size in AD, you could set it up to 1000 and make the process a bit faster (and put less load on your AD server).

Saludos.

Iñaki.

Re: Email Notification for each course enrollment

$
0
0

by marisol castro.  

That didn't work.  I still get a syntax error.  Am I missing a quote or comma or  semicolon somewhere?


require_once($CFG->libdir.'/moodlelib.php');
global $CFG;

$courselink = $CFG->wwwroot . "/course/view.php?id=" . $course->id;
$body = "You have been enrolled to course"."".$course->fullname."."<br/><br/>"."Please login to start your course."."<br/><br/>echo<a href =".$courselink."></a><br/><br/>"."Thanks,"."<br/>Admin";
email_to_user($user,$USER,'Enrollment Notification','The text of the message',$body);
echo json_encode($outcome);

LDAP Single Logon Process for Two trusted Forest AD

$
0
0

by Ang Teck Loon.  

LDAP Single Logon Process for Two trusted Forest AD


Anyone know how to login by abc.com for authentication and change the DN to access xyz.com?

Re: Email Notification for each course enrollment

$
0
0

by Guido Hornig.  

try:

$body = "You have been enrolled to course. ".$course->fullname."<br/><br/> Please login to start your course. <br/><br/> <a href =\"$courselink\">click here to go to the course...</a><br/><br/>Thanks.<br/>Admin";

1)

In PHP $name will be substituted in double quotes.  Not in single quotes

$name ="Miller";

echo "Tom $name";

:> Tom Miller

echo 'Tom $name';

:> Tom $name

2)

all the HTML, like <br> is just string content like letters a...z

echo "<h1> text</h1>";

:>

text


but when you want to print a " (double quotes)  than you need a so called escape character before. the excape character is the backslash in PHP 

echo "\"";

:> "

echo "\";

Syntax error

echo ' this is a double quote " ' ;

:> this is a double quote "

(please rate me,  if it helps)

Guido

from lern.link


Re: LDAP Single Logon Process for Two trusted Forest AD

$
0
0

by Emma Richardson.  

You can either use the Global Directory port for login (this will allow read only access to multiple domains) or if you are trying to authenticate from two separate domains, I recommend cloning the ldap module and having one run for each domain.

Re: Directing users to a welcome page instead of home page after email confirmation

$
0
0

by Bert van der Hooft.  

In case you use In moodle 3.3 with social login:

Add to Randy's solution:

In /auth/oauth2/confirm-account.php

Change lines into:

51     echo $OUTPUT->single_button("$CFG->wwwroot/my/", get_string('myhome'));

87     echo $OUTPUT->single_button("$CFG->wwwroot/my/", get_string('myhome'))

It's a pity that this must be done in the core code, but it works. 

Don't forget to empty the cache

Re: External DB Authentication Failing: Error inserting user

$
0
0

by Iñaki Arenaza.  

Hi Michael,

something (which is not appearing in your debug messages) is failing while trying to create the missing users. As you are using a non-standard theme (Tikli, apparently) and there's some debugging messages due to problems related to the theme, I can't reproduce your setup and debug the problem. So you will need to modify Moodle code a bit to get additional information about the underlying problem.

If you edit .../auth/db/auth.php, and find these lines of code (around line 463 in Moodle 3.3):

try {
    $id = user_create_user($user, false); // It is truly a new user.
    $trace->output(get_string('auth_dbinsertuser', 'auth_db', array('name'=>$user->username, 'id'=>$id)), 1);
} catch (moodle_exception $e) {
    $trace->output(get_string('auth_dbinsertusererror', 'auth_db', $user->username), 1);
    continue;
}

We need to change this line:

    $trace->output(get_string('auth_dbinsertusererror', 'auth_db', $user->username), 1);

to this:

    $trace->output(get_string('auth_dbinsertusererror', 'auth_db', $user->username) . print_r($e, true), 1);

so the final code block would look like this:

try {
    $id = user_create_user($user, false); // It is truly a new user.
    $trace->output(get_string('auth_dbinsertuser', 'auth_db', array('name'=>$user->username, 'id'=>$id)), 1);
} catch (moodle_exception $e) {
    $trace->output(get_string('auth_dbinsertusererror', 'auth_db', $user->username) . print_r($e, true), 1);
    continue;
}

That should display detailed information about the exception thrown by the code having trouble creating your users.

Saludos.

Iñaki.


Username to email address lock

$
0
0

by rkLearn ..  

Hi,

Is there a way to restrict username selection to something like an email address, in during self-signup?

Moodle 3.1.5.7


Re: PHP 7 and following do not support the php_mssql driver anymore. Cannot connect the database.

$
0
0

by Andrew Normore.  

Alright folks, programmer / server admin coming in to this thread. 

This is a real problem.

We are building a new PHP7 server. Things were working wonderful on the new Moodle install running MySQLi for a solid month. Went to log in this morning, and I'm getting this strange error. 

Wait - why is it trying to use mysql and not mysqli?

So let's hack some files.

I can see that Moodle is trying to use mysqli... but it doesn't load that file!

Let's examine /lib/adodb/adodb.inc.php at line 4622, where it loads the driver.

Okay, this blocks pretty straight forward. So let's put some echo statements on the actual files it loads. 

Wow look at that, even though $CFG->dbtype = 'mysqli', that file does not load as a driver - it loads mysql! Well this at least explains the problem. Why it's happening?.... let's find out!

Let's hack moodle, by manually setting the driver type. (dont leave your production server like this, its a hack)

 $file = ADODB_DIR."/drivers/adodb-mysqli.inc.php";

Okay, the hack works and it FORCES that file to load. Interesting result follows:

ADONewConnection: Unable to load database driver

Looks like this isn't a Moodle core bug at all, but the result of a bad server setup. Looks like some one else was probably on the server farting around with settings, and disabled or removed that driver. 

Solution?

Go enable / install mysqli as a PHP extension... which I've done by the way, but clearly isn't fully configured.

Re: PHP 7 and following do not support the php_mssql driver anymore. Cannot connect the database.

$
0
0

by Andrew Normore.  

GRRR so mad, I just edited my post with how I found the solution, and Moodle.org didn't let me save after 30 minutes.

Anyway.

SOLUTION FOUND.

Hack your /lib/adodb/adodb.inc.php file near line 4623 to look like this:

$file = ADODB_DIR."/drivers/adodb-mysqli.inc.php";

@include_once($file);

$class="mysqli";

$ADODB_LASTDB = $class;

if (class_exists("ADODB_" . $class)) {

return $class;

}


The Issue is that $class is not being set properly.

$class is being set to 'mysql', which does NOT load the proper driver file. 

So actually, trying to submit a moodle fix, I can see this entire function isn't being called properly for MySQLI. Let's fix that too..

Re: PHP 7 and following do not support the php_mssql driver anymore. Cannot connect the database.

$
0
0

by Andrew Normore.  

Okay let's look for an official based solution.

if (empty($db)) {

$db = $ADODB_LASTDB;

var_dump($ADODB_LASTDB); die;

}

I can see here the $db is being set manually to 'mysql' rather than 'mysqli' from $ADODB_LASTDB;

What is that? Why is it wrong? Let's go dig.


Re: PHP 7 and following do not support the php_mssql driver anymore. Cannot connect the database.

$
0
0

by Andrew Normore.  

I've traced this problem all the way back to

/enrol/database/lib.php

Inside of protected function db_init()

Here it is:

$extdb = ADONewConnection($this->get_config('dbtype'));

The problem is that var_dump($this->get_config('dbtype') is... "mysql"

When changed to:

$extdb = ADONewConnection($CFG->dbtype);

it works as expected!

THE FINAL SOLUTION TO FIX Moodle Mysqli login not working (and other problems)

Edit: /enrol/database/lib.php

$extdb = ADONewConnection($this->get_config('dbtype'));

becomes

$extdb = ADONewConnection($CFG->dbtype);


Viewing all 8272 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>