Implemented systems of login, logout, registration and one interesting feature.
You can register or login if you already have an account. You will see a beautiful inscription with your name, account number and personal pattern.
Click on it and find out!
Clone this repo to your local machine using https://github.com/CosmoSt4r/sample-flask-app
To start the server you need the following packages:
- Flask
- Flask_SQLAlchemy
- Pillow
- Pypasswords
go to project folder and type
pip install -r requirements.txt
python main.py
or just open
main.py
Open your browser and go to the 127.0.0.1:5000
address. You will see the login page.
- The SQLAlchemy package is used to store information about users with an SQLite database connected to it.
- Upon login, the password from the form is compared with the hash stored in the database using the method
match_it from pypasswords package. If there is a match,
they go on a date, the user gets to the home page.
- When user is registering new account, the password from the form is hashed with the sha-256 algorithm using the function hash_it from the same pypasswords package and along with the login is added to the database.
- Pillow is used to create a personalized pattern. For this, the hash of the username is taken, the first 25 digits are selected from it and used as information for generating image. Initially, it has a resolution of 5 by 5 pixels.
- Then it is simply mirrored along the axes and a symmetrical 10 x 10 pixels pattern is obtained.
- The number of possible combinations: there are only 25 unique pixels to fill 3 colors are used. This means the number of possible combinations is 325. (more than 840 billion)
- I used "Login V3" template for both Log In and Sign Up forms from colorlib.com
- Thanks to Tee Diang for this sweet neon lettering.
- This beatiful font for neon lettering is mage by Bastien Sozoo