providers/oauth2: ensure flow is cleaned up on error

This commit is contained in:
Jens Langhammer 2020-09-14 18:40:44 +02:00
parent 5184c4b7ef
commit e21ed92848

View file

@ -220,9 +220,11 @@ class OAuthFulfillmentStage(StageView):
)
return redirect(self.create_response_uri())
except (ClientIdError, RedirectUriError) as error:
self.executor.stage_invalid()
# pylint: disable=no-member
return bad_request_message(request, error.description, title=error.error)
except AuthorizeError as error:
self.executor.stage_invalid()
uri = error.create_uri(self.params.redirect_uri, self.params.state)
return redirect(uri)