Skip to content

Sample flask application with login system and database

Notifications You must be signed in to change notification settings

CosmoSt4r/sample-flask-app

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Sample Flask application

Implemented systems of login, logout, registration and one interesting feature.

What can I do with this?

Login and Signup forms


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.


Homepage


What is personal pattern?

Click on it and find out!


How to install?

Clone

Clone this repo to your local machine using https://github.com/CosmoSt4r/sample-flask-app

Required packages

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

Starting the server

python main.py

or just open main.py

Opening app in browser

Open your browser and go to the 127.0.0.1:5000 address. You will see the login page.


Why do we need this packages?

SQLAlchemy

  • The SQLAlchemy package is used to store information about users with an SQLite database connected to it.

Pypasswords

  • 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

  • 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.

Sample patterns

  • Then it is simply mirrored along the axes and a symmetrical 10 x 10 pixels pattern is obtained.

Pattern mirroring

  • 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)

Where did I get such beautiful HTML and CSS templates?

About

Sample flask application with login system and database

Topics

Resources

Stars

Watchers

Forks