update copy process, removed binary
This commit is contained in:
72
main.go
72
main.go
@@ -9,7 +9,8 @@ import (
|
||||
|
||||
const (
|
||||
passwordLength = 32
|
||||
chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!?§$%&=#+<>-:,.;_*@"
|
||||
chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"
|
||||
//chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!?$%&=#+<>-:,.;_*@"
|
||||
)
|
||||
|
||||
func generatePassword() string {
|
||||
@@ -153,7 +154,21 @@ func webHandler(w http.ResponseWriter, r *http.Request) {
|
||||
width: 90%%;
|
||||
word-break: break-all;
|
||||
}
|
||||
button {
|
||||
.copy-button {
|
||||
background: #4CAF50;
|
||||
color: white;
|
||||
border: none;
|
||||
padding: 0.6rem 1.2rem;
|
||||
font-size: 1rem;
|
||||
border-radius: 4px;
|
||||
cursor: pointer;
|
||||
transition: background 0.2s;
|
||||
margin: 0.3rem;
|
||||
}
|
||||
.copy-button:hover {
|
||||
background: #45a049;
|
||||
}
|
||||
.renew-button {
|
||||
background: #007BFF;
|
||||
color: white;
|
||||
border: none;
|
||||
@@ -164,7 +179,7 @@ func webHandler(w http.ResponseWriter, r *http.Request) {
|
||||
transition: background 0.2s;
|
||||
margin: 0.3rem;
|
||||
}
|
||||
button:hover {
|
||||
.renew-button:hover {
|
||||
background: #0056b3;
|
||||
}
|
||||
.help-link {
|
||||
@@ -183,11 +198,47 @@ func webHandler(w http.ResponseWriter, r *http.Request) {
|
||||
justify-content: center;
|
||||
gap: 0.5rem;
|
||||
}
|
||||
#toast {
|
||||
visibility: hidden;
|
||||
min-width: 150px;
|
||||
background-color: #4CAF50;
|
||||
color: white;
|
||||
text-align: center;
|
||||
border-radius: 4px;
|
||||
padding: 0.5rem;
|
||||
position: fixed;
|
||||
top: 20px;
|
||||
right: 20px;
|
||||
z-index: 1;
|
||||
font-size: 0.9rem;
|
||||
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<a href="/help" class="help-link">?</a>
|
||||
<h1>Generiertes Passwort</h1>
|
||||
<div id="password">%s</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>
|
||||
<script>
|
||||
function copyToClipboard() {
|
||||
navigator.clipboard.writeText(document.getElementById("password").innerText);
|
||||
alert("Passwort kopiert!");
|
||||
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); // Toast verschwindet nach 1,5 Sekunden
|
||||
}).catch(err => {
|
||||
console.error("Fehler beim Kopieren: ", err);
|
||||
alert("Kopieren fehlgeschlagen. Bitte manuell kopieren: " + password);
|
||||
});
|
||||
}
|
||||
function generateNewPassword() {
|
||||
fetch("/api/password")
|
||||
@@ -198,17 +249,6 @@ func webHandler(w http.ResponseWriter, r *http.Request) {
|
||||
.catch(error => console.error("Fehler:", error));
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<a href="/help" class="help-link">?</a>
|
||||
<h1>Generiertes Passwort</h1>
|
||||
<div id="password">%s</div>
|
||||
<div class="buttons">
|
||||
<button onclick="copyToClipboard()">In Zwischenablage kopieren</button>
|
||||
<button onclick="generateNewPassword()">Neues Passwort generieren</button>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>`,
|
||||
password,
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user