From 98a78f2102d4db001f35f4d3628b570200a2f92f Mon Sep 17 00:00:00 2001 From: Raphael Maenle Date: Fri, 22 May 2020 10:47:28 +0200 Subject: [PATCH] adds delete account function --- app.db | Bin 53248 -> 53248 bytes app.db.old | Bin 45056 -> 0 bytes server/googleHandler.py | 7 +++++++ server/routes.py | 18 ++++++++++++------ 4 files changed, 19 insertions(+), 6 deletions(-) delete mode 100644 app.db.old diff --git a/app.db b/app.db index f95e63b7d69c3f6f8e129b17bf93a371df302ba5..a7d11d087b66c7e6c1e14af78dd82a60e900bbef 100644 GIT binary patch delta 1152 zcmZ{jJ8#=o6vsuetzpLw-2idnWT@c=C{jccMM@&+x@~Amq9}>fgL+t67>c4uQI`*k z4?Td?){-Gp4Sj)Z&Cnr%iXuaX0v+n5D6(|v2Pn`XQ-Ka$N_R*fa1ZbY?mf8YkAwR= z=j;i5_5}Xo_WILEB(fE1^Zd@o(9`D+zD`81zgq2}zh8@P{CLfya%g7(k7oVe(aJ+CSLapUD^%mr;69$cQ{6PTX9oOn_vYO#9|D z!g8}t>7?juy{em?TZVH~i_J{`G;4$0IIH$Dg&B&wndTr}7*;xR#V7GXU=rzypreJR zPqd2xhmj2+m1KJV-roLL9gJ01m)`WBOe9cTB07{6@ID7zM(c2Nou*lu7llbaR;IXd zS};<;M!Wo^*(zvse^^Qy2CqyN*Q=uQ4yXvdT+ZzAM_xVUb3#XGv3Q+|=@RI>W(TEk zM@+4jpPSI>qleM(GpU8UB|YYnD2ZY?mQLdYg_0N%DowFA=uzGlip5Lawd_dLfvNF;!sifgv50o8Zav0_`EYI&Cr60w=@HT;UGB{O`2eiH}W zKQ45F=DWVHm<=u! za&SDXH`Ok4(pR!GQ@zcW+tf)mzyXdAdMY+;bHezjcwB1M?2xeqT|<6}M3GelSs_2H z-rfEZS;nm0_u*ZbfUX1{4HtO#oW8laf&3a4zK9?{A}_+iuaL$LoP@@4Q&ugY{!Jgg z1yj(~gK_D#6Y4*)fxHf#FCxg#$VKS<68Y!`d>5+AjxMWUkN?XbzD)gl_%7XUgq^(& Rg@>&b^z5DO)%LU3$e$0sWm^CM delta 3140 zcmcImO>Y`U7~X}pE_LFKBiU`53nJ+uQi%5hvd|=L)_fR(!3JX+e8KBw*j=$7cz3}D z%iVD8$!KqtBIVFSkB#VmXn#R^s4DePHBt_V6jkcAvzw$|+c*w2AgwerJTuR$=Y8gV z=iy`T!^hr(tG)vSK`z=~@A@6|;K}AsbDj%N`?L5zlb$Ko!tVb3u`n?~cfD6;tUNty zz5I%qENV?~EpeNU(NzEbz3V9YTd(_T|L)hn;2)u$M~LT9ultt|y9^IS5Nxu?eCnBc z)$1;LroMmDy@yVHw~0>DH;8Wd;t%4tX^V}_SW3HP-P!-b+zTkI3<6*J11k~$jlfNR zK-3vYinDFFSYss}z$H$VRLurmtJQFv<7}92u$mEP4Nw%F1NH({IDw$OKpU_&n#4&Q z0%cV(1UL=Dan(7NB=+Ihfcs1bFQ`o$?|?<6>6~Iubik=f)&6JS-k=+5*spEwX zX5_H$EZh3{V-l?kC|xr`ZGAEq&wK-8MQ+{rFFsn`~J=Hh>IvUv1ZX(4~$V(IRbTMeZaP%Ua8v&lT73QhX|%fYD5Lh7jvkn%nPh9#Cg}4iF_&4@1%qy4) diff --git a/app.db.old b/app.db.old deleted file mode 100644 index 73e7dab60da2de8730771244718c0e3190da799a..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 45056 zcmeI5Uu+x6dB90grbJ5IwNF)bSOM zn5gC$^IFZ5)x=N;ItTGM4uKbCTQ5ld(4vWYBJcHi@CYi1yPhiTY$1FNgMNJW-! z$foy1mQLNM~Q=SX$m=PDf-mH~MG>*3WLFlG(SXl?(*^ zc%)JWLClR_+S#2;xW2E(+t27G^*xB4jMN-9>=SxP$n4Q-Vk~?0YWzD!*mnkc2A`vS zeZ4+32qpcfSE@l1C4Gr>l|c+_>=P006es#wSd`;V*zYpF-N4QNI1%Y7Ses%+g!c!UIKCv*G%$Bc4Rn&1@Zg6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{g?Eg(THB9 zIXX-Ip899%@2H$w4Bd{6B*$aPaq8a&4FEoY01yBIK;YFUK)1)kasMxr_=Gsi9py7W;(l=H z%uB_V?C3Hwne}j`=CdAugVl1TF7#KJlUTU*&cVE9%{q z&Zhcczf)U#aA@tQd;7UUbHjJLrTf9+uC}{ZsXU%(;T?`l*4}b>0l#I;($l zi}~i`8M2EIi5C8%K!k=@GR-CV5C>{x`8e5Xi|ijnBJ~%!lW3kVyZ#bhm`4`xVcFvu zvPv&JI7Bju&9gj<`Jv(AP2HNP*@lW#+ zP7e{!5$$x@)e3g2ZaRKN)HbV?l_hPtQshfAztnK6tL8zjxumQZ zE#A|2)^=C!RErPS_G(VMTtb!g%}1N~n#8R)%k0jBYAtAUU2Su-iL8f?^FEuu$KJm$ zmb^#rmBp4+tF9mD`vr6P-p+bgoHHJ{Tn;b$uIcOSwwybx9+3KRk%k{_q1Of$Sb=Hc z;PA8-xCSw5a22)jmV!FpzmUp~(R(UEFC|V>H}PXre7vz9Nh64&SQNRUDCUZDo*s0K zoYBcEMy{bEzt9m3TgK0LY1@jIGxd4dalErH(4>rg#rUe_BA+N<32OVh?N#sn)oOk1 z;1E?d_8+OM+Jmsc)ollPIMz3h%YATgaJtaMk_GZzz_2uXKHLV9Bpz7$g(>=bYn~^~ z@uNFjB&)V%9+E`3j1~sv>c{93TJ$fB+Bx0zd!=00AHX1b_e#00KbZ zWg#$?xEVj?*)TGl;8M>zZT9Z}e;1>FNB{fFQhF!{5C8%|00;m9AOHk_01yBIKmZ5; U0U+?@2|RHFxRRJnom|HGzYs!?OaK4? diff --git a/server/googleHandler.py b/server/googleHandler.py index 888acd6..aca646e 100644 --- a/server/googleHandler.py +++ b/server/googleHandler.py @@ -93,6 +93,13 @@ def verifyResponse(): def get_google_provider_cfg(): return requests.get(GOOGLE_DISCOVERY_URL).json() +def deleteAccount(user): + result = requests.post('https://oauth2.googleapis.com/revoke', + params={'token': user.get('token')}, + headers = {'content-type': 'applixation/x-www-form-urlencoded'}) + print(result, flush=True) + return + class Calendar: def __init__(self, name, calendarId, toggle='False', color="#000000"): self.name = name diff --git a/server/routes.py b/server/routes.py index 10e6750..c94f8ec 100644 --- a/server/routes.py +++ b/server/routes.py @@ -100,13 +100,19 @@ def register(): return redirect(url_for('emaillogin')) return flask.render_template('register.html', title='Register', form=form) -@app.route("/test") -def testAPI(): - if current_user.is_authenticated: - google.updateCalendars() - return redirect('/account') - +@app.route("/delete_account") +def deleteAccount(): + if not current_user.is_authenticated: + return redirect(url_for('account')) + print(current_user.getGoogleCredentials(), flush=True) + google.deleteAccount(current_user.getGoogleCredentials()) + + user = db.session.query(User).filter(User.id==current_user.id).first() + logout_user() + db.session.delete(user) + db.session.commit() + return redirect(url_for('account')) @app.route("/login/google") def googlelogin():