One of the best features of the new CourseMill 7.5 release is the API that is available. This API allows you to do any number of things from systems outside of CourseMill to interact with the internals of CourseMill. You can check out all of the available API calls at:
One of the most common features of custom code interacting with CourseMill is a custom login screen. Previously, to create a custom login screen, you would need to get into the internals of CourseMill. That can all be done through the documented API now, without requiring any assistance, or changes to your system. Better yet, the custom login screen can be hosted anywhere, including your own company’s website, giving you even more customization possibilities.
For this example, we’ll use a one page Lectora title, although it could certainly be done from custom HTML, or any other tool. There are three items that will need to be configured that will be specific to each instance of a login:
- CMServer – This is the URL for the server that is hosting CourseMill
- CMDir – This the the directory that contains CourseMill
- CMOrg – This is the organization that new ID’s will be created under. This is not needed if you will not be allowing users to create their own ID’s.
These configuration parameters are set at the top of the included api.js file.
Looking in the api.js file, you’ll see that the “login()” function prepares the arguments for the “callAPI()” function, and then calls it. When the function returns, it calls into “loginRet()”, and then it changes the current page to the main CourseMill page with the proper logged in credentials.
Additionally, the example includes the calls for the “forgot password” feature, as well as the “create new user” feature. These are called in the same way as the login function, with a initiator function and a return function. Since this example can work from any web server, you can actually run it from the publish preview mode of Lectora (which uses an embedded Web Server). Just adjust the three configuration parameters discussed above, publish to HTML, and then select “Preview”. You should be able to login to any instance of CourseMill!