Our last task before the web page is complete is to provide some minimum form of protection by providing a login page. A user must be logged in to be able to view the data of the device or control its output.
The Markdown engine allows us to implement simple login pages. It is done by providing two header fields, Login and UserVariable. What they do is tell the parser that the page can only be viewed if a Waher.Security.IUser object is defined in the current session, with the variable name defined by the UserVariable header. If no such variable is found, the client is redirected to a new page, defined by the Login header. So, we begin by adding the following two rows to the Index.md and History.md files in the sensor project (the work for the controller is analogous):
UserVariable: User Login: Login.md