# Secure Learning Management System Based on User Behavior
## 4 Implementing Details for the Solution  
Within this section, we describe how the values are determined based on which methods of user recognition are applied. The main used events are: _mousedown_, _keydown_, _keyup_, and also on all text-type inputs, the following properties are set to a false command: _copy_, _cut_, _paste_, _onDrag_, _onDrop_, and autocomplete, to force the student-type user to use the keyboard. In the first algorithm, we mentioned that the following characteristics are measured: typing speed, pressing time, text selection mode, capitalization mode, text deletion mode, and the control keys used. Below is a detailed description of how measurements have been made for these characteristics:  
* Typing speed is measured as the number of characters entered by the student in 6 s. Using a function that automatically starts refunctioning every 10 milliseconds, it is checked whether the student is typing, and as long as this condition is met, the start time is saved, and the number of characters entered is counted during the _keydown_ event. Moreover, every 6 s another function is used, which performs the arithmetic mean between the number of characters typed previously and those typed in the current interval, resetting that counter for the new time interval to zero. The start time is retained for the situation where the student types for less than 6 s (or 5 s for authentication), and to determine how many characters were typed in x seconds, where x is a value \(<6\);
* Pressing time is the average value of pressing a key. The time of pressing a single key is calculated as the difference between the start time (saved on the _keydown_ event) and that of the moment of release of the key (saved on the _keyup_ event), and this value is saved in an array, which means that after stopping that activity, the average value will be determined;
* The way a student performs a deletion depends on the keys used for this mechanism, namely: Delete, Backspace, or mouse selection followed by pressing any key. Based on the code of the pressed keys (_keyCode_), a counter specific to each key is implemented, that is, if during the _keydown_ event, the code of the key pressed is 8 then the counter specific to the Backspace key is increased. If it is 46, the one specific to the Delete key is increased. For deletion based on text selection, the _onSelect_ event is treated on text-type inputs. If the text has been selected and the first event that is used is the _keydown_, then the counter specific for deletion by this method is incremented. Any event that is called after the _onSelect_ resets the values. In the end, the three values are compared and the user's preference for text deletion is established;
* The control keys used, more precisely the preference for those positioned on the left side of the keyboard, or respectively, the right side, is determined using the _keydown_ event. Specifically using a property of this event, namely, _event.location_, it returns 1 for the left keys, or respectively, 2 for the right hand keys. Depending on the returned result, it is checked if any of the shift, alt ortrl keys have been pressed. If this condition is fulfilled, the specific counter for each key is increased, following which the values are finally compared and the way in which the student performs the operation or which control keys they use is established;
* Two events, namely, _onSelect_ and _onKeyDown_, are used to determine how students prefer to select text. The _OnSelect_ event is triggered when the text is being selected, having a counter and increasing it every time this function is being used. The _keydown_ event is checked (also based on the code of each key) if the shift key is pressed while the Left/Right keys are pressed. If the above condition is met, the specific counter is incremented, and at the end, these two values are compared and the way in which the user prefers to select the text is determined;
* Capitalization is done using Caps Lock, Shift, or added after typing.