Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from flask import Flask, make_response, request, render_template, url_for
- from flask_bootstrap import Bootstrap
- import requests
- from requests.auth import HTTPBasicAuth
- app = Flask(__name__)
- bootstrap = Bootstrap(app)
- @app.route('/', methods=["GET", "POST"])
- def login():
- if request.method == 'GET':
- return render_template('log.html')
- elif request.method == 'POST':
- username = request.form['username']
- password = request.form['password']
- r = requests.get('MY COMPANY WEBSITE', auth=HTTPBasicAuth(username, password))
- if r.status_code == '200':
- return redirect(url_for('index'))
- elif r.status_code != '200':
- print(r)
- return render_template('login_fail.html', username=username,password=password)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement