Browse Source

Remove passwords from db

mistress
Daniel Muckerman 3 years ago
parent
commit
0e0b268adf
3 changed files with 3 additions and 9 deletions
  1. +1
    -3
      accounts/auth/models.py
  2. +1
    -5
      accounts/auth/views.py
  3. +1
    -1
      accounts/templates/fragments/navbar.j2

+ 1
- 3
accounts/auth/models.py View File

@ -19,12 +19,10 @@ class User(db.Model):
id = db.Column(db.Integer, primary_key=True) id = db.Column(db.Integer, primary_key=True)
username = db.Column(db.String(100)) username = db.Column(db.String(100))
password = db.Column(db.String(128))
authenticated = db.Column(db.Boolean, default=False) authenticated = db.Column(db.Boolean, default=False)
def __init__(self, username, password):
def __init__(self, username):
self.username = username self.username = username
self.password = password
@staticmethod @staticmethod
def try_login(username, password): def try_login(username, password):

+ 1
- 5
accounts/auth/views.py View File

@ -120,14 +120,10 @@ def login():
return redirect(url_for('auth.home')) return redirect(url_for('auth.home'))
form = LoginForm(request.form) form = LoginForm(request.form)
print(form)
print(request.method)
if request.method == 'POST' and form.validate(): if request.method == 'POST' and form.validate():
username = request.form.get('username') username = request.form.get('username')
password = request.form.get('password') password = request.form.get('password')
print(username)
print(password)
try: try:
User.try_login(username, password) User.try_login(username, password)
@ -141,7 +137,7 @@ def login():
print(user) print(user)
if user is None: if user is None:
user = User(username, password)
user = User(username)
db.session.add(user) db.session.add(user)
user.authenticated = True user.authenticated = True
db.session.commit() db.session.commit()

+ 1
- 1
accounts/templates/fragments/navbar.j2 View File

@ -1,5 +1,5 @@
<nav class="navbar navbar-expand-lg sticky-top navbar-dark bg-dark"> <nav class="navbar navbar-expand-lg sticky-top navbar-dark bg-dark">
<div class="navbar-brand">My Account</div>
<div class="navbar-brand d-none d-md-block">My Account</div>
<form class="form-inline ml-auto"> <form class="form-inline ml-auto">
<a onclick="showApps();" style="cursor: pointer;"> <a onclick="showApps();" style="cursor: pointer;">
<svg <svg

Loading…
Cancel
Save