Skip to content

Commit 155ad23

Browse files
authored
Merge pull request #10 from datopian/fix/redirecting-download-issue
Fix (bug): Download url should work even when account is pending
2 parents cfac464 + ae1d4b9 commit 155ad23

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

ckanext/oauth2/plugin.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -171,10 +171,17 @@ def _allowed_endpoint(endpoint):
171171
response.status_code = 302
172172
return response
173173
elif account_state == "pending":
174-
response.headers["Location"] = toolkit.url_for(
175-
"oauth2.account_pending"
176-
)
177-
response.status_code = 302
174+
if toolkit.request.blueprint == "approval_dataset.download_resource":
175+
return response
176+
else:
177+
toolkit.h.flash_notice(
178+
toolkit._("Your account is pending approval.")
179+
)
180+
181+
response.headers["Location"] = toolkit.url_for(
182+
"oauth2.account_pending"
183+
)
184+
response.status_code = 302
178185
return response
179186
return response
180187

0 commit comments

Comments
 (0)