web/elements: fix copy on insecure origins (#4917)
* web/elements: fix copy on insecure origins Signed-off-by: Jens Langhammer <jens@goauthentik.io> * fallback to messages for other clipboard uses Signed-off-by: Jens Langhammer <jens@goauthentik.io> --------- Signed-off-by: Jens Langhammer <jens@goauthentik.io>
This commit is contained in:
		@ -2,6 +2,7 @@ import "@goauthentik/admin/providers/RelatedApplicationButton";
 | 
			
		||||
import "@goauthentik/admin/providers/saml/SAMLProviderForm";
 | 
			
		||||
import { DEFAULT_CONFIG } from "@goauthentik/common/api/config";
 | 
			
		||||
import { EVENT_REFRESH } from "@goauthentik/common/constants";
 | 
			
		||||
import { MessageLevel } from "@goauthentik/common/messages";
 | 
			
		||||
import { AKElement } from "@goauthentik/elements/Base";
 | 
			
		||||
import "@goauthentik/elements/CodeMirror";
 | 
			
		||||
import "@goauthentik/elements/Tabs";
 | 
			
		||||
@ -9,6 +10,7 @@ import "@goauthentik/elements/buttons/ActionButton";
 | 
			
		||||
import "@goauthentik/elements/buttons/ModalButton";
 | 
			
		||||
import "@goauthentik/elements/buttons/SpinnerButton";
 | 
			
		||||
import "@goauthentik/elements/events/ObjectChangelog";
 | 
			
		||||
import { showMessage } from "@goauthentik/elements/messages/MessageContainer";
 | 
			
		||||
 | 
			
		||||
import { t } from "@lingui/macro";
 | 
			
		||||
 | 
			
		||||
@ -101,6 +103,14 @@ export class SAMLProviderViewPage extends AKElement {
 | 
			
		||||
                        <ak-action-button
 | 
			
		||||
                            class="pf-m-secondary"
 | 
			
		||||
                            .apiRequest=${() => {
 | 
			
		||||
                                if (!navigator.clipboard) {
 | 
			
		||||
                                    return Promise.resolve(
 | 
			
		||||
                                        showMessage({
 | 
			
		||||
                                            level: MessageLevel.info,
 | 
			
		||||
                                            message: this.provider?.urlDownloadMetadata || "",
 | 
			
		||||
                                        }),
 | 
			
		||||
                                    );
 | 
			
		||||
                                }
 | 
			
		||||
                                return navigator.clipboard.writeText(
 | 
			
		||||
                                    this.provider?.urlDownloadMetadata || "",
 | 
			
		||||
                                );
 | 
			
		||||
@ -371,6 +381,15 @@ export class SAMLProviderViewPage extends AKElement {
 | 
			
		||||
                                  <ak-action-button
 | 
			
		||||
                                      class="pf-m-secondary"
 | 
			
		||||
                                      .apiRequest=${() => {
 | 
			
		||||
                                          if (!navigator.clipboard) {
 | 
			
		||||
                                              return Promise.resolve(
 | 
			
		||||
                                                  showMessage({
 | 
			
		||||
                                                      level: MessageLevel.info,
 | 
			
		||||
                                                      message:
 | 
			
		||||
                                                          this.provider?.urlDownloadMetadata || "",
 | 
			
		||||
                                                  }),
 | 
			
		||||
                                              );
 | 
			
		||||
                                          }
 | 
			
		||||
                                          return navigator.clipboard.writeText(
 | 
			
		||||
                                              this.provider?.urlDownloadMetadata || "",
 | 
			
		||||
                                          );
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user