From 5d1edbc6fc5f4f82438d24cb64837ea7267e7455 Mon Sep 17 00:00:00 2001 From: Raphael Maenle Date: Thu, 28 May 2020 00:05:53 +0200 Subject: [PATCH] fixes account deletion without google user --- server/routes.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/server/routes.py b/server/routes.py index 0060ab3..97030bd 100644 --- a/server/routes.py +++ b/server/routes.py @@ -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()