Skip to content
Snippets Groups Projects
Commit 49d66a1d authored by aebopp's avatar aebopp
Browse files

delete profile

parent 6681c6a4
No related branches found
No related tags found
No related merge requests found
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="/css/style.css">
<title>ServicePoints</title>
</head>
<body>
<h1>
<a href="/">/ </a>
|
<a href="/u/{{username}}/">{{username}}</a>
</h1>
<p>{{username}}</p>
<p>
{{username}}
</p>
<form action="/accounts/delete/" method="post" enctype="multipart/form-data">
<input type="submit" name="delete" value="confirm delete account"/>
</form>
</body>
</html>
......@@ -4,5 +4,6 @@
<link rel="stylesheet" type="text/css" href="/css/style.css">
<title>ServicePoints</title>
<a href="/accounts/logout/">logout</a>
<a href="/accounts/delete/">delete</a>
</head>
</html>
No preview for this file type
......@@ -105,3 +105,17 @@ def hash_pass(password_in):
password_hash = hash_obj.hexdigest()
password_db_string = "$".join([algorithm, salt, password_hash])
return password_db_string
@servicePoints.app.route('/accounts/delete/', methods=['GET', 'POST'])
def delete():
"""Render delete page."""
if flask.request.method == 'POST':
name = (flask.session['username'])
to_add = (name,)
cur = servicePoints.model.get_db()
flask.session.clear()
cur.execute('DELETE FROM users WHERE username=?', to_add)
return flask.redirect(flask.url_for('create'))
context = {'username': flask.session['username']}
return render_template('delete.html', **context)
\ No newline at end of file
No preview for this file type
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment