added templates, more solid DarkMode
All checks were successful
/ push_to_registry (push) Successful in 1m13s
All checks were successful
/ push_to_registry (push) Successful in 1m13s
This commit is contained in:
43
templates/index.html
Normal file
43
templates/index.html
Normal file
@@ -0,0 +1,43 @@
|
||||
{{ 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 }}
|
||||
Reference in New Issue
Block a user