-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d9b6287
commit 938ae81
Showing
1 changed file
with
310 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,310 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "markdown", | ||
"id": "7c6d49f2", | ||
"metadata": {}, | ||
"source": [ | ||
"## Authentication System - Python Project\n", | ||
"- SignUp System\n", | ||
" - Username\n", | ||
" - Not case-sensitive\n", | ||
" - Password\n", | ||
" - Case-sensitive\n", | ||
" - Check Password Strength\n", | ||
" - Minimum 8 characters\n", | ||
" - Combination of upper and lower case characters\n", | ||
" - Combination of alphabets and digits and special characters\n", | ||
" - Confirm Pasword\n", | ||
" - Mobile Number\n", | ||
" - Twilio\n", | ||
" - Email ID\n", | ||
" - Security Questions - 2\n", | ||
" - Send OTP to registered mobile number\n", | ||
" \n", | ||
"- Database Management\n", | ||
" - Local database inside python\n", | ||
" - Using any collection sequence\n", | ||
" \n", | ||
"- SignIn System\n", | ||
" - Username\n", | ||
" - Password\n", | ||
" - Forgot Password\n", | ||
" - based on security question or otp" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 14, | ||
"id": "1012efe3", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"# db = {'admin': 'Qwerty@123'}\n", | ||
"# mdb = {'admin': '9354328855'}\n", | ||
"\n", | ||
"db = {'admin':'root@123',\n", | ||
" 'username': ['Qwerty@123', '9354328855','ans1', 'ans2']}" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 41, | ||
"id": "491f068f", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"def checkPasswordStrength(): pass" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 42, | ||
"id": "458db724", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"def confirmPassword(): pass" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 43, | ||
"id": "acec1656", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"def secQues():\n", | ||
" print('Give answers to these 2 Security Questions: ')\n", | ||
" ans1 = input('Enter your city: ').lower()\n", | ||
" ans2 = input('Enter your favourite color: ').lower()\n", | ||
" return ans1, ans2" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 44, | ||
"id": "0abba4a7", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"def signUp():\n", | ||
" print(\"*****Welcome to Skillslash's SignUp Page*****\")\n", | ||
" print('_____________________________________________\\n')\n", | ||
" userUp = input('Enter a new Username: ').lower()\n", | ||
" if userUp not in db:\n", | ||
" passUp = input('Enter a strong Password: ')\n", | ||
" checkPasswordStrength()\n", | ||
" confirmPassword()\n", | ||
" mobUp = input('Enter Mobile Number: ')\n", | ||
" ans1, ans2 = secQues()\n", | ||
" value = [passUp, mobUp, ans1, ans2]\n", | ||
" db.update({userUp:value})\n", | ||
" else:\n", | ||
" print('Username already in use. Please try another...')\n", | ||
" \n", | ||
"# signUp()" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 48, | ||
"id": "2e6f1ca7", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"def forgotPassword(username): pass" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 49, | ||
"id": "31b96090", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"def signIn():\n", | ||
" print(\"*****Welcome to Skillslash's SignIn Page*****\")\n", | ||
" print('_____________________________________________\\n')\n", | ||
" userIn = input('Enter your username: ').lower()\n", | ||
" if userIn in db:\n", | ||
" for chance in range(1, 4):\n", | ||
" passIn = input('Enter your Password: ')\n", | ||
" if db[userIn][0] == passIn:\n", | ||
" print('SignIn successful...')\n", | ||
" return\n", | ||
" else:\n", | ||
" print(f'Wrong Password. Please try again...{3-chance} chances left...')\n", | ||
" fp = input('SignIn failed. Press 0 to forgot password.')\n", | ||
" if fp == '0': forgotPassword(userIn)\n", | ||
" # else : continue\n", | ||
" else:\n", | ||
" print('Username does not exist. Please try again...')\n", | ||
" \n", | ||
"# signIn()" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 46, | ||
"id": "3a5141bc", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"def checkDB():\n", | ||
" userpass = input('Give your credentials: ') # admin,root@123\n", | ||
" userpassList = userpass.split(',')\n", | ||
" user, passw = userpassList\n", | ||
" if user == 'admin' and passw == 'root@123':\n", | ||
" print('-------------------------------------------------------')\n", | ||
" for k, v in db.items():\n", | ||
" print(f'{k} : {v}')\n", | ||
" print('-------------------------------------------------------')" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 47, | ||
"id": "408171eb", | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"name": "stdout", | ||
"output_type": "stream", | ||
"text": [ | ||
"\n", | ||
"Please choose mode:\n", | ||
" Press 1 to SignUp\n", | ||
" Press 2 to SignIn\n", | ||
" Press 0 to Exit\n", | ||
" : 1\n", | ||
"*****Welcome to Skillslash's SignUp Page*****\n", | ||
"_____________________________________________\n", | ||
"\n", | ||
"Enter a new Username: madhavi\n", | ||
"Enter a strong Password: asdfgh!34\n", | ||
"Enter Mobile Number: 7418529630\n", | ||
"Give answers to these 2 Security Questions: \n", | ||
"Enter your city: bhopal\n", | ||
"Enter your favourite color: green\n", | ||
"\n", | ||
"Please choose mode:\n", | ||
" Press 1 to SignUp\n", | ||
" Press 2 to SignIn\n", | ||
" Press 0 to Exit\n", | ||
" : 2\n", | ||
"*****Welcome to Skillslash's SignIn Page*****\n", | ||
"_____________________________________________\n", | ||
"\n", | ||
"Enter your username: aditya\n", | ||
"Enter your Password: asdfghjkl\n", | ||
"Wrong Password. Please try again...2 chances left...\n", | ||
"Enter your Password: fjghj\n", | ||
"Wrong Password. Please try again...1 chances left...\n", | ||
"Enter your Password: qwer123\n", | ||
"SignIn successful...\n", | ||
"\n", | ||
"Please choose mode:\n", | ||
" Press 1 to SignUp\n", | ||
" Press 2 to SignIn\n", | ||
" Press 0 to Exit\n", | ||
" : 2\n", | ||
"*****Welcome to Skillslash's SignIn Page*****\n", | ||
"_____________________________________________\n", | ||
"\n", | ||
"Enter your username: madhavi\n", | ||
"Enter your Password: asdfgh!34\n", | ||
"SignIn successful...\n", | ||
"\n", | ||
"Please choose mode:\n", | ||
" Press 1 to SignUp\n", | ||
" Press 2 to SignIn\n", | ||
" Press 0 to Exit\n", | ||
" : 0\n", | ||
"Thank you for visiting.....\n" | ||
] | ||
} | ||
], | ||
"source": [ | ||
"while 1:\n", | ||
" mode = input('''\n", | ||
"Please choose mode:\n", | ||
" Press 1 to SignUp\n", | ||
" Press 2 to SignIn\n", | ||
" Press 0 to Exit\n", | ||
" : ''')\n", | ||
" if mode == '1':\n", | ||
" signUp()\n", | ||
" \n", | ||
" elif mode == '2':\n", | ||
" signIn()\n", | ||
" \n", | ||
" elif mode == '-74.52':\n", | ||
" checkDB()\n", | ||
" \n", | ||
" elif mode == '0':\n", | ||
" print('Thank you for visiting.....')\n", | ||
" break\n", | ||
" \n", | ||
" else:\n", | ||
" print('Invalid Input')" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 50, | ||
"id": "77602d17", | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"name": "stdout", | ||
"output_type": "stream", | ||
"text": [ | ||
"Give your credentials: admin,root@123\n", | ||
"-------------------------------------------------------\n", | ||
"admin : root@123\n", | ||
"username : ['Qwerty@123', '9354328855', 'ans1', 'ans2']\n", | ||
"harshil : ['Some@123', '9354328855', 'delhi', 'black']\n", | ||
"aditya : ['qwer123', '9638524140', 'pune', 'blue']\n", | ||
"madhavi : ['asdfgh!34', '7418529630', 'bhopal', 'green']\n", | ||
"-------------------------------------------------------\n" | ||
] | ||
} | ||
], | ||
"source": [ | ||
"# checkDB()" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 25, | ||
"id": "952d29db", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"# del db['harshil']" | ||
] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "Python 3 (ipykernel)", | ||
"language": "python", | ||
"name": "python3" | ||
}, | ||
"language_info": { | ||
"codemirror_mode": { | ||
"name": "ipython", | ||
"version": 3 | ||
}, | ||
"file_extension": ".py", | ||
"mimetype": "text/x-python", | ||
"name": "python", | ||
"nbconvert_exporter": "python", | ||
"pygments_lexer": "ipython3", | ||
"version": "3.10.9" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 5 | ||
} |