|
|
@ -8,6 +8,7 @@ import uuid
|
|
|
|
import string
|
|
|
|
import string
|
|
|
|
import random
|
|
|
|
import random
|
|
|
|
import ipaddress
|
|
|
|
import ipaddress
|
|
|
|
|
|
|
|
import hashlib
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app = flask.Flask(__name__)
|
|
|
|
app = flask.Flask(__name__)
|
|
|
@ -77,6 +78,8 @@ def build_app(path):
|
|
|
|
data = flask.request.form.copy()
|
|
|
|
data = flask.request.form.copy()
|
|
|
|
data['uid'] = str(uuid.uuid4())
|
|
|
|
data['uid'] = str(uuid.uuid4())
|
|
|
|
data['dns'] = str(ipaddress.IPv4Network(data['subnet'])[-2])
|
|
|
|
data['dns'] = str(ipaddress.IPv4Network(data['subnet'])[-2])
|
|
|
|
|
|
|
|
md5_password = hashlib.md5(data['db_pw'].encode())
|
|
|
|
|
|
|
|
data['db_pw'] = md5_password.hexdigest()
|
|
|
|
db.set(data['uid'], json.dumps(data))
|
|
|
|
db.set(data['uid'], json.dumps(data))
|
|
|
|
return flask.redirect(flask.url_for('.setup', uid=data['uid']))
|
|
|
|
return flask.redirect(flask.url_for('.setup', uid=data['uid']))
|
|
|
|
|
|
|
|
|
|
|
|