Getting a login token

Getting a login token

av Lorin Toews -
Galle vástádusa: 3

As with many others, I'm wrestling with the new login token situation.

I have a custom HTML login page that now needs to pass a token along with the username and password. The page at https://docs.moodle.org/dev/Login_token#Custom_HTML_login_forms explains how to do this, suggesting that the following snippet should be included in the form that is submitted to Moodle.

<input type="hidden" name="logintoken" value="<?php echo s(\core\session\manager::get_login_token()); ?>" />

Can anybody tell me what is "s"? Is there a file that needs to be included or required in order for "s" to work?

Thanks in advance for any suggestions!

Gjennomsnittlig vurdering: -
Vástádussan geasa: Lorin Toews

Re: Getting a login token

av Leon Stringer -
Bilde av Core developers Bilde av Particularly helpful Moodlers

It looks like it's s() defined in lib/weblib.php. If the custom page uses config.php then this gets included via lib/setup.php.