Skip to content

Commit

Permalink
Ensure user logged in before POSTing
Browse files Browse the repository at this point in the history
  • Loading branch information
jimchamp authored and Sabreen-Parveen committed Feb 5, 2021
1 parent ec872bc commit 7eab0c7
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions openlibrary/plugins/openlibrary/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -382,9 +382,11 @@ class observations(delegate.page):

def POST(self):
user = accounts.get_current_user()
account = OpenLibraryAccount.get_by_email(user.email)
s3_keys = web.ctx.site.store.get(account._key).get('s3_keys')

response = post_observation(web.data(), s3_keys)
if user:
account = OpenLibraryAccount.get_by_email(user.email)
s3_keys = web.ctx.site.store.get(account._key).get('s3_keys')

return delegate.RawText(response)
if s3_keys:
response = post_observation(web.data(), s3_keys)
return delegate.RawText(response)

0 comments on commit 7eab0c7

Please sign in to comment.