- OAuth Authentication
- Email Verification
- Syntax Highlighting
- Search Pastes
- Paste Commenting and Rating
- Public and Private Paste Creation
- Welcoming Message on User Signup
git clone git@github.com:hatredholder/Pastebin-Clone.git
cd Pastebin-Clone
# Flask Settings
FLASK_SECRET_KEY="your_secret_key_here"
FLASK_EMAIL_VERIFICATION_ENABLED=false
FLASK_SOCIAL_AUTHENTICATION_ENABLED=false
# Mongo Settings
FLASK_MONGODB_SETTINGS={"db": "pastebinCloneDb", "host": "db", "port": 27017}
To Enable Email Verification
-
Set
FLASK_EMAIL_VERIFICATION_ENABLED
to trueFLASK_EMAIL_VERIFICATION_ENABLED=true
-
Set these enviroment variables to your email credentials
FLASK_MAIL_SERVER="smtp.gmail.com" FLASK_MAIL_USERNAME="example@gmail.com" FLASK_MAIL_PASSWORD="example_password" FLASK_MAIL_PORT=587 FLASK_MAIL_USE_TLS=true FLASK_MAIL_USE_SSL=false
NOTE: In order for GMail to work as your email server you need to setup two-factor authorization (2FA)
To Enable OAuth Authentication
-
Set
FLASK_EMAIL_VERIFICATION_ENABLED
to trueFLASK_SOCIAL_AUTHENTICATION_ENABLED=true
-
Create a new project in Google Cloud
- Go to https://console.cloud.google.com/
- Register a service with Google > create a new project
- Within the new project, go to APIs + Services > Create credentials > Configure Consent Screen > External Users > name the project again > enter user support email > leave defaults
- Go back to dashboard > Credentials > Create Creds > OAuth Client ID > web app > define your redirect url of your web app (http://localhost/login/callback)
- Create the call back > download your creds as a json file
- Put the
client_secret.json
file to your source directory (next to app.py)
├── authentication/
├── pybin/
├── requirements/
├── static/
├── templates/
├── tests/
├── .env
├── .gitignore
├── Dockerfile
├── README.md
├── app.py
├── client_secret.json
├── docker-compose.yml
└── setup.cfg
docker-compose up -d
pip install -r requirements/local.txt
pytest -k "not email_configured and not oauth_configured" --cov
pytest -k "not email_configured and not oauth_configured" --cov-report html:cov_html --cov
ruff --check .