begin auth stuff
This commit is contained in:
4
app.py
4
app.py
@@ -6,6 +6,7 @@ from flask_sqlalchemy import SQLAlchemy
|
|||||||
basedir = os.path.abspath(os.path.dirname(__file__))
|
basedir = os.path.abspath(os.path.dirname(__file__))
|
||||||
|
|
||||||
app = Flask(__name__)
|
app = Flask(__name__)
|
||||||
|
app.config['SECRET_KEY'] = 'HwG55rpe83jcaglifXm8NuF4WEeXyJV4'
|
||||||
app.config['SQLALCHEMY_DATABASE_URI'] =\
|
app.config['SQLALCHEMY_DATABASE_URI'] =\
|
||||||
'sqlite:///' + os.path.join(basedir, 'database.db')
|
'sqlite:///' + os.path.join(basedir, 'database.db')
|
||||||
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False
|
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False
|
||||||
@@ -13,6 +14,9 @@ app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False
|
|||||||
|
|
||||||
db = SQLAlchemy(app)
|
db = SQLAlchemy(app)
|
||||||
|
|
||||||
|
from auth import auth as auth_blueprint
|
||||||
|
app.register_blueprint(auth_blueprint)
|
||||||
|
|
||||||
class Period(db.Model):
|
class Period(db.Model):
|
||||||
period = db.Column(db.Integer, primary_key=True)
|
period = db.Column(db.Integer, primary_key=True)
|
||||||
periodTime = db.Column(db.Integer)
|
periodTime = db.Column(db.Integer)
|
||||||
|
12
auth.py
Normal file
12
auth.py
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
from flask import Blueprint, render_template
|
||||||
|
from app import db
|
||||||
|
|
||||||
|
auth = Blueprint('auth', __name__)
|
||||||
|
|
||||||
|
@auth.route('/login')
|
||||||
|
def login():
|
||||||
|
return render_template('login.html')
|
||||||
|
|
||||||
|
@auth.route('/logout')
|
||||||
|
def logout():
|
||||||
|
return 'Logout'
|
29
templates/login.html
Normal file
29
templates/login.html
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
{% extends "base.html" %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
<div>
|
||||||
|
<h3>Login</h3>
|
||||||
|
<div>
|
||||||
|
<form method="POST" action="/login">
|
||||||
|
<div>
|
||||||
|
<div>
|
||||||
|
<input type="email" name="email" placeholder="Your Email" autofocus="">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<div>
|
||||||
|
<input type="password" name="password" placeholder="Your Password">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<label>
|
||||||
|
<input type="checkbox" name="remember">
|
||||||
|
Remember me
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
<button>Login</button>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
Reference in New Issue
Block a user