Compare commits
No commits in common. "f6ca5b2f7a1ef0f3c1c3ee1d77ee5b203226ac3e" and "210c71ef9d3e06e2a904d66260c775516e33e5d5" have entirely different histories.
f6ca5b2f7a
...
210c71ef9d
38
app.py
38
app.py
@ -1,24 +1,7 @@
|
||||
import glob
|
||||
import json
|
||||
from flask import Flask, redirect, url_for, render_template, request
|
||||
|
||||
app=Flask(__name__)
|
||||
|
||||
WORKING_DIR = "/home/gashapwn/lyadmin/";
|
||||
ACCOUNT_DIR = "test/";
|
||||
|
||||
FULL_PATH = str(WORKING_DIR) + str(ACCOUNT_DIR)
|
||||
|
||||
CONF_PATH = str(WORKING_DIR) + "lyadmin.conf.json"
|
||||
|
||||
# Account requests are given ID numbers
|
||||
# the first request will have the below
|
||||
# id number
|
||||
INIT_REQ_ID = "00000"
|
||||
|
||||
with open(CONF_PATH) as c: conf_json_str = c.read()
|
||||
conf_obj = json.loads(conf_json_str)
|
||||
|
||||
@app.route("/")
|
||||
def home():
|
||||
app.route('/')
|
||||
@ -65,7 +48,7 @@ def req():
|
||||
"username": Widg("username", "input", None),
|
||||
"email for account lockout / registration confirmation (optional)": Widg("email", "input", None),
|
||||
"SSH public key": Widg("pub_key", "textarea", None),
|
||||
"shell of choice": Widg("shell", "choice", map(lambda k : (k, conf_obj["shell"][k]), list(conf_obj["shell"].keys()))),
|
||||
"shell of choice": Widg("shell", "choice", [("bash", "/bin/bash"), ("ksh", "/bin/ksh")]),
|
||||
"have you read the rules?": Widg("rule_read", "check", None)
|
||||
};
|
||||
|
||||
@ -87,25 +70,6 @@ def signup():
|
||||
|
||||
if(len(email) > 1):
|
||||
is_email_user = True
|
||||
else:
|
||||
email = "NO_EMAIL"
|
||||
|
||||
if(len(glob.glob("./test/[0-9]*ident*")) == 0):
|
||||
new_id = int(INIT_REQ_ID)
|
||||
new_id_str = INIT_REQ_ID
|
||||
else:
|
||||
max_id = max(list(map( lambda path : path.split("/")[-1].split(".")[0] , glob.glob("./test/[0-9]*ident*"))))
|
||||
zpad = len(max_id)
|
||||
new_id = int(max_id)+1
|
||||
new_id_str = str(new_id).zfill(zpad)
|
||||
|
||||
fn1 = str(FULL_PATH) + str(new_id_str) + ".ident"
|
||||
|
||||
with open(fn1, "w") as ident_file:
|
||||
ident_file.write(str(username) + "\n")
|
||||
ident_file.write(str(email) + "\n")
|
||||
ident_file.write(str(shell) + "\n")
|
||||
ident_file.write(str(rule_read) + "\n")
|
||||
|
||||
print(username + " " + email + " " + shell + " " + rule_read)
|
||||
return render_template("signup.html", is_email_user = is_email_user)
|
||||
|
@ -1,7 +0,0 @@
|
||||
{
|
||||
"instance_name": "lingy.in",
|
||||
"shell": {
|
||||
"SHELL_BASH": "/usr/local/bin/bash",
|
||||
"SHELL_KSH": "/bin/ksh"
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user