Compare commits

...

2 Commits

Author SHA1 Message Date
gashapwn
d60e2ac726 footer only on homepage now 2020-11-26 22:15:40 +00:00
gashapwn
f682147507 signup handling added 2020-11-26 22:06:39 +00:00
4 changed files with 44 additions and 5 deletions

19
app.py
View File

@ -8,8 +8,8 @@ def home():
u_list = []; u_list = [];
with open("user_list.txt") as u_file: with open("user_list.txt") as u_file:
for line in u_file: for line in u_file.readlines():
u_list.append(line); u_list.append(line.strip());
return render_template("index.html", u_list=u_list, page_name="home") return render_template("index.html", u_list=u_list, page_name="home")
@ -37,6 +37,7 @@ def widg_fun(widg):
return widg.w_type; return widg.w_type;
def req(): def req():
app.route('/req')
class Widg: class Widg:
def __init__(self, w_name, w_type, w_opt): def __init__(self, w_name, w_type, w_opt):
self.w_name = w_name self.w_name = w_name
@ -55,13 +56,23 @@ def req():
return render_template("req.html", req_tab = rt, widg_fun = widg_fun, page_name="req") return render_template("req.html", req_tab = rt, widg_fun = widg_fun, page_name="req")
def signup(): def signup():
app.route('/req/signup')
username = request.form["username"] username = request.form["username"]
email = request.form["email"] email = request.form["email"]
shell = request.form["shell"] shell = request.form["shell"]
rule_read = request.form["rule_read"] rule_read = request.form["rule_read"]
is_email_user = False;
if(rule_read != "on"): if(rule_read != "on"):
print("some fail condition") return redirect(url_for('req'))
if(len(email) > 1):
is_email_user = True
print(username + " " + email + " " + shell + " " + rule_read)
return render_template("signup.html", is_email_user = is_email_user)
def login(): def login():
@ -77,5 +88,5 @@ if __name__=="__main__":
app.add_url_rule('/success/<name>', 'success', success) app.add_url_rule('/success/<name>', 'success', success)
app.add_url_rule('/login', 'login', login, methods = ['POST', 'GET']) app.add_url_rule('/login', 'login', login, methods = ['POST', 'GET'])
app.add_url_rule('/req', 'req', req, methods = ['POST', 'GET']) app.add_url_rule('/req', 'req', req, methods = ['POST', 'GET'])
app.add_url_rule('/req/signup', 'req', req, methods = ['POST']) app.add_url_rule('/req/signup', 'signup', signup, methods = ['POST'])
app.run(host="104.248.118.130",debug=True) app.run(host="104.248.118.130",debug=True)

View File

@ -1,7 +1,11 @@
<!DOCTYPE html> <!DOCTYPE html>
<head> <head>
<title>LAINTILDE0</title> <title>LAINTILDE0</title>
{% if page_name %}
<link rel="stylesheet" href="{{url_for('static',filename='main_' + page_name + '.css')}}"> <link rel="stylesheet" href="{{url_for('static',filename='main_' + page_name + '.css')}}">
{% else %}
<link rel="stylesheet" href="{{url_for('static',filename='main.css')}}">
{% endif %}
</head> </head>
<h1>lingy.in</h1> <h1>lingy.in</h1>
<body> <body>
@ -11,5 +15,8 @@
</div> </div>
</body> </body>
{% if page_name == "home" %}
<div style="min-height: 300px;"></div>
<footer>admin: <a href="email:gashapwn@protonmail.com">gashapwn@protonmail.com</a></footer> <footer>admin: <a href="email:gashapwn@protonmail.com">gashapwn@protonmail.com</a></footer>
{% endif %}
</html> </html>

View File

@ -1,4 +1,4 @@
{%extends "layout.html"%} {%extends "main_layout.html"%}
{%block content%} {%block content%}
<p> <p>

21
templates/signup.html Normal file
View File

@ -0,0 +1,21 @@
{%extends "layout.html"%}
{%block content%}
<h3>submission successful</h3>
<p>
once your request is approved your account will be created
{% if is_email_user %}
and you will receive a confirmation email
</p>
{% else %}
you did not provide an emailn
to see if your account is ready, check the users list on the home page
this page will be updated with your username once approved
</p>
{% endif %}
<p>
if you have questions, email gashapwn@protonmail.com
or DM gashapwn on IRC at irc.lainchan.org
<p>
{%endblock%}