44 lines
1.5 KiB
HTML
44 lines
1.5 KiB
HTML
{{ define "index.html" }}
|
|
|
|
{{ block "title" . }}Passwort-Generator{{ end }}
|
|
|
|
{{ block "head" . }}
|
|
<script>
|
|
function copyToClipboard() {
|
|
const password = document.getElementById("password").innerText;
|
|
navigator.clipboard.writeText(password).then(() => {
|
|
const toast = document.getElementById("toast");
|
|
toast.style.visibility = "visible";
|
|
setTimeout(() => { toast.style.visibility = "hidden"; }, 1500);
|
|
}).catch(err => {
|
|
console.error("Fehler beim Kopieren: ", err);
|
|
alert("Kopieren fehlgeschlagen. Bitte manuell kopieren: " + password);
|
|
});
|
|
}
|
|
|
|
function generateNewPassword() {
|
|
fetch("/api/password")
|
|
.then(response => response.text())
|
|
.then(password => {
|
|
document.getElementById("password").innerText = password;
|
|
})
|
|
.catch(error => console.error("Fehler:", error));
|
|
}
|
|
</script>
|
|
{{ end }}
|
|
|
|
{{ block "body" . }}
|
|
<div class="container">
|
|
<a href="/help" class="help-link">?</a>
|
|
<a href="https://gitea.scu.si/Florian.Walther/Web-Password" class="code-link">Sourcecode</a>
|
|
<h1>Generiertes Passwort</h1>
|
|
<div id="password">{{ .Password }}</div>
|
|
<div class="buttons">
|
|
<button class="copy-button" onclick="copyToClipboard()">In Zwischenablage kopieren</button>
|
|
<button class="renew-button" onclick="generateNewPassword()">Neues Passwort generieren</button>
|
|
</div>
|
|
<div id="toast">✓ Kopiert!</div>
|
|
</div>
|
|
{{ end }}
|
|
{{ end }}
|