Otp Validation: Project Report On

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 10

Project Report on

OTP VALIDATION
Manoj Konda

Under esteemed guidance of

Ms. Ashwairya Saxena

(Mini Python Project)


INDEX

Sl.No. Topic

1 Introduction

2 Objectives

3 Background

4 Hardware and Software Requirements

5 Coding

6 Output Screenshot

7 Future Scope

8 Conclusion

9 Bibliography and References


INTRODUCTION

Security and Privacy are most important for an Individual in this Software domain. So, we should give access
to only the authorised individual. Authentication is necessary. That’s how OTP(one time password) helps . It is
a fixed length of random number generated and sent to the individual for verification , he/she enters OTP for
verification.

This Project describes a method of generating a 6 digit OTP and sending it to the email for giving access to
authorised individuals. The proposed method guarantees that authenticating to services, such as Online
Banking, ATM Machines, Email verification, Account verifications.
The Proposed method involves :
1. OTP generation (6 digit)
2. Send OTP to respective emails
3. OTP validation (only 3 attempts )
4. Send Verification gmail

OBJECTIVE

OTP exists to prevent unauthorized access. Companies should ensure that unauthorized access is not allowed
and also authorized users cannot make unnecessary modifications. The controls exist in a variety of forms,
from Identification Badges and passwords to access authentication protocols and security measures.

This project enables us to generate 6 digit otp for verification to prevent Unauthorised access.

BACKGROUND
This OTP validation is seen at many different applications, Softwares, Data privacy. This ensures only access to
Authorised persons. OTP system will not give permissions to unauthorised persons. During Payments, Data
transfer, etc., person identification is a must. So,
HARDWARE AND SOFTWARE REQUIREMENTS

HARDWARE TOOLS MINIMUM REQUIREMENTS


Processor i5 or above
Hard disk 10GB
RAM 8GB
Monitor 17’’ Coloured
Mouse Optical
Keyboard 122 Keys

SOFTWARE TOOLS MINIMUM REQUIREMENTS


Platform Windows/Linux/MacOS
Operating System Windows/Linux/MacOS
Technology Machine learning – Python
Scripting language Python
IDE Spyder

Libraries Used:
● smtplib - for sending email
● random - to generate 6digit random number
● MIMEtext
● MIMEMultipart
This method is generating a 6 digit OTP and sending it to the email . The Proposed method involves OTP
generation , Send OTP to respective emails, OTP validation (only 3 attempts ), Send Verification gmail.
OTP is generated using python random library . This generated OTP is sent to gmail for person identification.
OTP generated is stored. User enters that OTP , and the system checks whether the OTP is correct or not. If
the OTP entered is correct, send an OTP verified email. If the OTP entered is not correct, the system gives 3
chances to enter a correct OTP.
This is Successful User Authentication.
CODING

import string
import random
import smtplib
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
from getpass import getpass

# OTP Generation
OTP = "".join([random.choice(string.digits) for i in range(6)])

# creating mail content


sub = "OTP Validation "
body = """
This OTP is Sent as a part of small python project
Don't Worry
Enter This OTP
""" + OTP
msg = MIMEMultipart()
msg["Subject"] = sub
msg.attach(MIMEText(body, "plain"))
message = msg.as_string()

# sender email and password check


smtp_server = "smtp.gmail.com"
port = 587 # For starttls (security)
sender_email = "jackyspirrel@gmail.com" # This is my email enter your email here

password = "********" # Enter Your email password here

server = smtplib.SMTP(smtp_server, port)


server.starttls()
# login check of sender
server.login(sender_email, password)
receiver_email = input("Enter Your Email : ")
# sending email with OTP
server.sendmail(sender_email, receiver_email, message)

print("Otp Sent to your Email please Check your email")

# OTP validation
def authenticate():
i = input("\n\nEnter your Otp : ")
if i == OTP:
print("OTP verified Successfully")
else:
for k in range(3):
print("Invalid OTP\nYou have {} attempts left ".format(3 - k))
i = input("Enter your OTP again:")
if i == OTP:
print("OTP verified Successfully")
break
if k == 2 and i != OTP:
print("Reached Maximum Attempts")

authenticate()

# Content for another email


subb = "OTP Verified " + u'\u263A'
bod = """
OTP Verified Successfully
Thank You \u263A
"""
m = MIMEMultipart()
m["Subject"] = subb
m.attach(MIMEText(bod, "plain"))
mes = m.as_string()

server.sendmail(sender_email, receiver_email, mes)


OUTPUT SCREENSHOTS
1) This method asks user for his/her gmail address to send OTP via respective gmail.

2) This is how email is sent with OTP to the user.


3) User should enter OTP
If he enters the wrong OTP system gives you 3 chances . If the user fails to give the correct OTP program
terminates. If the OTP entered is correct then it sends an email with a message that he/she is verified.
4) Email is sent again stating that the user is verified.

FUTURE SCOPE

Software Technologies are trending now. And I bet it will be trending forever. So, Many programs like Online
Banking system, Gmail Accounts, Netflix Accounts, E-commerce accounts, etc., will be having many and many
users . So User’s security is in trouble only he should be having access to his accounts . Passwords may
sometimes not be the perfect solution for unauthorized access. So, OTP validation will be giving access to
only Authorised persons. This will be included in every software to keep the User account and his details safe.

CONCLUSION

This Project prevents Unauthorised access. OTP validation system secures one's account for his privacy.

REFERENCES

● I referred to this website for sending Emails. (https://realpython.com/python-send-email/)

You might also like