mirror of
https://github.com/TakeusV1/flask_ipam.git
synced 2026-10-13 17:15:33 +02:00
Update setup.py
This commit is contained in:
1 parent
c819bf68e2
commit
eaa6499bd0
1 file changed
+4
-3
@@ -10,9 +10,10 @@ db = SQLAlchemy(app)
|
|||||||
|
|
||||||
class User(db.Model):
|
class User(db.Model):
|
||||||
id = db.Column(db.Integer(),primary_key=True,unique=True)
|
id = db.Column(db.Integer(),primary_key=True,unique=True)
|
||||||
username = db.Column(db.String(16))
|
username = db.Column(db.String(16),unique=True)
|
||||||
password = db.Column(db.String(32),unique=True)
|
password = db.Column(db.String(32))
|
||||||
is_admin = db.Column(db.Boolean(),default=False)
|
is_admin = db.Column(db.Boolean(),default=False)
|
||||||
|
is_reado = db.Column(db.Boolean(),default=False)
|
||||||
dat_last = db.Column(db.DateTime())
|
dat_last = db.Column(db.DateTime())
|
||||||
|
|
||||||
with app.app_context():
|
with app.app_context():
|
||||||
@@ -21,7 +22,7 @@ with app.app_context():
|
|||||||
@app.route('/',methods=['GET','POST'])
|
@app.route('/',methods=['GET','POST'])
|
||||||
def setup():
|
def setup():
|
||||||
if request.method == "POST":
|
if request.method == "POST":
|
||||||
db.session.add(User(username=request.form["username"],password=generate_password_hash(request.form["password"]),is_admin=True))
|
db.session.add(User(username=request.form["username"],password=generate_password_hash(request.form["password"]),is_admin=True,is_reado=False))
|
||||||
db.session.commit()
|
db.session.commit()
|
||||||
return 'Done, you can delete setup.py'
|
return 'Done, you can delete setup.py'
|
||||||
return "<h1>admin user creation</h1><br><form method='post'><input name='username' placeholder='username'><br><input type='password' name='password' placeholder='password'><br><button type='submit'>submit</button></form>"
|
return "<h1>admin user creation</h1><br><form method='post'><input name='username' placeholder='username'><br><input type='password' name='password' placeholder='password'><br><button type='submit'>submit</button></form>"
|
||||||
|
|||||||
Reference in new issue
Block a user