Skip to content

abhit10/LokMat

Repository files navigation

LoKMat — Online Voting System

A desktop online voting application built with Python and Tkinter. It simulates a secure election workflow with voter registration, OTP verification, socket-based vote submission, and an admin dashboard for managing elections.

Portfolio project — demonstrates GUI development, client–server networking, CSV-based data persistence, and email-based two-factor authentication.

Features

  • Voter portal — Login with voter ID and password, OTP verification via email, and cast a vote for one of five options (BJP, Congress, AAP, Shiv Sena, NOTA)
  • Admin dashboard — Register voters, view live results, start/stop the voting server, and reset election data
  • Socket server — Threaded TCP server handles authentication and vote recording with concurrency control
  • OTP security — One-time passwords sent over SMTP before a vote is accepted
  • Election chatbot — Built-in help chatbot on the home screen
  • CSV database — Lightweight voter and candidate storage using pandas

Tech Stack

Layer Technology
Language Python 3.10+
GUI Tkinter
Networking socket, threading
Data pandas, CSV files
Email smtplib + Gmail App Passwords
Images Pillow (PIL)
Process management psutil

Project Structure

Online-Voting-System/
├── main.py              # Application entry point
├── splash.py            # Splash screen
├── homePage.py          # Home page and navigation
├── voter.py             # Voter login and OTP flow
├── VotingPage.py        # Ballot / vote casting UI
├── Admin.py             # Admin login and dashboard
├── registerVoter.py     # Voter registration form
├── admFunc.py           # Admin utilities (results, reset)
├── Server.py            # Voting socket server (port 4001)
├── dframe.py            # Database / CSV operations
├── email_utils.py       # OTP generation and email delivery
├── database/
│   ├── voterList.csv    # Registered voters (demo data)
│   └── cand_list.csv    # Candidates and vote counts
├── img/                 # UI assets (party logos, backgrounds)
├── requirements.txt
├── .env.example         # SMTP configuration template
└── Report.pdf           # Project documentation

Getting Started

Prerequisites

  • Python 3.10 or newer
  • pip

Installation

  1. Clone the repository

    git clone https://github.com/<your-username>/Online-Voting-System.git
    cd Online-Voting-System
  2. Create and activate a virtual environment (recommended)

    python -m venv .venv
    
    # Windows
    .venv\Scripts\activate
    
    # macOS / Linux
    source .venv/bin/activate
  3. Install dependencies

    pip install -r requirements.txt
  4. Configure email (required for OTP voting)

    copy .env.example .env    # Windows
    cp .env.example .env      # macOS / Linux

    Edit .env with your SMTP credentials. For Gmail, create an App Password and use it as SMTP_APP_PASSWORD.

    .env is gitignored and will not be committed.

Running the Application

  1. Start the app:

    python main.py
  2. Start the voting server (required before voters can log in):

    • Go to Admin Login → log in → click Start Server
    • Or run the server manually: python Server.py
  3. Cast a vote:

    • Go to Voter Login
    • Use demo credentials (see below)
    • Enter the OTP sent to the voter's registered email
    • Select a candidate and submit

Demo Credentials

Role ID / Username Password
Admin Admin admin
Voter 1 10001 voter123
Voter 2 10002 voter456

Demo voter emails use @example.com addresses. Replace them with real emails in database/voterList.csv (or register new voters via the admin panel) when testing OTP delivery.

How It Works

  1. The admin starts Server.py, which listens on port 4001.
  2. A voter logs in; credentials are checked against voterList.csv.
  3. An OTP is emailed to the voter's registered address.
  4. After OTP verification, the client sends credentials to the server for authentication.
  5. The vote is transmitted over the socket and written to the CSV files under a thread lock.

Security Notes

This project is intended for learning and portfolio demonstration. For a production election system you would need:

  • Hashed passwords (not plain text)
  • A real database with transactions
  • HTTPS/TLS and certificate-based auth
  • Audit logs, rate limiting, and tamper-proof storage
  • OTP storage with expiration in a secure backend

Important: Never commit .env or real SMTP credentials to GitHub. If credentials were ever exposed, revoke them immediately in your Google Account settings.

Author

Abhit Kunkalkar


Built as part of a college / personal portfolio project — LoKMat Election Commission simulation.

About

Desktop online voting system built with Python & Tkinter — voter OTP auth, socket-based vote submission, admin dashboard, and CSV data storage. Portfolio project.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages