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():
|
||||
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
|
||||
|
@ -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():
|
||||
|
Loading…
Reference in New Issue
Block a user