From 49d66a1dbf30032df32b3fc9a209ef09968b168a Mon Sep 17 00:00:00 2001
From: Allie Bopp <aebopp@umich.edu>
Date: Tue, 16 Jun 2020 02:12:42 -0400
Subject: [PATCH] delete profile

---
 servicePoints/templates/delete.html           |  22 ++++++++++++++++++
 servicePoints/templates/index.html            |   1 +
 .../views/__pycache__/accounts.cpython-36.pyc | Bin 2907 -> 3320 bytes
 servicePoints/views/accounts.py               |  14 +++++++++++
 var/servicePoints.sqlite3                     | Bin 12288 -> 12288 bytes
 5 files changed, 37 insertions(+)
 create mode 100644 servicePoints/templates/delete.html

diff --git a/servicePoints/templates/delete.html b/servicePoints/templates/delete.html
new file mode 100644
index 0000000..9a5db10
--- /dev/null
+++ b/servicePoints/templates/delete.html
@@ -0,0 +1,22 @@
+<!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>
diff --git a/servicePoints/templates/index.html b/servicePoints/templates/index.html
index bf50a78..47ab30e 100644
--- a/servicePoints/templates/index.html
+++ b/servicePoints/templates/index.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>
diff --git a/servicePoints/views/__pycache__/accounts.cpython-36.pyc b/servicePoints/views/__pycache__/accounts.cpython-36.pyc
index 5fba22d061eb399d26ed5f24624065c794a7dfca..394d327d3d65b11945112c8fd0612b5e23813cc9 100644
GIT binary patch
delta 511
zcmYk2J4*vW5XX1+E|=sk(L7AdqX~-2HHi-lKF|a-UBIAL3W8+M$C<>iIT1pR6lbY|
z+-I;AB$bu;B`jhi+V~N~${mB^!u)o2c4q&7_9gzA9G?pY)!W^Vz2gWW@8sW-MP3xq
zdcGNd7&APk-_%%)d6;rYnfHpaI2*kn4(x;(Y!N+i|8^-srFSa7O3-&Jz9!_|C*L_N
z^cMX#blc(Fezkgf*05SRX4DMJ$W?#UP)ZW9hH^~6A|{xW!3pJMkxPswiA_4>0Bo>i
z(_<<Qu_@k|UWWkbP}9ex4mcEW)-OV3vICBA#(w&i@rh%wB}-#UN4iGK-gb1;XfT6k
z28J@t{X-+m(G6Dw+GFdba%sEd-qBQdrNHx|_N5Javqx6FrUPFUH9f$CI1@&QZzOyO
z5k-t3VhA0PKnx>72r8h<d<OGb#5`gGG5Lonk@csQfo@$KTBt#!0H~mVN>vCz2!?<c
iL{*RQwAlEP`>1Y&&@uNSrV#}<sZB!4Eoy1%)4l<GT4fRd

delta 116
zcmew%d0R}`n3tDpqxAE*009Pu#|%h-1;};);^JKsm3OkGFa|Sdif;VZ!^~K)xtrwy
zGh@``9F77;)5&)^${Ec!hjP|3a%u_|Ndt8hSxye+@#i)LG1)<c!Q?GGYK#(-Z}Uh4
E06nl9eE<Le

diff --git a/servicePoints/views/accounts.py b/servicePoints/views/accounts.py
index b3960bc..6bfa5b9 100644
--- a/servicePoints/views/accounts.py
+++ b/servicePoints/views/accounts.py
@@ -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
diff --git a/var/servicePoints.sqlite3 b/var/servicePoints.sqlite3
index 8c0b335ad8cf3043d2bba7171a82254b229827b0..9e8299e1f860840844facfaaf6e31a9c86477411 100644
GIT binary patch
delta 51
zcmV-30L=e@V1Qtd8vzNC976#Kv0$_h0u9Wuak&iv%8_x#vz8uy0Rj)ivmqd(4+H=J
J01K17FGI$45X=Ao

delta 39
ucmZojXh@hK&B#7c#+i|QW5O2x&58<5e4D4q)iDBDv-u}Bh)zDDZvz1T!woP1

-- 
GitLab