Getting a login token

Getting a login token

by 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

by 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.

In reply to Leon Stringer

Re: Getting a login token

by Lorin Toews -

It looks like that did it!

Thanks so much for your help.

In reply to Lorin Toews

Re: Getting a login token

by Sérgio Gaia -

Hi Lorin,

can you share your solution?
Thanks