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')) return redirect(url_for('account'))
form = RegistrationForm() form = RegistrationForm()
if form.validate_on_submit(): if form.validate_on_submit():
user = User(id=form.username.data, user = User(userid=form.username.data,
username=form.username.data, username=form.username.data,
email=form.email.data) email=form.email.data)
user.setPassword(form.password.data) user.setPassword(form.password.data)
@ -106,6 +106,7 @@ def deleteAccount():
if not current_user.is_authenticated: if not current_user.is_authenticated:
return redirect(url_for('account')) return redirect(url_for('account'))
# TODO fix google delete account # TODO fix google delete account
if current_user.google_token != None:
google.deleteAccount(current_user) google.deleteAccount(current_user)
''' '''
for cal in current_user.calendars: for cal in current_user.calendars:
@ -122,7 +123,7 @@ def deleteAccount():
@app.route("/login/google") @app.route("/login/google")
def googlelogin(): 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')) return redirect(url_for('account'))
authorization_url = google.login() authorization_url = google.login()