Cpe Final
Cpe Final
SUBMITTED TO
MAHARASHTRA STATE BOARD OF TECHNICAL
EDUCATION
SUBMITTED BY
Sr. No. Student Name Enrollment No.
1 Nilwarn Sumit Dhananjay 2200940109
2 Dahiwal Omkar Suresh 2200940126
3 Jadhav Rohit Ramesh 2200940120
Guided By
MR. R.D.KOKARE
GOVERNMENT POLYTECHNIC JINTUR DISTRICT
PARBHANI, STATE- MAHARASHTRA
Academic Year: 2024-2025
1
MAHARASHTRA STATE
BOARD OF TECHNICAL EDUCATION
Certificate
Place: JIINTUR
2
Appendix-B
3
c) Take appropriate decisions based on collected and analyzed
information.
d) Ensure quality in product.
h) Communicate effectively and confidently as a member and
leader of team.
4
c) Application Deployment – Compile, debug, and test the E-Book Store Webapp
on different devices and web browsers. Ensure that the application is responsive,
optimized, and free of bugs, providing a smooth experience across desktop and
mobile platforms.
d) Version Control Usage – Use Git and GitHub (or similar version control tools)
to manage the project’s source code, track changes, and collaborate with team
members on updates and new features for the webapp.
5
ACKNOWLEDGEMENT
The entire session of final project completion was a great experience, providing us
a great insight and innovation into learning various software engineering concepts
and benefits of teamwork. As is rightly said, for the successful completion of any
software project, people are the most important asset. Our project would not be
materialized without the cooperation of many of the people involved.
First and foremost, we are very much thankful to our respected project
guide PROF. R.D.KOKARE SIR For his leading guidance and sincere efforts in
finalizing this topic .he took a deep interest in correcting the minor problems and
guided us through whole project. Also he has been persistent source of inspiration
for us.
We are also very thankful to our H.O.D. PROF.P.B.KALE SIR for the
systematic guidance and providing necessary facilities and we express our deep
gratitude to all the staff members and our department’s technical staff for providing
us needed help.
Finally we express our thanks to our PRINCIPAL. S.WESSLEY. SIR , parents
and friends, who always encouraged us whenever afraid of failing. You all have
always helped keep our feet planted firmly on the ground; with you all we are truly
blessed.
NAMES OF STUDENTS:
6
ABSTRACT
The E-BOOK STORE project that aims to design and develop an online book store
management web application. The main objective of this project is to provide an
efficient and reliable platform for customers to search, purchase, and manage
books online. The system will allow customers to browse through various
categories of books, view book details, add books to the shopping cart, make
payments, and review books. The application will also provide features for
administrators to manage books, vendors, and orders.
Functional Requirements:
1.Browse Books: An user logging into the site can browse through the books both by
category or in a random manner.
2.View Details: An user can also view the details of the books (e.g., price, author, title).
Add to cart: The user can add the books of his choice to the shopping cart.
3.Make payments: The user ultimately visits his cart and makes the payments.
Review for Books: Users can give reviews for books.
Keywords: Reviews Books , Pick Your Categories, Browse Books, View Details, Checkout Cart.
7
Content page
Sr. No. Name of topic Page No.
1 Title Page 1
2 Certificate 3
3 Acknowledgement 6
4 Abstract 7
5 Content page 8
6 Chapter-1 Introduction 9
9 Chapter-4 Methodology 13
12 Outputs 35-41
8
Chapter 1:
INTRODUCTION
The digital transformation of the book industry has revolutionized how people
consume literature and educational materials. E-books, in particular, have emerged as
a highly convenient and accessible way for readers to access a wide variety of
content. An E-Book Store WebApp aims to provide a seamless platform for users to
browse, purchase, and download e-books across multiple genres, including fiction,
non-fiction, educational, and more. The goal of this capstone project is to design and
develop a fully functional and user-friendly web application that not only facilitates
e-book transactions but also offers additional features like book recommendations,
user reviews, and integration with multiple payment systems.
This project will focus on delivering an intuitive, responsive, and secure e-book store
that enhances the reading experience by leveraging the power of modern web
technologies. It will enable users to:
1. Browse a Wide Range of E-Books: Users can explore a large catalog of books,
sorted by genre, popularity, or recent releases.
2. Make Secure Purchases: The platform will feature integration with reliable
payment gateways for easy and secure transactions.
3. Download and Read Books: After purchasing, users can easily download e-
books in multiple formats compatible with various devices and reading
platforms.
4. Book Recommendations and Reviews: Personalized recommendations based
on user preferences and ratings, as well as user-generated reviews to help other
buyers make informed decisions.
5. Account Management: Users can create accounts to track purchase history,
manage downloaded content, and customize their reading preferences.
9
Chapter 2:
LITERATURE SURVEY
An E-Book Store Web Application involves reviewing and
summarizing existing research, technologies, and trends in the domain of
e-book stores, digital content distribution, and web app development.
This can include studies on user preferences, security features, payment
integration, data management, and the latest trends in e-commerce and
web app design.
Problem Identification:
From the insights gathered, several core problems can be identified
that the proposed E-Book Store WebApp seeks to solve:
1. Limited Personalization: Most platforms offer limited or
generic recommendations, making it harder for users to find
books that match their unique tastes and preferences.
2. Device Compatibility Issues: Proprietary formats (such as
AZW) restrict cross-platform and cross-device usage, creating
friction for users who want to access their books on multiple
devices.
3. Complicated User Interfaces: Many e-book platforms are
difficult to navigate, particularly for new users or those
unfamiliar with digital books. A streamlined, user-friendly
10
interface is essential to ensure that users can quickly browse
and make purchases.
4. Limited Payment Methods: A lack of support for diverse
payment options, especially in international markets, reduces
the accessibility and inclusivity of existing platforms.
5. Discovery Challenges: Despite large book catalogs, many
platforms struggle with discoverability. Effective search tools,
personalized recommendations, and advanced filtering options
are essential for helping users find books that align with their
interests.
11
Chapter 3:
Scope of the Project
12
Chapter 4:
Methodology
The development process follows the Agile methodology, which
allows continuous improvements and feedback integration. The
steps include:
1. Requirement Analysis: Identifying key features and user
needs.
2. Design Phase: Creating Frontend for E-Book store
webapp.
3. Development Phase: Coding the Webapp for E-Book store
using Java and designing the interface using html and Css.
4. Testing Phase: Conducting unit testing, UI testing, and
gathering user feedback.
5. Deployment Phase: Releasing the application for Android
users.
6. Maintenance & Updates: Fixing bugs, improving
performance, and adding new features over time.
13
Chapter 5:
Details of Design, Working, and Processes
1. User Interface Design:
1. Home Page: The landing page of the e-book store displays a clean, visually appealing
layout with sections for featured e-books, new arrivals, bestsellers, and promotional
offers. A prominent search bar at the top allows users to quickly find specific e-books by
title, author, or genre.
2. Category and Genre Pages: Separate pages for various genres (e.g., Fiction, Non-
fiction, Science, Romance) are designed to make browsing easy. Each category page
contains filters such as price range, ratings, and publication date, enabling users to refine
their search and find the perfect e-book.
3. Product Detail Pages: Each e-book has its own product page with essential information,
including the title, author
2.Webapp Mechanics:
3.Technology Stack:
14
Chapter 6:
Results and Applications
• The Web application successfully integrates multiple Books into
as Multiple platform.
• Users can Purchase the Books from Store.
• A smooth UI enhances the User experience.
• The Web app can be used for Purchasing books, Oredring books
etc..
Program:
JSP:
Add-Books.JSP:
<%--
Document : add_books
Created on : Mar 9, 2022, 12:12:25 AM
Author : MeGa
--%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@page isELIgnored="false" %>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Add Book Page - E-Book</title>
<%@include file="all_css.jsp" %>
</head>
<body style="background-color: #f0f1f2">
<%@include file="navbar.jsp" %>
<c:if test="${empty userobj}">
<c:redirect url="../login.jsp" />
</c:if>
<h3 class="text-center">Hello, Admin</h3>
<div class="container mt-3">
15
<div class="row">
<div class="col-md-6 offset-md-3">
<div class="card">
<div class="card-body">
<c:if test="${not empty succMsg}">
<div class="container text-center">
<div class="alert alert-success" role="alert">
${succMsg}
</div>
</div>
<c:remove var="succMsg" />
</c:if>
<c:if test="${not empty failedMsg}">
<div class="container text-center">
<div class="alert alert-danger" role="alert">
${failedMsg}
</div>
</div>
<c:remove var="failedMsg" />
</c:if>
<h3 class="text-center">Add Books</h3>
<form action="../add_book" method="post" enctype="multipart/form-data">
<div class="form-group">
<label>Book Name *</label>
<input type="text" name="bookName" class="form-control" aria-
describedby="emailHelp" required>
</div>
<div class="form-group">
<label>Author Name *</label>
<input type="text" name="authorName" class="form-control" aria-
describedby="emailHelp" required>
</div>
<div class="form-group">
<label>Book Price *</label>
<input type="number" name="bookPrice" class="form-control" aria-
describedby="emailHelp" required>
</div>
<div class="form-group">
<label>Book Category *</label>
<select id="category" class="form-control" name="bCategory" required>
<option selected disabled>--- Select ---</option>
<option value="New">New Book</option>
</select>
16
</div>
<div class="form-group">
<label>Book Status *</label>
<select id="status" class="form-control" name="bStatus" required>
<option selected disabled>--- Select ---</option>
<option value="Active">Active</option>
<option value="Inactive">Inactive</option>
</select>
</div>
<div class="form-group">
<label>Upload Image</label>
<input type="file" name="bImage" class="form-control" required>
</div>
<button type="submit" class="btn btn-primary badge-pill btn-block">Add Book</button>
</form>
</div>
</div>
</div>
</div>
</div>
<div style="margin-top: 20px;">
<%@include file="footer.jsp" %>
</div>
</body>
</html>
Home.JSP:
<%--
Document : Home
Created on : Mar 8, 2022, 10:56:51 PM
Author : MeGa
--%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@page isELIgnored="false" %>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Admin User Page - E-Books</title>
17
<%@include file="all_css.jsp" %>
<style>
a{
text-decoration: none;
color: black;
}
a:hover{
text-decoration: none;
}
.crd-ho:hover{
background-color: #f0f1f2;
}
</style>
</head>
<body style="background-color: #f0f1f2">
<%@include file="navbar.jsp" %>
<c:if test="${empty userobj}">
<c:redirect url="../login.jsp" />
</c:if>
<div class="container mt-3">
<h1 class="text-center">Hello,Admin</h1>
<div class="row p-5">
<div class="col-md-3">
<a href="add_books.jsp">
<div class="card crd-ho" style="height: 180px;">
<div class="card-body text-center">
<br>
<i class="fas fa-plus-square fa-3x text-
primary"></i>
<h4>Add Books</h4>
-----------------
</div>
</div>
</a>
</div>
<div class="col-md-3">
<a href="all_books.jsp">
<div class="card crd-ho" style="height: 180px;">
<div class="card-body text-center">
<br>
18
<i class="fa-solid fa-book-open fa-3x text-
danger"></i>
<h4>All Books</h4>
-----------------
</div>
</div>
</a>
</div>
<div class="col-md-3">
<a href="orders.jsp">
<div class="card crd-ho" style="height: 180px;">
<div class="card-body text-center">
<br>
<i class="fas fa-box-open fa-3x text-
warning"></i>
<h4>Orders</h4>
-----------------
</div>
</div>
</a>
</div>
<div class="col-md-3">
<a data-toggle="modal" data-target="#exampleModalCenter" >
<div class="card crd-ho" style="height: 180px;">
<div class="card-body text-center">
<br>
<i class="fa-solid fa-right-to-bracket fa-3x
text-primary"></i>
<h4>Logout</h4>
-----------------
</div>
</div>
</a>
</div>
</div>
</div>
<!--logout model-->
<!-- Button trigger modal -->
19
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLongTitle">E-
Books Management System</h5>
<button type="button" class="close" data-dismiss="modal"
aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<div class="text-center">
<h4>Do you want logout?</h4>
<button type="button" class="btn btn-secondary" data-
dismiss="modal">No</button>
<a href="../logout" class="btn btn-primary text-
white">Yes</a>
</div>
</div>
<div class="modal-footer">
</div>
</div>
</div>
</div>
<!--end of logout model-->
<div style="margin-top: 100px;">
<%@include file="footer.jsp" %>
</div>
</body>
</html>
NavBars.JSP:
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@page isELIgnored="false" %>
<div class="container-fluid" style="height: 10px; background-color: #303f9f">
</div>
<div class="container-fluid p-3 btn-light">
<div class="row">
<div class="col-md-3 text-success">
<h3><i class="fa-solid fa-book"></i> E-Book Store</h3>
</div>
<div class="col-md-6">
20
</div>
<div class="col-md-3">
<c:if test="${not empty userobj}">
<a href="#" class="btn btn-success"><i class="fas fa-user"></i>
${userobj.name}</a>
<a data-toggle="modal" data-target="#exampleModalCenter"
class="btn btn-primary text-white"><i class="fa-solid fa-right-to-bracket"></i>
Logout</a>
</c:if>
<c:if test="${empty userobj}">
<a href="../login.jsp" class="btn btn-success"><i class="fa-solid
fa-right-to-bracket"></i> Login</a>
<a href="../register.jsp" class="btn btn-primary text-white"><i
class="fa-solid fa-user-plus"></i> Register</a>
</c:if>
</div>
</div>
</div>
<!--logout model-->
<!-- Button trigger modal -->
21
<div class="modal-footer">
</div>
</div>
</div>
</div>
<!--end of logout model-->
<nav class="navbar navbar-expand-lg navbar-dark bg-custom">
<a class="navbar-brand" href="Home.jsp"><i class="fa-solid fa-house"></i></a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-
target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-
expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
Order Page:
<%--
Document : show_single_order
Created on : Mar 13, 2022, 10:28:36 PM
Author : MeGa
--%>
<%@page import="com.model.BookOrder"%>
<%@page import="com.connection.DBConnection"%>
<%@page import="com.daoImpl.BookOrderDaoImpl"%>
<%@page import="com.dao.BookOrderDao"%>
22
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@page isELIgnored="false" %>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Show Single Order Page - EBook</title>
<%@include file="all_css.jsp" %>
</head>
<body style="background-color: #f0f1f2">
23
<input type="text" class="form-control form-
control-sm" value="Author: <%= b.getAuthorName() %>" readonly>
</div>
<div class="form-group col-md-3">
<input type="text" class="form-control form-
control-sm" value="Book Price: ₨. <%= b.getPrice()%>" readonly>
</div>
</div>
<div class="form-row">
<div class="form-group col-md-3">
<input type="text" class="form-control form-
control-sm" value="Username: <%= b.getUserName() %>" readonly>
</div>
<div class="form-group col-md-3">
<input type="text" class="form-control form-
control-sm" value="Email: <%= b.getEmail() %>" readonly>
</div>
<div class="form-group col-md-3">
<input type="text" class="form-control form-
control-sm" value="Phone Number: <%= b.getPhoneNumber()%>" readonly>
</div>
<div class="form-group col-md-3">
<input type="text" class="form-control form-
control-sm" value="Payment Type: <%= b.getPaymentType()%>" readonly>
</div>
</div>
<div class="form-row">
<div class="form-group col-md-12">
<input type="text" class="form-control form-
control-sm" value="User Address: <%= b.getFullAddress()%>" readonly>
</div>
</div>
<div class="form-row">
24
</div>
</div>
</div>
</div>
<%@include file="footer.jsp" %>
</body>
</html>
ViewBookDetails.JSP:
<%--
Document : view_book_details
Created on : Mar 11, 2022, 4:57:53 PM
Author : MeGa
--%>
<%@page import="com.model.Books"%>
<%@page import="com.connection.DBConnection"%>
<%@page import="com.daoImpl.BookDaoImpl"%>
<%@page import="com.dao.BookDao"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>View Book Details Page - EBook</title>
<%@include file="all_component/all_css.jsp" %>
</head>
<body style="background: #f0f1f2">
<%@include file="all_component/navbar.jsp" %>
<%
Integer id = Integer.parseInt(request.getParameter("id"));
BookDao bookDao = new BookDaoImpl(DBConnection.getConnection());
Books b = bookDao.getBookById(id);
%>
<div class="container p-3">
<div class="row">
<div class="col-md-6 text-center p-5 border bg-white">
<img src="book/<%= b.getPhotoName()%>" style="width: 150px;
height: 150px;" />
<h4 class="mt-2">Book Name: <span class="text-success"><%=
b.getBookName()%></span></h4>
25
<h4>Author Name: <span class="text-success"><%=
b.getAuthor()%></span></h4>
<h4>Category: <span class="text-success"><%=
b.getBookCategory()%></span></h4>
</div>
<div class="col-md-6 text-center p-5 border bg-white">
<h4><%= b.getBookName()%></h4>
<%
if ("Old".equals(b.getBookCategory())) {
%>
<h5 class="text-primary">Contact to Seller</h5>
<h5 class="text-primary">
<i class="far fa-envelope"></i>
Email: <%= b.getEmail()%>
</h5>
<%
} else {
%>
<h5 class="text-primary">Contact to Admin</h5>
<h5 class="text-primary">
<i class="far fa-envelope"></i>
Email: <%= b.getEmail()%>
</h5>
<%
}
%>
<div class="row">
<div class="col-md-4 text-danger text-center p-2">
<i class="fas fa-money-bill-wave fa-3x"></i>
<p><b>Cash on Delivery</b></p>
</div>
<div class="col-md-4 text-danger text-center p-2">
<i class="fas fa-undo-alt fa-3x"></i>
<p><b>Return Available</b></p>
</div>
<div class="col-md-4 text-danger text-center p-2">
<i class="fas fa-truck-moving fa-3x"></i>
<p><b>Free Shipping</b></p>
</div>
</div>
<%
if ("Old".equals(b.getBookCategory())) {
%>
<div class="text-center p-3">
26
<a href="index.jsp" class="btn btn-success"><i class="fa-
solid fa-cart-plus"></i> Continue Shopping</a>
<button class="btn btn-danger">₨. <%=
b.getPrice()%></button>
</div>
<%
} else {
%>
</div>
</div>
</div>
<div style="margin-top: 45px;">
<%@include file="all_component/footer.jsp" %>
</div>
</body>
</html>
<groupId>com.ebook</groupId>
<artifactId>EBook</artifactId>
<version>1</version>
<packaging>war</packaging>
<name>EBook</name>
27
<properties>
<endorsed.dir>${project.build.directory}/endorsed</endorsed.dir>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-web-api</artifactId>
<version>7.0</version>
<scope>provided</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/jstl/jstl -->
<dependency>
<groupId>jstl</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>
<!-- https://mvnrepository.com/artifact/mysql/mysql-connector-java -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.25</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
<compilerArguments>
<endorseddirs>${endorsed.dir}</endorseddirs>
</compilerArguments>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.3</version>
<configuration>
28
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.6</version>
<executions>
<execution>
<phase>validate</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<outputDirectory>${endorsed.dir}</outputDirectory>
<silent>true</silent>
<artifactItems>
<artifactItem>
<groupId>javax</groupId>
<artifactId>javaee-endorsed-api</artifactId>
<version>7.0</version>
<type>jar</type>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
base.html
<!DOCTYPE html>
<html lang="en" data-bs-theme="dark">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Game Hub</title>
29
<link href="https://cdn.jsdelivr.net/npm/[email protected]
alpha1/dist/css/bootstrap.min.css" rel="stylesheet">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-
[email protected]/font/bootstrap-icons.css">
<link rel="stylesheet" href="{{ url_for('static', filename='css/styles.css')
}}">
<script
src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js
"></script>
</head>
<body>
<nav class="navbar navbar-expand-lg navbar-dark bg-dark">
<div class="container">
<a class="navbar-brand" href="{{ url_for('dashboard') }}">Game
Hub</a>
{% if current_user.is_authenticated %}
<div class="navbar-nav ms-auto">
<span class="nav-item nav-link">Welcome, {{ current_user.username
}}</span>
<a class="nav-item nav-link" href="{{ url_for('logout')
}}">Logout</a>
</div>
{% endif %}
</div>
</nav>
</body>
</html>
</body>
</html>
Cart.html
30
{% extends "base.html" %}
{% block content %}
<div class="row">
<div class="col-12 text-center mb-4">
<h2>Welcome to Game Hub</h2>
<p>Select Your Favorite Game</p>
</div>
</div>
31
<div class="card-body text-center">
<h5 class="card-title">Rock Paper Scissors</h5>
<p class="card-text">High Score: {{
scores.get('rockpaperscissors', 0) }}</p>
<a href="{{ url_for('rockpaperscissors') }}" class="btn btn-
primary">Play</a>
</div>
</div>
</div>
<div class="col-md-4 mb-4">
<div class="card">
<div class="card-body text-center">
<h5 class="card-title">Ludo</h5>
<p class="card-text">High Score: {{ scores.get('ludo', 0) }}</p>
<a href="{{ url_for('ludo') }}" class="btn btn-primary">Play</a>
</div>
</div>
</div>
<div class="col-md-4 mb-4">
<div class="card">
<div class="card-body text-center">
<h5 class="card-title">Brick Breaker</h5>
<p class="card-text">High Score: {{ scores.get('brickbreaker', 0)
}}</p>
<a href="{{ url_for('brickbreaker') }}" class="btn btn-
primary">Play</a>
</div>
</div>
</div>
</div>
{% endblock %}
login.html
{% extends "base.html" %}
{% block content %}
<div class="row justify-content-center">
<div class="col-md-6">
<div class="card">
<div class="card-header">
<h2 class="text-center">Log in</h2>
</div>
<div class="card-body">
<form method="POST" action="{{ url_for('login') }}">
32
{{ form.hidden_tag() }}
<div class="mb-3">
{{ form.username.label(class="form-label") }}
{{ form.username(class="form-control") }}
</div>
<div class="mb-3">
{{ form.password.label(class="form-label") }}
<div class="input-group">
{{ form.password(class="form-control") }}
<button class="btn btn-outline-secondary"
type="button" onclick="togglePassword('{{ form.password.id }}')">
<i class="bi bi-eye"></i>
</button>
</div>
</div>
{{ form.submit(class="btn btn-primary w-100", value="Log in")
}}
</form>
<div class="mt-3 text-center">
<p>Don't have an account? <a href="{{ url_for('register')
}}">Sign up here</a></p>
</div>
</div>
</div>
</div>
</div>
<script>
function togglePassword(fieldId) {
const passwordField = document.getElementById(fieldId);
const button = event.currentTarget;
const icon = button.querySelector('i');
33
register.html
{% extends "base.html" %}
{% block content %}
<div class="row justify-content-center">
<div class="col-md-6">
<div class="card">
<div class="card-header">
<h2 class="text-center">Sign up</h2>
</div>
<div class="card-body">
<form method="POST" action="{{ url_for('register') }}">
{{ form.hidden_tag() }}
<div class="mb-3">
{{ form.username.label(class="form-label") }}
{{ form.username(class="form-control") }}
</div>
<div class="mb-3">
{{ form.password.label(class="form-label") }}
<div class="input-group">
{{ form.password(class="form-control") }}
<button class="btn btn-outline-secondary"
type="button" onclick="togglePassword('{{ form.password.id }}')">
<i class="bi bi-eye"></i>
</button>
</div>
</div>
{{ form.submit(class="btn btn-primary w-100", value="Sign
up") }}
</form>
<div class="mt-3 text-center">
<p>Already have an account? <a href="{{ url_for('login')
}}">Log in here</a></p>
</div>
</div>
</div>
</div>
</div>
<script>
function togglePassword(fieldId) {
const passwordField = document.getElementById(fieldId);
const button = event.currentTarget;
const icon = button.querySelector('i');
34
if (passwordField.type === 'password') {
passwordField.type = 'text';
icon.classList.remove('bi-eye');
icon.classList.add('bi-eye-slash');
} else {
passwordField.type = 'password';
icon.classList.remove('bi-eye-slash');
icon.classList.add('bi-eye');
}
}
</script>
{% endblock %}
from flask_wtf import FlaskForm
from wtforms import StringField, PasswordField, SubmitField
from wtforms.validators import DataRequired, Length
class LoginForm(FlaskForm):
username = StringField('Username', validators=[DataRequired(), Length(min=3,
max=20)])
password = PasswordField('Password', validators=[DataRequired()])
submit = SubmitField('Log in')
class RegisterForm(FlaskForm):
username = StringField('Username', validators=[DataRequired(), Length(min=3,
max=20)])
password = PasswordField('Password', validators=[DataRequired(),
Length(min=6)])
submit = SubmitField('Sign up')
class Score:
def __init__(self, user_id, game, score):
self.user_id = user_id
self.game = game
self.score = score
35
Output:
36
37
38
39
40
Chapter 7:
Conclusion and Future Scope
The E-Book Store Webapp provides a robust platform for users to
easily browse, purchase, and download e-books in a seamless and secure
manner. With its user-friendly interface, personalized recommendations,
and integrated payment gateways, the platform offers an excellent e-
commerce experience. The webapp also ensures data security through
encryption and optional two-factor authentication, protecting users'
personal and financial information. Instant access to e-books in multiple
formats allows for a flexible reading.
41
References:
• IntelliJ IDEA:
• Tomcat:
42