I cannot Log in as a student

I cannot Log in as a student

by Francisco Gómez -
Number of replies: 5

Good afternoon,

I have the latest version of Moodle 3.9.2+ (Build: 20201028)

and the problem I have is that when I try to access as a student by clicking on Log in as I get the following message:
×As a security precaution, user-generated scripts have been disabled within this session

And for the moment moodle is blocked and then I can access again.

Does anyone know how to reactivate the user scripts?

Thank you.



Average of ratings: -
In reply to Francisco Gómez

Re: I cannot Log in as a student

by Leon Stringer -
Picture of Core developers Picture of Particularly helpful Moodlers

I don't think this is possible. This restriction is in place to address MSA-19-0004. If I've understood correctly, users can add their own JavaScript (e.g. via the HTML block) but when an admin uses Log in as this JavaScript could have been run as the admin and thus used to attack the site.

Stopping any user JavaScript shouldn't stop Moodle working: Log in as should work allowing admins to access Moodle as any user, the only difference that any JavaScript added by a user is not run.

For an admin to log in as a user with any additional JavaScript running I can only suggest resetting the user's password to log in as that user. Obviously the JavaScript could not then be run as admin.

If there's still a problem with the site not working when using Log in as maybe there's a problem with the site's JavaScript. Check the browser's console (e.g. in Firefox).

In reply to Leon Stringer

Re: I cannot Log in as a student

by Francisco Gómez -

The truth is that it is a very rare case, when I select to enter like a studen, it appears to me: "that as a security measure the user scripts have been disabled in this section,

And below it says that I am already identified as that student.  And it is when I click on to continue that appears to me:

"This page doesn't work HTTP error 500", but the funny thing is that if I delete the browser cache, the error 500 disappears and forces me to start a section in Moodle, but when I say LOG IN AS, the same error is always repeated. 


See attachments.


Greetings,

Francisco Gomez


Attachment identificadoAlumnoPrueba.jpg
Attachment páginaBlanco.jpg
In reply to Francisco Gómez

Re: I cannot Log in as a student

by Francisco Gómez -
And the php_error_log I can read this.
[31-Oct-2020 15:17:41 Europe/Berlin] PHP Deprecated: Array and string offset access syntax with curly braces is deprecated in H:\xampp\htdocs\inicio\lhc_web\ezcomponents\Url\src\url.php on line 423
[31-Oct-2020 15:17:41 Europe/Berlin] PHP Deprecated: Array and string offset access syntax with curly braces is deprecated in H:\xampp\htdocs\inicio\lhc_web\ezcomponents\Url\src\url.php on line 436
[31-Oct-2020 15:17:41 Europe/Berlin] PHP Deprecated: Array and string offset access syntax with curly braces is deprecated in H:\xampp\htdocs\inicio\lhc_web\ezcomponents\Url\src\url_tools.php on line 92
[31-Oct-2020 15:17:41 Europe/Berlin] PHP Deprecated: Array and string offset access syntax with curly braces is deprecated in H:\xampp\htdocs\inicio\lhc_web\ezcomponents\Url\src\url_tools.php on line 92
[31-Oct-2020 15:17:41 Europe/Berlin] PHP Deprecated: Array and string offset access syntax with curly braces is deprecated in H:\xampp\htdocs\inicio\lhc_web\ezcomponents\Url\src\url_tools.php on line 92
[31-Oct-2020 15:18:07 Europe/Berlin] PHP Deprecated: Array and string offset access syntax with curly braces is deprecated in H:\xampp\htdocs\inicio\lhc_web\ezcomponents\Url\src\url.php on line 423
[31-Oct-2020 15:18:07 Europe/Berlin] PHP Deprecated: Array and string offset access syntax with curly braces is deprecated in H:\xampp\htdocs\inicio\lhc_web\ezcomponents\Url\src\url.php on line 436
[31-Oct-2020 15:18:07 Europe/Berlin] PHP Deprecated: Array and string offset access syntax with curly braces is deprecated in H:\xampp\htdocs\inicio\lhc_web\ezcomponents\Url\src\url_tools.php on line 92
[31-Oct-2020 15:18:07 Europe/Berlin] PHP Deprecated: Array and string offset access syntax with curly braces is deprecated in H:\xampp\htdocs\inicio\lhc_web\ezcomponents\Url\src\url_tools.php on line 92
[31-Oct-2020 15:18:07 Europe/Berlin] PHP Deprecated: Array and string offset access syntax with curly braces is deprecated in H:\xampp\htdocs\inicio\lhc_web\ezcomponents\Url\src\url_tools.php on line 92
[31-Oct-2020 15:26:41 Europe/Berlin] PHP Deprecated: Array and string offset access syntax with curly braces is deprecated in H:\xampp\htdocs\inicio\lhc_web\ezcomponents\Url\src\url.php on line 423
[31-Oct-2020 15:26:41 Europe/Berlin] PHP Deprecated: Array and string offset access syntax with curly braces is deprecated in H:\xampp\htdocs\inicio\lhc_web\ezcomponents\Url\src\url.php on line 436
[31-Oct-2020 15:26:41 Europe/Berlin] PHP Deprecated: Array and string offset access syntax with curly braces is deprecated in H:\xampp\htdocs\inicio\lhc_web\ezcomponents\Url\src\url_tools.php on line 92
[31-Oct-2020 15:26:41 Europe/Berlin] PHP Deprecated: Array and string offset access syntax with curly braces is deprecated in H:\xampp\htdocs\inicio\lhc_web\ezcomponents\Url\src\url_tools.php on line 92
[31-Oct-2020 15:26:41 Europe/Berlin] PHP Deprecated: Array and string offset access syntax with curly braces is deprecated in H:\xampp\htdocs\inicio\lhc_web\ezcomponents\Url\src\url_tools.php on line 92
[31-Oct-2020 15:34:40 Europe/Berlin] PHP Deprecated: Array and string offset access syntax with curly braces is deprecated in H:\xampp\htdocs\inicio\lhc_web\ezcomponents\Url\src\url.php on line 423
[31-Oct-2020 15:34:40 Europe/Berlin] PHP Deprecated: Array and string offset access syntax with curly braces is deprecated in H:\xampp\htdocs\inicio\lhc_web\ezcomponents\Url\src\url.php on line 436
[31-Oct-2020 15:34:40 Europe/Berlin] PHP Deprecated: Array and string offset access syntax with curly braces is deprecated in H:\xampp\htdocs\inicio\lhc_web\ezcomponents\Url\src\url_tools.php on line 92
[31-Oct-2020 15:34:40 Europe/Berlin] PHP Deprecated: Array and string offset access syntax with curly braces is deprecated in H:\xampp\htdocs\inicio\lhc_web\ezcomponents\Url\src\url_tools.php on line 92
[31-Oct-2020 15:34:40 Europe/Berlin] PHP Deprecated: Array and string offset access syntax with curly braces is deprecated in H:\xampp\htdocs\inicio\lhc_web\ezcomponents\Url\src\url_tools.php on line 92

But I have no idea,

Any suggestion?
In reply to Francisco Gómez

Re: I cannot Log in as a student

by Francisco Gómez -
The error in lhc_web is from the program livehelperchat, as I don't have time to use it I have removed it and now:

The error that corresponds when I try to enter as a student and then instead of entering the page remains blank until I clear the browser cache is
[31-Oct-2020 16:57:51 Europe/Madrid] [client 188.114.111.235] https://formacion.website/campus Invalid Login Token: Mozilla/5.0 (Linux; Android 10; SM-N975F) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.114 Mobile Safari/537.36

It seems it have to do with Invalid Login Token
Any idea?
In reply to Francisco Gómez

Re: I cannot Log in as a student

by Leon Stringer -
Picture of Core developers Picture of Particularly helpful Moodlers

It looks like Cloudflare's caching is enabled for this site (e.g. I see HTTP headers cf-cache-status: HIT). This can stop Moodle working correctly. Try disabling all caching for the site in Cloudflare and see if the problem still occurs.