providers/saml: show error message why import failed

This commit is contained in:
Jens Langhammer 2020-12-30 22:02:28 +01:00
parent 1b9d22615c
commit e69834dec4
1 changed files with 7 additions and 2 deletions

View File

@ -272,6 +272,11 @@ class MetadataImportView(LoginRequiredMixin, FormView):
provider = metadata.to_provider(form.cleaned_data["provider_name"])
provider.save()
messages.success(self.request, _("Successfully created Provider"))
except ValueError:
messages.error(self.request, _("Failed to import Metadata."))
except ValueError as exc:
LOGGER.warning(exc)
messages.error(
self.request,
_("Failed to import Metadata: %(message)s", {"message": str(exc)}),
)
return super().form_invalid(form)
return super().form_valid(form)