added OpenGraph data, started enable button

This commit is contained in:
b3yond 2018-03-16 09:51:10 +01:00
parent 2ce2a45f7b
commit 79f301d823
5 changed files with 30 additions and 5 deletions

View file

@ -108,7 +108,7 @@ def confirmaccount(encoded_jwt):
print(uname, pass_hashed) print(uname, pass_hashed)
# create db entry # create db entry
db.cur.execute("INSERT INTO user(email, pass_hashed, enabled) VALUES(?, ?, ?);", (uname, pass_hashed, True)) db.cur.execute("INSERT INTO user(email, pass_hashed, enabled) VALUES(?, ?, ?);", (uname, pass_hashed, 1))
db.conn.commit() db.conn.commit()
bottle.response.set_cookie("account", uname, secret) bottle.response.set_cookie("account", uname, secret)
return bottle.redirect("/settings") return bottle.redirect("/settings")
@ -126,6 +126,13 @@ def manage_bot():
else: else:
bottle.abort(401, "Sorry, access denied.") bottle.abort(401, "Sorry, access denied.")
@app.route('/enable')
def enable():
email = bottle.request.get_cookie("account", secret=secret)
db.cur.execute("MODIFY user.enabled = 1 WHERE email=?;", (email)) # :todo is this correct SQL?
db.conn.commit()
return bottle.static_file("../static/bot.html", root='../static')
@app.route('/static/<filename:path>') @app.route('/static/<filename:path>')
def static(filename): def static(filename):

View file

@ -1,12 +1,20 @@
<head> <head>
<title>Ticketfrei</title> <title>Ticketfrei</title>
<link rel='stylesheet' href='/static/css/style.css'> <link rel='stylesheet' href='/static/css/style.css'>
<meta name='og:title' content='Settings - Ticketfrei'/>
<meta name='og:description' content='A bot against control society! Nobody should have to pay for public transport. Find out where ticket controllers are!'/>
<meta name='og:image' content="https://ticketfrei.links-tech.org/static/img/ticketfrei-og-image.png"/>
<meta name='og:image:alt' content='Ticketfrei'/>
<meta name='og:type' content='website' />
</head> </head>
<body> <body>
<div class="area"> <div class="area">
<h1><a href="/"><img src="/static/img/ticketfrei_logo.png" alt="Ticketfrei" height="150px" align="center" style="float: none;"></a></h1> <h1><a href="/"><img src="/static/img/ticketfrei_logo.png" alt="Ticketfrei" height="150px" align="center" style="float: none;"></a></h1>
# Is the user logged in? else, complain & show nothing. <form action="/enable" method="POST">
<button type="submit">Enable</button>
</form>
<div class=footer> <div class=footer>
Contribute on <a href="https://github.com/b3yond/ticketfrei">GitHub!</a> Contribute on <a href="https://github.com/b3yond/ticketfrei">GitHub!</a>

View file

Before

Width:  |  Height:  |  Size: 2.1 MiB

After

Width:  |  Height:  |  Size: 2.1 MiB

View file

@ -1,13 +1,18 @@
<head> <head>
<title>Ticketfrei</title> <title>Ticketfrei</title>
<link rel='stylesheet' href='/static/css/style.css'> <link rel='stylesheet' href='/static/css/style.css'>
<meta name='og:title' content='Ticketfrei'/>
<meta name='og:description' content='A bot against control society! Nobody should have to pay for public transport. Find out where ticket controllers are!'/>
<meta name='og:image' content="https://ticketfrei.links-tech.org/static/img/ticketfrei-og-image.png"/>
<meta name='og:image:alt' content='Ticketfrei'/>
<meta name='og:type' content='website' />
</head> </head>
<body> <body>
<div class="area"> <div class="area">
<h1><a href="/"><img src="/static/img/ticketfrei_logo.png" alt="Ticketfrei" height="150px" align="center" style="float: none;"></a></h1> <h1><a href="/"><img src="/static/img/ticketfrei_logo.png" alt="Ticketfrei" height="150px" align="center" style="float: none;"></a></h1>
<form action="../login" method="POST"> <form action="/login" method="POST">
<div class="container"> <div class="container">
<label><b>Username</b></label> <label><b>Username</b></label>
<input type="text" placeholder="Enter Username" name="uname" required> <input type="text" placeholder="Enter Username" name="uname" required>

View file

@ -1,6 +1,11 @@
<head> <head>
<title>Ticketfrei</title> <title>Ticketfrei</title>
<link rel='stylesheet' href='css/style.css'> <link rel='stylesheet' href='css/style.css'>
<meta name='og:title' content='Register - Ticketfrei'/>
<meta name='og:description' content='A bot against control society! Nobody should have to pay for public transport. Run it in your city!'/>
<meta name='og:image' content="https://ticketfrei.links-tech.org/static/img/ticketfrei-og-image.png"/>
<meta name='og:image:alt' content='Ticketfrei'/>
<meta name='og:type' content='website' />
</head> </head>
<body> <body>
<div class="area"> <div class="area">