OWL ITS + 탐지시스템(인터넷 진흥원)
wyu
2021-12-28 939ae7c3a7f8baf61039a77d5a60d10e90daf065
src/main/webapp/scripts/app/api/apiAuth.controller.js
@@ -75,15 +75,37 @@
                    });
                }
                // navigator.clipboard 는 브라우저 보안이나 활성화 여부에 따라 사용이 안될때가 있음
                function copyToClipboard(textToCopy) {
                    // navigator clipboard api needs a secure context (https)
                    if (navigator.clipboard && window.isSecureContext) {
                        // navigator clipboard api method'
                        return navigator.clipboard.writeText(textToCopy);
                    } else {
                        // text area method
                        let textArea = document.createElement("textarea");
                        textArea.value = textToCopy;
                        // make the textarea out of viewport
                        textArea.style.position = "fixed";
                        textArea.style.left = "-999999px";
                        textArea.style.top = "-999999px";
                        document.body.appendChild(textArea);
                        textArea.focus();
                        textArea.select();
                        return new Promise((res, rej) => {
                            // here the magic happens
                            document.execCommand('copy') ? res() : rej();
                            textArea.remove();
                        });
                    }
                }
                function copyToken() {
                    var copyText = document.getElementById("apiApplicationForm2");
                    copyText.select();
                    copyText.setSelectionRange(0, 99999);
                    navigator.clipboard.writeText(copyText.value);
                    SweetAlert.swal($filter("translate")("api.successToApiTokenCopy")); // "api 토큰 생성 성공"
                    copyToClipboard($scope.vm.form.token)
                        .then(() =>
                            SweetAlert.swal($filter("translate")("api.successToApiTokenCopy"))
                        )
                        .catch(() => SweetAlert.error($filter("translate")("api.failedToApiTokenCopy")))
                }
                function find() {