Getting a login token

Getting a login token

ni Lorin Toews -
Number of replies: 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!

Average of ratings: -
In reply to Lorin Toews

Re: Getting a login token

ni Leon Stringer -
Larawan ng Core developers Larawan ng 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.