Browse Source

Remove passwords from db

mistress
Daniel Muckerman 4 years ago
parent
commit
e5a6075baf
1 changed files with 2 additions and 9 deletions
  1. +2
    -9
      app.py

+ 2
- 9
app.py View File

@ -99,12 +99,10 @@ class User(db.Model):
id = db.Column(db.Integer, primary_key=True)
username = db.Column(db.String(100))
password = db.Column(db.String(128))
authenticated = db.Column(db.Boolean, default=False)
def __init__(self, username, password):
def __init__(self, username):
self.username = username
self.password = password
@staticmethod
def try_login(username, password):
@ -199,14 +197,10 @@ def login():
return redirect(url_for('index'))
form = LoginForm(request.form)
print(form)
print(request.method)
if request.method == 'POST' and form.validate():
username = request.form.get('username')
password = request.form.get('password')
print(username)
print(password)
try:
User.try_login(username, password)
@ -218,9 +212,8 @@ def login():
user = User.query.filter(User.username == username).first()
print(user)
if user is None:
user = User(username, password)
user = User(username)
db.session.add(user)
user.authenticated = True
db.session.commit()

Loading…
Cancel
Save