Merge lara.matcom.uh.cu:programs/dpto2
Conflicts: main.py
This commit is contained in:
commit
ba036d26b7
1 changed files with 4 additions and 2 deletions
6
main.py
6
main.py
|
@ -37,7 +37,7 @@ def delete_user(deluser):
|
||||||
f.write(line)
|
f.write(line)
|
||||||
f.close()
|
f.close()
|
||||||
reload_freeradius()
|
reload_freeradius()
|
||||||
|
|
||||||
def create_user(username, password):
|
def create_user(username, password):
|
||||||
nthash = hashlib.new('md4',password.encode('utf-16le')).hexdigest().upper()
|
nthash = hashlib.new('md4',password.encode('utf-16le')).hexdigest().upper()
|
||||||
f = open(users_file,"a")
|
f = open(users_file,"a")
|
||||||
|
@ -61,6 +61,8 @@ def index():
|
||||||
|
|
||||||
@app.route("/login",methods=['GET','POST'])
|
@app.route("/login",methods=['GET','POST'])
|
||||||
def login():
|
def login():
|
||||||
|
if session.get('logged_in',False):
|
||||||
|
return redirect(url_for('admin'))
|
||||||
if request.method == 'GET':
|
if request.method == 'GET':
|
||||||
return render_template("login.html")
|
return render_template("login.html")
|
||||||
if request.method == 'POST':
|
if request.method == 'POST':
|
||||||
|
@ -91,7 +93,7 @@ def admin():
|
||||||
return render_template("admin.html", delete_error=True, errormsg="Cannot delete guest user")
|
return render_template("admin.html", delete_error=True, errormsg="Cannot delete guest user")
|
||||||
delete_user(deluser)
|
delete_user(deluser)
|
||||||
flash("User deleted succesfully")
|
flash("User deleted succesfully")
|
||||||
|
|
||||||
username = request.form.get('username',None)
|
username = request.form.get('username',None)
|
||||||
pass1 = request.form.get('password1',None)
|
pass1 = request.form.get('password1',None)
|
||||||
pass2 = request.form.get('password2',None)
|
pass2 = request.form.get('password2',None)
|
||||||
|
|
Loading…
Reference in a new issue