.
This commit is contained in:
@@ -1,4 +1,7 @@
|
||||
from flask_login import UserMixin
|
||||
from flask_table import Col, Table
|
||||
|
||||
# from sqlalchemy.ext.declarative.api import instrument_declarative
|
||||
from werkzeug.security import check_password_hash, generate_password_hash
|
||||
|
||||
from app import db, login
|
||||
@@ -23,3 +26,18 @@ class User(UserMixin, db.Model):
|
||||
@login.user_loader
|
||||
def load_user(id):
|
||||
return User.query.get(int(id))
|
||||
|
||||
|
||||
class Networks(Table):
|
||||
ssid = Col("SSID")
|
||||
signal = Col("Signal Strength")
|
||||
inuse = Col("Connected")
|
||||
security = Col("Security")
|
||||
|
||||
|
||||
class Network(object):
|
||||
def __init__(self, ssid, signal, inuse, security):
|
||||
self.ssid = ssid
|
||||
self.signal = signal
|
||||
self.inuse = inuse
|
||||
self.security = security
|
||||
|
||||
@@ -3,15 +3,22 @@ from flask_login import current_user, login_required, login_user, logout_user
|
||||
|
||||
from app import app
|
||||
from app.forms import LoginForm
|
||||
from app.models import User
|
||||
from app.models import User, Network, Networks
|
||||
|
||||
|
||||
@app.route("/")
|
||||
@app.route("/index")
|
||||
@login_required
|
||||
def index():
|
||||
user = {"username": "Miguel"}
|
||||
return render_template("index.html", title="Home", user=user)
|
||||
def search_results():
|
||||
results = []
|
||||
scan = ["rpi:100: :WPA2", "Home:94:*:WPA2", "HOME2:48: :WPA2", "BT:23: :"]
|
||||
for item in scan:
|
||||
erm = Network(item.split(":")[0], item.split(":")[1], item.split(":")[2], item.split(":")[3])
|
||||
results.append(erm)
|
||||
|
||||
table = Networks(results)
|
||||
table.border = True
|
||||
return render_template("index.html", table=table)
|
||||
|
||||
|
||||
@app.route("/login", methods=["GET", "POST"])
|
||||
|
||||
@@ -1,16 +1,4 @@
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<title>Travel Router</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<h1>Hi, {{ user.username }}!</h1>
|
||||
{% for post in posts %}
|
||||
<div>
|
||||
<p>{{ post.author.username }} says: <b>{{ post.body }}</b></p>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</body>
|
||||
|
||||
</html>
|
||||
<doctype html="">
|
||||
<title>Networks</title>
|
||||
{{ table }}
|
||||
</doctype>
|
||||
Reference in New Issue
Block a user