Getting a login token

Getting a login token

από Lorin Toews -
Αριθμός απαντήσεων: 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!

Μέσος όρος βαθμολογίας: -
Σε απάντηση σε Lorin Toews

Re: Getting a login token

από Leon Stringer -
Φωτογραφία Core developers Φωτογραφία 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.

Σε απάντηση σε Leon Stringer

Re: Getting a login token

από Lorin Toews -

It looks like that did it!

Thanks so much for your help.