From 88ba61b61fc060f6cf4f3d4b70875980201750e9 Mon Sep 17 00:00:00 2001 From: ErmannoOliveri <58082615+ErmannoOliveri@users.noreply.github.com> Date: Mon, 21 Feb 2022 18:27:21 +0100 Subject: [PATCH 1/3] Update index.html --- index.html | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/index.html b/index.html index d3064a1..7eac60b 100644 --- a/index.html +++ b/index.html @@ -62,7 +62,11 @@

How To Use:

+ +
show @@ -77,4 +81,6 @@

How To Use:

+ + From 4e328ae23db79b673dcd6d482a19c49765360627 Mon Sep 17 00:00:00 2001 From: ErmannoOliveri <58082615+ErmannoOliveri@users.noreply.github.com> Date: Mon, 21 Feb 2022 18:27:51 +0100 Subject: [PATCH 2/3] Update main.css --- main.css | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/main.css b/main.css index 0437c67..0fa8e4e 100644 --- a/main.css +++ b/main.css @@ -224,3 +224,11 @@ input[type="number"] { width: 100%; } } + +.button.download { + background-color: powderblue; + color: black; +} +.button.download:hover { + background-color: #b6e4eb; +} From 01b8d99b342f4d5b6521fa739e948c0a5e5a5fa7 Mon Sep 17 00:00:00 2001 From: ErmannoOliveri <58082615+ErmannoOliveri@users.noreply.github.com> Date: Mon, 21 Feb 2022 18:32:56 +0100 Subject: [PATCH 3/3] Update index.js --- index.js | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/index.js b/index.js index 3646305..272395c 100644 --- a/index.js +++ b/index.js @@ -208,3 +208,26 @@ passwordToggle.onclick = function() { //function strengthenPassword() { // var value = passwordTest.value.trim(); //} + + +// use of jsPDF to generate a .pdf file with the +// generated password +function downloadPassword() { + window.jsPDF = window.jspdf.jsPDF; + var generatedPass = document.getElementById("random-password").innerHTML; + var pdfGenerator = new jsPDF(); + + if (generatedPass === "" || generatedPass === undefined) { + alert("Please Generate a Password!"); + } else { + try { + pdfGenerator.setFontSize(12); + pdfGenerator.text("The generated password is:", 20, 20); + pdfGenerator.setFont("undefined", "bold"); + pdfGenerator.text(generatedPass, 20, 30); + pdfGenerator.save("password.pdf"); + } catch (err) { + alert("AN ERROR OCCURRED!"); + } + } +}