adds delete account function
This commit is contained in:
parent
cf9c4f0e85
commit
98a78f2102
BIN
app.db.old
BIN
app.db.old
Binary file not shown.
@ -93,6 +93,13 @@ def verifyResponse():
|
|||||||
def get_google_provider_cfg():
|
def get_google_provider_cfg():
|
||||||
return requests.get(GOOGLE_DISCOVERY_URL).json()
|
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:
|
class Calendar:
|
||||||
def __init__(self, name, calendarId, toggle='False', color="#000000"):
|
def __init__(self, name, calendarId, toggle='False', color="#000000"):
|
||||||
self.name = name
|
self.name = name
|
||||||
|
@ -100,13 +100,19 @@ def register():
|
|||||||
return redirect(url_for('emaillogin'))
|
return redirect(url_for('emaillogin'))
|
||||||
return flask.render_template('register.html', title='Register', form=form)
|
return flask.render_template('register.html', title='Register', form=form)
|
||||||
|
|
||||||
@app.route("/test")
|
@app.route("/delete_account")
|
||||||
def testAPI():
|
def deleteAccount():
|
||||||
if current_user.is_authenticated:
|
if not current_user.is_authenticated:
|
||||||
google.updateCalendars()
|
return redirect(url_for('account'))
|
||||||
return redirect('/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")
|
@app.route("/login/google")
|
||||||
def googlelogin():
|
def googlelogin():
|
||||||
|
Loading…
Reference in New Issue
Block a user