fixes account deletion without google user

This commit is contained in:
Raphael Maenle 2020-05-28 00:05:53 +02:00
parent 722db5feae
commit 5d1edbc6fc

View File

@ -91,7 +91,7 @@ def register():
return redirect(url_for('account'))
form = RegistrationForm()
if form.validate_on_submit():
user = User(id=form.username.data,
user = User(userid=form.username.data,
username=form.username.data,
email=form.email.data)
user.setPassword(form.password.data)
@ -106,7 +106,8 @@ def deleteAccount():
if not current_user.is_authenticated:
return redirect(url_for('account'))
# TODO fix google delete account
google.deleteAccount(current_user)
if current_user.google_token != None:
google.deleteAccount(current_user)
'''
for cal in current_user.calendars:
db.session.delete(cal)
@ -122,7 +123,7 @@ def deleteAccount():
@app.route("/login/google")
def googlelogin():
if current_user.is_authenticated and current_user.google_credentials.refresh_token != None:
if current_user.is_authenticated and current_user.google_token.refresh_token != None:
return redirect(url_for('account'))
authorization_url = google.login()