Employee Clocking System
Employee Clocking System
The project will also include the implementation of a database system to store
and manage employee attendance records securely, and develop an administrator
dashboard to monitor employee attendance and generate reports.
1
efficiency, and security of attendance tracking, while being accessible and user-
friendly.
Objectives:
Additionally, it can reduce instances of time theft and fraud, leading to cost
savings for the company and a more trustworthy work environment. The use of
2
time-based one-time passwords can also enhance security and privacy of
employee data, as it can prevent unauthorized access to attendance records.
3
Chapter Two: Literature Review
2.0 Introduction
This chapter provides an overview of the literature related to employee attendance
tracking, automated clocking systems, and time-based one-time passwords. The
purpose of this literature review is to identify the existing approaches and
technologies that have been used in attendance tracking systems and evaluate
their effectiveness and limitations. By examining the relevant literature, this study
aims to contribute to the development of a more effective and efficient employee
clocking system using time-based one-time passwords.
4
ensure secure access control and provide a reliable means of verifying employee
attendance.
5
is commonly known as two-factor authentication, which adds an extra level of
security to traditional password-based systems. The idea of one-time passwords
was initially proposed by Leslie Lamport [6] in the early 1980s.
One of the key advantages of using a TOTP system in employee clocking systems
is the dynamic nature of the passwords. With TOTPs, each password is generated
based on the current time and remains valid for a short period, typically 30
seconds to 1 minute. This ensures that each employee's authentication credentials
are unique and constantly changing, minimizing the risk of unauthorized access
or impersonation. By using time-based passwords, the system can effectively
mitigate security threats such as password theft, replay attacks, and unauthorized
access attempts.
TOTP credentials are also based on a shared secret known to both the client and
the server, creating multiple locations from which a secret can be stolen [8]. An
attacker with access to this shared secret could generate new, valid TOTP codes
6
at will. This can be a particular problem if the attacker breaches a large
authentication database [9].
7
2.2 Review of Related Literature
Various problems pertaining to authentication and security of highly privileged
and private information have been analysed by many scholars. While studying
diverse schemes adopted in the present as well as the past, it was observed that
the usage of One-Time Password or commonly known as OTP seemed to assure
improved access management security in private as well as public networks [10].
Owing to the varied formats of OTP usage as well as the architecture developed
by the past protocol makers and researchers, diverse OTP schemes have also been
patented but standardization of the same is a challenge. Various OTP based
schemes are discussed in this section. The security of the systems based on OTP
relies on the non-invertible property of secure hash functions. This implies that
the function can be computed in the forward direction, but its inverse calculation
is computationally infeasible [11].
It was Lamport who first recommended the idea of OTP in the initial years of
1980 [12]. Lamport proposed a popular OTP scheme based on a one-way hash
function that warded off replay attacks in every communication. The principle of
OTP ensures improved security by using an algorithm that generates a
pseudorandom output every time a user tried to log in. The password system in
this scheme begins with the initial seed s, and proceeds with the generation of
passwords via a one-way chain function, f(s), f(f(s)), f(f(f(s))),.and so on. If the
number of passwords required is unknown, a new value of seed may be selected
after exhausting the set for s. For authentication, the user device provides the
passwords in a reverse manner beginning from f(f(f(s))) to f(s).
The author in [13] a prototype software called the S/KEY™ OTP authentication
scheme that employs a computation for generating a definite series of one-use
passwords out of a solitary secret ‘seed’. The security of the system relies on the
8
seed that is known to the user only. This system is an extended version of
Lamport‟s scheme. The one-time passwords are so related that computation of
any password from the preceding sequence is computationally infeasible. Even
though the scheme is immune to eavesdropping and replay attacks, it has been
found to be susceptible to Server-spoofing attacks as well as offline dictionary
attacks.
Authors in [14] proposed Infinite Length Hash Chains (ILHC) that employ a
public key cryptographic algorithm, say for producing an infinite and forward
one-way-function or OWF that forms the production core of OTPs. This system
has employed RSA [15] with as private key and as the public key. Increase in
cascaded exponentiations raises the computational complexity thus making its
implementation difficult in devices with restricted computation like mobile
phones.
Hardware tokens are employed for storing secrets in dedicated modules carried
by users. The RSA token family [16] has long established as the market leader.
Here, a simple dedicated hardware version has been employed which has just a
display without any I/O ports or buttons. The device holds a secret referred to as
‘seed’ that is known at the backend and is synchronized with the main server’s
internal clock. A cryptographically strong algorithm will generate a fresh digit
code for 60 seconds utilizing the seed and current time stamp. The generated code
is displayed on the device screen. When enrolling, the user uses a web interface
to connect to the administrative backend where he/she chooses a PIN and the
username-token pairing is affirmed. After this, the user types his/her ‘username’
and ‘passcode’ (the concatenated form of a dynamic 6-digit code and a static PIN
of 4 digits) in place of username and password for authentication. A similar
process occurs at the server end parallelly. RSA provides a single sign-on facility
9
for granting access to various corporate resources using the same token. However,
it was found in March 2011 that attackers corrupted the backend seed database of
RSA [17] allowing them to guess the codes supplied by any token. Owing to the
typical nature of mobile devices, this type of synchronization cannot be assured.
In this scheme, the client as well as the server shall generally have the same
counter. The client produces an OTP from a secret key counter value and then
increments the counter value. The user submits this OTP to the server and server
also produces a password by making use of its counter value and the same secret
key that the user employed. In the case of a password-match case, the user gets
authenticated by the server and its counter value is incremented. The HOTP
scheme [18] is unidirectional that relies on a counter value and utilizes the
HMAC-SHA1 algorithm for OTP generation. This computation yields a 160-bit
output that is truncated by HOTP to a form that can be typed by the user easily.
A new, secure authentication mechanism has been given in [19] that relies on the
principle of one-time-passwords. This OTP solution brings together the secure
and simple OTP principal pervasiveness of a GSM mobile device. A Java MIDlet
transforms the mobile phone into a safe OTP token since it can be installed on
every Java enabled phone which can then be utilized for logging into any web
service. This solution relies on the plain challenge-response mechanism. For
making the OTP generation secure, a tough secret key is employed in
concatenation with a challenge. The secret key must be shared between the server
and the client. Whenever a user needs to be verified, Authentication Server (AS)
generates a Challenge with the User profile and the corresponding OTP; then, it
computes the MAC of OTP. The MAC, as well as the challenge, are transmitted
to MIDlet in an SMS whereas the OTP is retained at the AS. The MIDlet is
activated automatically at the arrival of the message and the user is prompted for
10
a password. The MIDlet produces the password hash and verifies it against the
value stored. If they match then it will be used to decrypt the shared secret key.
MIDlet will also generate OTP and its MAC is calculated and compared with the
received MAC. If it does not match, the authentication shall be cancelled, and the
process should be restarted. If they match, then the user will be successfully
authenticated. The MIDlet will then send OTP back to AS. The server checks if
the OTP is right and authenticates the user.
G. Symmetric Encryption Algorithm and One Way Hash Function to Generate OTP
Authors in [20] and others proposed another OTP scheme which uses a one-way
hashing function and symmetric encryption (AES-128) for OTP generation. The
one-time-password say is formed of two things, where C signifies cipher text and
D represents verification bits. A cipher text of bits can produce distinct OTPs. The
length of verification bits relies on the security requirements. The output obtained
from symmetric encryption carries the information of counter value to the server
thus avoiding counter desynchronization. However, employing only symmetric
encryption is insufficient for OTP generation. If a random password is submitted
by the intruder, it is decrypted by the server that attains the counter value. It is
highly likely that the value of the counter is greater than the present counter value
saved at the server and may lead to a successful assault. Hence, verification bits
are added to OTP which are formed from the counter value digest for ensuring its
validity
11
Chapter Three: System Analysis and Design
3.0 Introduction
This chapter describes the design methodology which have been chosen in
building the software as well as the modelling tools used in developing of the
project which is the Object-Oriented Analysis Design Methodology (OOADM),
Case diagram, etc.
It also briefly describes systems which have been in existence and their
shortcomings before this one project was carried out. It is thus the shortcoming
this proposed project tries to rectify as well as give the user a better experience
while using it. In this chapter, careful analysis in details and explanation on how
the proposed project will operate showing the database design, system,
architecture, input design and output design was highly discussed.
System design is the process of planning a new business system or one to replace
or complement an existing system. But before this planning can be done, we must
thoroughly understand the old system and determine how computers can best be
used to make its operation more effective.
12
Design Methodology refers to the development of a system or method for a
unique situation. The key to design methodology is finding the best solution for
each design situation, whether it be in industrial design, architecture or
technology. Design methodology stresses the use of brainstorming to encourage
innovative ideas and collaborative thinking to work through each proposed idea
and arrive at the best solution. Meeting the needs and wants of the end user is the
most critical concern. Design methodology also employs basic research methods,
such as analysis and testing. While design methodology is employed in many
industries, it is commonly applied in technology fields, including those using the
internet, software and information systems development. Several design
methodology approaches have developed in the technology industry. Each was a
reaction to a different type of problem. Some common technology design
methodology includes: Top-down Design or Stepwise Refinement, Bottom-up
Design, structured Design, Structured Analysis and Design Technique, Data
Structured System development, Object Oriented Design. The design
methodology chosen for this project is Object Oriented analysis and design
methodology [22].
13
• Make a design which can be converted to executables using object-oriented
languages [23].
In this section, we analyse the proposed employee clocking system that utilizes
time-based one-time passwords (TOTPs) as a more secure and efficient
alternative to the existing paper-based process. The analysis aims to evaluate the
feasibility and potential benefits of the proposed system.
This section presents the design methodology for the proposed employee
clocking system. It ensures a well-structured approach to developing a reliable
system that fulfils the identified requirements and objectives. The following UML
tools will be used to analyse the system with the aim of identifying what the
system will do:
Use case diagrams are used during requirements elicitation and analysis as a
graphical means of representing the functional requirements of the system [24].
Scan QRcode
Log IN
Clock In /
Clock Out
Dashboard
Attendance
Records
Log out
Staff
Admin
15
3.2.1.2 Activity Diagram
Input staff
ID
Is No
Valid?
Yes
Generate QRcode
Scan QRcode
No Is Yes
Login
Valid?
Is No
Valid?
Yes
Clock In /
Stop Clock Out
In this section, it encompasses how the system to develop will operate. This will
include the following:
• Class Diagram
• Database Design
• Input Design
• Output design
• System Architecture
Employee Attendance
Administrator
adminId: int
username: string
password: string
requestAttendance()
ViewEmployees()
The term database design can be used to describe many different parts of the
design of an overall databases system. Principally, and most correctly, it can be
thought of as the logical design of the base data structures used to store the data.
In the relational model these are tables and views. In an object database the
entities and relationships map directly to object classes and named relationships.
However, the term database design could be used to apply to the overall process
of designing, not just the base data structures, but also the forms and queries used
as part of the overall database application within the database management
system (DBMS).
There are three tables for this application, namely Admin, Users, Attendance
Records Table
18
Fig 3.1: Staff Table
Field Data Type Size Null Description Action
staff_id INT NO User identifier Primary
key
first_name VARCHAR 20 NO Staff firstname
last_name VARCHAR 20 NO Staff lastnmae
Email VARCHAR 50 NO Staff Email
phone_no VARCHAR 15 NO Staff phone
number
device_token VARCHAR 255 NO Token for device
registeration_date timestamp NO date
The "staff" table above serves as the core repository of information for staff
members within the application. The design ensures individual staff
identification, supports communication details, and records registration history.
19
granting authorized access to administrative functions. It ensures each admin has
a distinct identity and controlled access to the system's backend.
This design represents how data is captured and fed into the system for
processing. Input design includes specifying the means by which system
operators directs the system in performing actions.
20
Staff ID
Generate QRcode
Password
Login
Select Action
Clock IN
Clock OUT
21
3.3.4 Output Design
Staff ID
Generate QR Code
Go back Home
22
3.3.4. System Architecture
It is the conceptual model that defines the structure of behaviour and more views
of a system. Architecture description is a formal description and representation of
a system, organized in a way that supports reasoning about the structures and
behaviours of the system.
The proposed system is to be designed using a 3-tier architecture. These tiers are
the presentation tier, the middle tier and the data tier. The presentation tier is the
part of the system known as the user interface and this interface is designed using
HTML and CSS. The next layer is the middle tier which is also known as the
business logic. The middle tier is designed using NodeJS and it runs on the server.
Now the last layer is the Data tier and it is part of the system that is responsible
for storing the data. This data part is the Database itself. The database
management system used in the development of this system is the MySQL
database.
NodeJS
23
Chapter Four: System Implementation
4.0 Introduction
In this chapter, the proposed system would be designed so as to bring the design
to reality by making it fully functional to the user.
In this chapter, the proposed system already designed will be implemented so that
it can be made fully functional to the users.
System Implementation is the construction of the new system and the delivery of
that system into production. The construction phase does two things: builds and
tests a functional system that fulfils business or organization design requirements
and implements the interface between the new system and the existing system.
24
JavaScript, PHP, NodeJS and so on. The IDE makes the process of programming,
debugging and maintenance more convenient.
Xamp Server (Extended Apache MYSQL PHP) was used to create the database
and to run NodeJS Script.
25
padding: 0px;
}
• NodeJS: It is a server-side scripting language used alongside HTML. It is
used to create dynamic content on websites. The NodeJS code is processed
on a web server which is serving a web page which contain NodeJS. The
code is executed on the server before the web application is shown to the
end user. This is why the end user is unable to see NodeJS code.
• MySQL: It is an open-source Relational Database Management System
(RDBMS). It is used in conjunction with NodeJS for storing databases.
MySQL stands for My Structured Query Language. The Database
Management System is the interface between the actual database files and
the application storing, using and deleting the data. The MySQL database
can hold binary files, text and numeric data. As MySQL is relational
database, it means the stored data may have relationships within.
USER INTERFACE
USER
DATABASE
Respons Request
WEB SERVER
26
4.3 Software Testing
The testing of this application was done at various stages of the development.
This stage-by-stage testing is in order to be able to detect errors and remove them
immediately. The screenshots below show some of the important views of the
application:
27
Fig 4.5: Screenshot showing Clocking page
28
4.4 Documentation
• Click on the windows button and locate the Web Browser Icon.
• Open the browser and enter the URL http://localhost:3000 (note that this a
temporary URL, based on a local machine server), press enter
• On the homepage, type in your registered staff_id to generate a dynamic
qrcode for logging in
• When logged in as a staff, you will be taken to the attendance page where
you clock in or clock out
• Click on specific tabs, links or button to carryout actions written therein.
The source code listing for this project work can be found in Appendix A (Code
Listing).
29
Chapter Five: Summary and Conclusion
5.0 Summary
The attendance clocking system developed in this project aims to provide
an efficient and secure solution for recording staff members' working hours using
the Time-based One-Time Password (TOTP) mechanism. By combining TOTP
technology with a user-friendly interface, the system ensures accurate and reliable
attendance tracking. The system's foundation rests on a well-structured database
that stores staff information and attendance records. It utilizes TOTP codes for
secure clock-in and clock-out actions, enhancing data integrity and thwarting
unauthorized access. The interface offers an intuitive experience for both staff
and administrators, contributing to the system's usability.
5.1 Conclusion
The successful implementation of the attendance clocking system
underscores the significance of integrating Node.js, MySQL, HTML, and CSS.
The utilization of the TOTP authentication mechanism further enhances the
system's security and reliability. The cohesive collaboration between these
technologies results in a powerful tool that optimizes staff management and
attendance tracking processes. The system's robust backend powered by Node.js,
the structured data management offered by MySQL, and the engaging user
experience facilitated by HTML and CSS make it a valuable asset for
organizations seeking efficient attendance management solutions.
5.2 Recommendation
While the attendance clocking system has been successfully developed and
demonstrates its intended functionality, there are opportunities for enhancement
and expansion:
30
• Real-time Notifications: Implement real-time notifications for
administrators to be alerted when significant attendance events occur, such
as late clock-ins or early clock-outs.
• Integration with Payroll: Explore the possibility of integrating the
attendance system with the payroll management system to automate salary
calculation based on accurate attendance data.
• Analytics and Reporting: Incorporate data analytics and reporting features
to provide insights into staff attendance trends, helping management make
informed decisions.
31
REFERENCES
[9] Zetter, Kim. "RSA Agrees to Replace Security Tokens After Admitting
Compromise". WIRED. Archived from the original on 12 November 2020.
Retrieved 17 February 2017.
[10] K. Aravindhan and R.R. Karthiga, “One-time Password: A Survey”,
International Journal of Emerging Trends in Engineering and
Development, vol. 1, no. 3, pp. 613-623, 2013.
32
[11] N. Haller, C. Metz, P. Nesser and M. Straw, A one-time password system.
RFC 1938, 1996
[13] N. Haller, “The S/KEY one-time password system”, RFC 1760, 1995.
[14] K. Bicakci and N. Baykal, “Infinite length hash chains and their
applications”, in Enabling Technologies: Infrastructure for Collaborative
Enterprises, WET ICE 2002, Eleventh IEEE International Workshops on,
IEEE, 2002, pp. 57-61
[15] R.L. Rivest, A. Shamir and L. Adleman, “A method for obtaining digital
signatures and public-key cryptosystems”, Communications of the ACM,
vol. 21, no. 2, pp. 120-126, 1978.
[17] T. Bradley, “RSA SecurID Hack Shows Danger of APTs”, PCWorld, 2011.
[Online].
Available:https://www.pcworld.com/article/222555/rsa_securid_hack_sho
ws_danger_of_apts.html. [Accessed: 01- Oct- 2018].
[19] S. Hallsteinsen and I. Jorstad, “Using the mobile phone as a security token
for unified authentication”, in Systems and Networks Communications,
ICSNC 2007, Second International Conference on, IEEE, 2007, pp. 68-68.
33
[21] "Overview of System Analysis & Design", Available at:
http://www.ddegjust.ac.in/studymaterial/pgdca/ms-04.pdf
[22] Dzeugang placide, "Information System & System analysis and design
(ICT & Comp. Sc.)" blog, 07 Feb. 2015; Available at: http://dzplacide.over-
blog.com/2015/02/information-system-system-analysis-ict-comp-sc.html
34
APPENDICES
Header File
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Staff Clocking System</title>
<link
href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min
.css" rel="stylesheet" integrity="sha384-
4bw+/aepP/YC94hEpVNVgiZdgIC5+VKNBQNGCHeKRQN+PtmoHD
EXuppvnDJzQIu9" crossorigin="anonymous">
<link rel="stylesheet" href="/css/styles.css">
</head>
<body>
<header class="p-3 text-bg-dark">
<div class="container">
<div class="d-flex flex-wrap align-items-center justify-content-center
justify-content-lg-start">
<a href="/" class="d-flex align-items-center mb-2 mb-lg-0 text-white text-
decoration-none">
<img src="/images/rocodeify_fav.PNG" width="40px" height="40px"
alt="">
</a>
<ul class="nav col-12 ms-auto col-lg-auto me-lg-auto mb-2 d-flex justify-
content-end mb-md-0">
<li><a href="/" class="nav-link px-2 text-secondary">Home</a></li>
<li><a href="/login" class="nav-link px-2 text-white">Log In</a></li>
<li><a href="/register" class="nav-link px-2 text-
white">Register</a></li>
35
</ul>
</div>
</div>
</header>
Index Page
<%- include('partials/header') -%>
<div class="container col-xl-10 col-xxl-8 px-4 py-5">
<div class="row align-items-center g-lg-5 py-5">
<div class="col-md-10 mx-auto col-lg-5">
<form action="/auth/generate_qr_code" method="post" class="p-4 p-md-
5 border rounded-3 bg-light">
<div class="form-floating mb-3">
<input type="text" class="form-control" id="staffId"
placeholder="Staff ID" name="staff_id" required>
<label for="staffId">Staff ID</label>
</div>
<button class="w-100 btn btn-lg btn-primary" type="submit">Generate
QR Code</button>
<hr class="my-4">
<small class="text-muted">By clicking Generate, you agree to the terms
of use.</small>
<% if (typeof message == 'undefined'){ %>
<% } else if (message){ %>
<p class="alert alert-danger mt-3 p-2"><%= message %></p>
<% } %>
</form>
</div>
<div class="col-lg-7 text-center text-lg-start">
<div>
36
<% if (typeof qrCodeImage == 'undefined'){ %>
<p>Use Valid <b>Staff ID</b> to Generate QR Code for your
Attendance</p>
<% } else if (qrCodeImage) { %>
<h2>Scan the QR Code to Log In</h2>
<img src="<%= qrCodeImage %>" alt="QR Code for Staff Login">
<% } %>
</div>
</div>
</div>
</div>
<%- include('partials/footer') -%>
Login Page
<%- include('partials/header') -%>
<div class="admin-bg-image">
<div class="wrapper">
<main class="form-signin w-100 m-auto">
<div class="login-container">
<form action="/auth/login" method="post" class="login-form">
<h2>Log In</h2>
<hr>
<div class="input-container mt-2">
<input type="text" id="user_name" name="staff_id"
<% if (typeof staff_id === 'undefined'){ %>
<% } else if (staff_id){ %>
value="<%= staff_id %>"
<% } %>
hidden/>
</div>
37
<div class="input-container">
<label for="password" class="pb-2">Password</label>
<input type="password" id="phone_no" name="phone_no" required />
</div>
<button type="submit">Login</button>
<% if (message){ %>
<p class="alert alert-danger mt-3 p-2"><%= message %></p>
<% } %>
</form>
</div>
</main>
</div>
</div>
<script>
// Remove query parameters from URL after page load
window.onload = function() {
history.replaceState({}, document.title, window.location.pathname);
};
</script>
<%- include('partials/footer') -%>
Register Page
<%- include('partials/header') -%>
<div class="container-fluid">
<div class="row">
<main class="col-md-9 ms-sm-auto col-lg-10 px-md-4">
<div
class="d-flex justify-content-between flex-wrap flex-md-nowrap
align-items-center pt-3 pb-2 mb-3 border-bottom">
<h1 class="h2">Register Staff</h1>
38
</div>
<div class="create_staff_wrapper w-75 m-auto mt-5">
<form action="/auth/register" method="post" class="row g-3">
<div class="col-md-6">
<label for="firstname" class="form-label">First Name</label>
<input type="text" class="form-control" id="firstname"
name="first_name" required>
</div>
<div class="col-md-6">
<label for="lastname" class="form-label">Last Name</label>
<input type="text" class="form-control" id="lastname"
name="last_name" required>
</div>
<div class="col-12">
<label for="email" class="form-label">Email</label>
<input type="email" class="form-control" id="email"
name="email" required>
</div>
<div class="col-md-6">
<label for="firstname" class="form-label">Phone No.</label>
<input type="tell" class="form-control" id="phone"
name="phone_no" required>
</div>
<div class="col-12">
<button type="submit" class="btn btn-
primary">Register</button>
</div>
<% if (message){ %>
<p class="alert alert-danger mt-3 p-2"><%= message %></p>
<% } %>
39
</form>
</div>
</main>
</div>
</div>
<script>
// Get device information
40
<div class="form-check">
<input class="form-check-input" type="radio" name="action"
id="clockIn" value="Clock In" />
<label class="form-check-label" for="clockIn">Clock
In</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" name="action"
id="clockOut" value="Clock Out" />
<label class="form-check-label" for="clockOut">Clock
Out</label>
</div>
</div>
<button type="submit" class="btn btn-primary">Submit</button>
</form>
<script>
document.getElementById("clockIn").addEventListener("click",
function () {
document.getElementById("action_type").value = "Clock In";
document.getElementById("timestamp").value = new
Date().toISOString();
});
document.getElementById("clockOut").addEventListener("click",
function () {
document.getElementById("action_type").value = "Clock Out";
document.getElementById("timestamp").value = new
Date().toISOString();
});
</script>
</div>
<%- include("partials/footer") -%>
41