Skip to content

Commit e14768a

Browse files
fix: remove useless finally (#3132)
remove usless finally Was provoking an warning
1 parent 89cd80f commit e14768a

File tree

1 file changed

+13
-14
lines changed

1 file changed

+13
-14
lines changed

backend/iam/sso/saml/views.py

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -204,20 +204,19 @@ def dispatch(self, request, organization_slug):
204204
except Exception as e:
205205
error = AuthError.FAILED_SSO
206206
logger.error("SSO failed", exc_info=e)
207-
finally:
208-
next_url = login.state["next"]
209-
if error:
210-
next_url = httpkit.add_query_params(
211-
next_url,
212-
{"error": error, "error_process": login.state["process"]},
213-
)
214-
elif user:
215-
email_object = EmailAddress.objects.filter(user=user).first()
216-
if email_object and not email_object.verified:
217-
email_object.verified = True
218-
email_object.save()
219-
logger.info("Email verified", user=user)
220-
return HttpResponseRedirect(next_url)
207+
next_url = login.state["next"]
208+
if error:
209+
next_url = httpkit.add_query_params(
210+
next_url,
211+
{"error": error, "error_process": login.state["process"]},
212+
)
213+
elif user:
214+
email_object = EmailAddress.objects.filter(user=user).first()
215+
if email_object and not email_object.verified:
216+
email_object.verified = True
217+
email_object.save()
218+
logger.info("Email verified", user=user)
219+
return HttpResponseRedirect(next_url)
221220

222221

223222
class GenerateSAMLKeyView(SAMLViewMixin, APIView):

0 commit comments

Comments
 (0)