Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion augur/api/view/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,10 +198,11 @@
@app.route('/account/delete')
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not from this PR, but user_delete is on a GET route. Might be worth a follow-up to change this to POST.

@login_required
def user_delete():
if current_user.delete()[0]:
if current_user.delete(db_session)[0]:
flash(f"Account {current_user.login_name} successfully removed")
logout_user()
else:
logger.error(f"Exception occurred while deleting account {current_user.login_name}: {e}")

Check warning on line 205 in augur/api/view/routes.py

View workflow job for this annotation

GitHub Actions / runner / pylint

[pylint] reported by reviewdog 🐶 E0602: Undefined variable 'e' (undefined-variable) Raw Output: augur/api/view/routes.py:205:93: E0602: Undefined variable 'e' (undefined-variable)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's no try/except (e will be undefined). Either wrap the delete in a try/except or just drop the logger line.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

current_user.login_name might not be valid after delete() since it commits the row deletion internally. Capture the username before calling delete.

flash("An error occurred removing the account")

return redirect(url_for("root"))
Expand Down
Loading