weitere arbeiten an der UI
This commit is contained in:
@@ -11,10 +11,18 @@ spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQLDialect
|
||||
spring.jpa.properties.hibernate.type.preferred_uuid_jdbc_type=VARCHAR
|
||||
|
||||
# Mail
|
||||
spring.mail.host=${MAIL_HOST:localhost}
|
||||
spring.mail.port=${MAIL_PORT:25}
|
||||
spring.mail.username=${MAIL_USER:}
|
||||
spring.mail.password=${MAIL_PASSWORD:}
|
||||
#spring.mail.host=${MAIL_HOST:localhost}
|
||||
#spring.mail.port=${MAIL_PORT:25}
|
||||
#spring.mail.username=${MAIL_USER:}
|
||||
#spring.mail.password=${MAIL_PASSWORD:}
|
||||
#spring.mail.properties.mail.smtp.auth=false
|
||||
#spring.mail.properties.mail.smtp.starttls.enable=false
|
||||
|
||||
# Mailpit
|
||||
spring.mail.host=localhost
|
||||
spring.mail.port=1025
|
||||
spring.mail.username=
|
||||
spring.mail.password=
|
||||
spring.mail.properties.mail.smtp.auth=false
|
||||
spring.mail.properties.mail.smtp.starttls.enable=false
|
||||
|
||||
@@ -25,3 +33,4 @@ jwt.keystore.alias=xxx
|
||||
|
||||
# Server
|
||||
server.port=8080
|
||||
server.servlet.context-path=/
|
||||
|
||||
92
xxxthegame/src/main/resources/static/activate.html
Normal file
92
xxxthegame/src/main/resources/static/activate.html
Normal file
@@ -0,0 +1,92 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="de">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>XXX The Game – Aktivierung</title>
|
||||
<link rel="stylesheet" href="/css/style.css">
|
||||
</head>
|
||||
<body>
|
||||
<div class="card">
|
||||
<h1>XXX The Game</h1>
|
||||
<p class="subtitle">E-Mail-Adresse bestätigen</p>
|
||||
|
||||
<p style="font-size:0.9rem; color:#aaa; margin-top:0.5rem; line-height:1.5;">
|
||||
Du hast eine E-Mail mit einem Aktivierungslink erhalten.<br>
|
||||
Falls der Link nicht funktioniert, gib hier deinen Aktivierungscode ein.
|
||||
</p>
|
||||
|
||||
<label for="uuid" style="margin-top:1.5rem;">Aktivierungscode</label>
|
||||
<input type="text" id="uuid" placeholder="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" autocomplete="off" />
|
||||
|
||||
<button class="full-width" id="activateBtn" onclick="activate()">Jetzt aktivieren</button>
|
||||
|
||||
<div class="message" id="message"></div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
const params = new URLSearchParams(window.location.search);
|
||||
const email = params.get('email');
|
||||
if (email) {
|
||||
showMessage(`Eine Bestätigungs-E-Mail wurde an ${email} gesendet.`, 'success');
|
||||
}
|
||||
});
|
||||
|
||||
document.addEventListener('keydown', e => {
|
||||
if (e.key === 'Enter') activate();
|
||||
});
|
||||
|
||||
async function activate() {
|
||||
const uuid = document.getElementById('uuid').value.trim();
|
||||
const btn = document.getElementById('activateBtn');
|
||||
|
||||
if (!uuid) {
|
||||
showMessage('Bitte den Aktivierungscode eingeben.', 'error');
|
||||
return;
|
||||
}
|
||||
|
||||
btn.disabled = true;
|
||||
btn.textContent = 'Wird aktiviert…';
|
||||
hideMessage();
|
||||
|
||||
try {
|
||||
const response = await fetch(`/activation/${encodeURIComponent(uuid)}`, {
|
||||
method: 'GET',
|
||||
redirect: 'follow'
|
||||
});
|
||||
|
||||
if (response.redirected) {
|
||||
window.location.href = response.url;
|
||||
} else if (response.ok) {
|
||||
window.location.href = '/login.html';
|
||||
} else if (response.status === 204) {
|
||||
showMessage('Code ungültig oder bereits verwendet.', 'error');
|
||||
btn.disabled = false;
|
||||
btn.textContent = 'Jetzt aktivieren';
|
||||
} else {
|
||||
showMessage(`Fehler: HTTP ${response.status}`, 'error');
|
||||
btn.disabled = false;
|
||||
btn.textContent = 'Jetzt aktivieren';
|
||||
}
|
||||
} catch (err) {
|
||||
showMessage('Server nicht erreichbar.', 'error');
|
||||
btn.disabled = false;
|
||||
btn.textContent = 'Jetzt aktivieren';
|
||||
console.error(err);
|
||||
}
|
||||
}
|
||||
|
||||
function showMessage(text, type) {
|
||||
const el = document.getElementById('message');
|
||||
el.textContent = text;
|
||||
el.className = `message ${type}`;
|
||||
el.style.display = 'block';
|
||||
}
|
||||
|
||||
function hideMessage() {
|
||||
document.getElementById('message').style.display = 'none';
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
163
xxxthegame/src/main/resources/static/css/style.css
Normal file
163
xxxthegame/src/main/resources/static/css/style.css
Normal file
@@ -0,0 +1,163 @@
|
||||
/* ── Reset ── */
|
||||
* {
|
||||
box-sizing: border-box;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
/* ── Base ── */
|
||||
body {
|
||||
min-height: 100vh;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
background: #1a1a2e;
|
||||
font-family: 'Segoe UI', sans-serif;
|
||||
color: #eee;
|
||||
gap: 2rem;
|
||||
}
|
||||
|
||||
h1 {
|
||||
color: #e94560;
|
||||
}
|
||||
|
||||
p {
|
||||
color: #888;
|
||||
font-size: 1rem;
|
||||
}
|
||||
|
||||
/* ── Card ── */
|
||||
.card {
|
||||
background: #16213e;
|
||||
border: 1px solid #0f3460;
|
||||
border-radius: 12px;
|
||||
padding: 2.5rem;
|
||||
width: 100%;
|
||||
max-width: 380px;
|
||||
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
|
||||
gap: 0;
|
||||
}
|
||||
|
||||
.card h1 {
|
||||
text-align: center;
|
||||
font-size: 1.6rem;
|
||||
margin-bottom: 0.25rem;
|
||||
}
|
||||
|
||||
.subtitle {
|
||||
text-align: center;
|
||||
font-size: 0.85rem;
|
||||
color: #888;
|
||||
margin-bottom: 2rem;
|
||||
}
|
||||
|
||||
/* ── Form elements ── */
|
||||
label {
|
||||
display: block;
|
||||
font-size: 0.8rem;
|
||||
color: #aaa;
|
||||
margin-bottom: 0.3rem;
|
||||
margin-top: 1rem;
|
||||
}
|
||||
|
||||
input {
|
||||
width: 100%;
|
||||
padding: 0.65rem 0.9rem;
|
||||
border: 1px solid #0f3460;
|
||||
border-radius: 6px;
|
||||
background: #0f3460;
|
||||
color: #eee;
|
||||
font-size: 1rem;
|
||||
outline: none;
|
||||
transition: border-color 0.2s;
|
||||
}
|
||||
|
||||
input:focus {
|
||||
border-color: #e94560;
|
||||
}
|
||||
|
||||
/* ── Buttons ── */
|
||||
button, .btn {
|
||||
display: inline-block;
|
||||
padding: 0.75rem 2.5rem;
|
||||
background: #e94560;
|
||||
color: #fff;
|
||||
border: none;
|
||||
border-radius: 6px;
|
||||
font-size: 1rem;
|
||||
font-weight: 600;
|
||||
cursor: pointer;
|
||||
text-decoration: none;
|
||||
transition: background 0.2s;
|
||||
}
|
||||
|
||||
button:hover:not(:disabled), .btn:hover {
|
||||
background: #c73652;
|
||||
}
|
||||
|
||||
button:disabled {
|
||||
opacity: 0.6;
|
||||
cursor: not-allowed;
|
||||
}
|
||||
|
||||
button.full-width {
|
||||
width: 100%;
|
||||
margin-top: 1.75rem;
|
||||
padding: 0.75rem;
|
||||
}
|
||||
|
||||
button.secondary {
|
||||
background: #0f3460;
|
||||
font-weight: normal;
|
||||
padding: 0.3rem 0.7rem;
|
||||
font-size: 0.75rem;
|
||||
width: auto;
|
||||
margin-top: 0.5rem;
|
||||
}
|
||||
|
||||
button.secondary:hover {
|
||||
background: #1a4a8a;
|
||||
}
|
||||
|
||||
/* ── Messages ── */
|
||||
.message {
|
||||
margin-top: 1.25rem;
|
||||
padding: 0.65rem 0.9rem;
|
||||
border-radius: 6px;
|
||||
font-size: 0.85rem;
|
||||
display: none;
|
||||
word-break: break-all;
|
||||
}
|
||||
|
||||
.message.error {
|
||||
background: #3d0f1a;
|
||||
border: 1px solid #e94560;
|
||||
color: #e94560;
|
||||
}
|
||||
|
||||
.message.success {
|
||||
background: #0f3d1a;
|
||||
border: 1px solid #2ecc71;
|
||||
color: #2ecc71;
|
||||
}
|
||||
|
||||
/* ── Token box ── */
|
||||
.token-box {
|
||||
margin-top: 1.25rem;
|
||||
padding: 0.65rem 0.9rem;
|
||||
background: #0f1e3d;
|
||||
border: 1px solid #0f3460;
|
||||
border-radius: 6px;
|
||||
font-size: 0.75rem;
|
||||
color: #aaa;
|
||||
word-break: break-all;
|
||||
display: none;
|
||||
}
|
||||
|
||||
.token-box span {
|
||||
display: block;
|
||||
font-size: 0.7rem;
|
||||
color: #666;
|
||||
margin-bottom: 0.4rem;
|
||||
}
|
||||
48
xxxthegame/src/main/resources/static/index.html
Normal file
48
xxxthegame/src/main/resources/static/index.html
Normal file
@@ -0,0 +1,48 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="de">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>XXX The Game</title>
|
||||
<link rel="stylesheet" href="/css/style.css">
|
||||
</head>
|
||||
<body>
|
||||
<h1>XXX The Game</h1>
|
||||
<p>Das Erwachsenenspiel für Paare und Gruppen</p>
|
||||
<div style="display:flex; gap:1rem;">
|
||||
<a class="btn" href="/login.html">Anmelden</a>
|
||||
<a class="btn" href="/registration.html" style="background:#0f3460;">Registrieren</a>
|
||||
</div>
|
||||
|
||||
<div id="fillerMsg" class="message" style="max-width:320px;"></div>
|
||||
|
||||
<button onclick="fillDb()" style="background:none; border:1px solid #333; color:#555; font-size:0.75rem; padding:0.3rem 0.8rem; border-radius:4px; margin-top:-1rem;">
|
||||
DB befüllen
|
||||
</button>
|
||||
|
||||
<script>
|
||||
async function fillDb() {
|
||||
const btn = event.currentTarget;
|
||||
btn.disabled = true;
|
||||
btn.textContent = 'Wird befüllt…';
|
||||
try {
|
||||
const response = await fetch('/filler', { method: 'POST' });
|
||||
const msg = document.getElementById('fillerMsg');
|
||||
if (response.ok) {
|
||||
msg.textContent = 'Datenbank erfolgreich befüllt.';
|
||||
msg.className = 'message success';
|
||||
} else {
|
||||
msg.textContent = `Fehler: HTTP ${response.status}`;
|
||||
msg.className = 'message error';
|
||||
}
|
||||
msg.style.display = 'block';
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
} finally {
|
||||
btn.disabled = false;
|
||||
btn.textContent = 'DB befüllen';
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -4,147 +4,7 @@
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>XXX The Game – Login</title>
|
||||
<style>
|
||||
* {
|
||||
box-sizing: border-box;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
body {
|
||||
min-height: 100vh;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
background: #1a1a2e;
|
||||
font-family: 'Segoe UI', sans-serif;
|
||||
color: #eee;
|
||||
}
|
||||
|
||||
.card {
|
||||
background: #16213e;
|
||||
border: 1px solid #0f3460;
|
||||
border-radius: 12px;
|
||||
padding: 2.5rem;
|
||||
width: 100%;
|
||||
max-width: 380px;
|
||||
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
|
||||
}
|
||||
|
||||
h1 {
|
||||
text-align: center;
|
||||
font-size: 1.6rem;
|
||||
margin-bottom: 0.25rem;
|
||||
color: #e94560;
|
||||
}
|
||||
|
||||
.subtitle {
|
||||
text-align: center;
|
||||
font-size: 0.85rem;
|
||||
color: #888;
|
||||
margin-bottom: 2rem;
|
||||
}
|
||||
|
||||
label {
|
||||
display: block;
|
||||
font-size: 0.8rem;
|
||||
color: #aaa;
|
||||
margin-bottom: 0.3rem;
|
||||
margin-top: 1rem;
|
||||
}
|
||||
|
||||
input {
|
||||
width: 100%;
|
||||
padding: 0.65rem 0.9rem;
|
||||
border: 1px solid #0f3460;
|
||||
border-radius: 6px;
|
||||
background: #0f3460;
|
||||
color: #eee;
|
||||
font-size: 1rem;
|
||||
outline: none;
|
||||
transition: border-color 0.2s;
|
||||
}
|
||||
|
||||
input:focus {
|
||||
border-color: #e94560;
|
||||
}
|
||||
|
||||
button {
|
||||
margin-top: 1.75rem;
|
||||
width: 100%;
|
||||
padding: 0.75rem;
|
||||
background: #e94560;
|
||||
color: #fff;
|
||||
border: none;
|
||||
border-radius: 6px;
|
||||
font-size: 1rem;
|
||||
font-weight: 600;
|
||||
cursor: pointer;
|
||||
transition: background 0.2s;
|
||||
}
|
||||
|
||||
button:hover:not(:disabled) {
|
||||
background: #c73652;
|
||||
}
|
||||
|
||||
button:disabled {
|
||||
opacity: 0.6;
|
||||
cursor: not-allowed;
|
||||
}
|
||||
|
||||
.message {
|
||||
margin-top: 1.25rem;
|
||||
padding: 0.65rem 0.9rem;
|
||||
border-radius: 6px;
|
||||
font-size: 0.85rem;
|
||||
display: none;
|
||||
word-break: break-all;
|
||||
}
|
||||
|
||||
.message.error {
|
||||
background: #3d0f1a;
|
||||
border: 1px solid #e94560;
|
||||
color: #e94560;
|
||||
}
|
||||
|
||||
.message.success {
|
||||
background: #0f3d1a;
|
||||
border: 1px solid #2ecc71;
|
||||
color: #2ecc71;
|
||||
}
|
||||
|
||||
.token-box {
|
||||
margin-top: 1.25rem;
|
||||
padding: 0.65rem 0.9rem;
|
||||
background: #0f1e3d;
|
||||
border: 1px solid #0f3460;
|
||||
border-radius: 6px;
|
||||
font-size: 0.75rem;
|
||||
color: #aaa;
|
||||
word-break: break-all;
|
||||
display: none;
|
||||
}
|
||||
|
||||
.token-box span {
|
||||
display: block;
|
||||
font-size: 0.7rem;
|
||||
color: #666;
|
||||
margin-bottom: 0.4rem;
|
||||
}
|
||||
|
||||
.copy-btn {
|
||||
margin-top: 0.5rem;
|
||||
width: auto;
|
||||
padding: 0.3rem 0.7rem;
|
||||
font-size: 0.75rem;
|
||||
background: #0f3460;
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
.copy-btn:hover {
|
||||
background: #1a4a8a;
|
||||
}
|
||||
</style>
|
||||
<link rel="stylesheet" href="/css/style.css">
|
||||
</head>
|
||||
<body>
|
||||
<div class="card">
|
||||
@@ -157,19 +17,21 @@
|
||||
<label for="password">Passwort</label>
|
||||
<input type="password" id="password" placeholder="••••••••" autocomplete="current-password" />
|
||||
|
||||
<button id="loginBtn" onclick="login()">Anmelden</button>
|
||||
<button class="full-width" id="loginBtn" onclick="login()">Anmelden</button>
|
||||
|
||||
<div class="message" id="message"></div>
|
||||
|
||||
<div class="token-box" id="tokenBox">
|
||||
<span>JWT Token</span>
|
||||
<div id="tokenText"></div>
|
||||
<button class="copy-btn" onclick="copyToken()">Kopieren</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
let currentToken = null;
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
const params = new URLSearchParams(window.location.search);
|
||||
const email = params.get('email');
|
||||
if (email) {
|
||||
document.getElementById('email').value = email;
|
||||
document.getElementById('password').focus();
|
||||
showMessage('E-Mail-Adresse bestätigt! Du kannst dich jetzt anmelden.', 'success');
|
||||
}
|
||||
});
|
||||
|
||||
document.addEventListener('keydown', e => {
|
||||
if (e.key === 'Enter') login();
|
||||
@@ -196,28 +58,30 @@
|
||||
btn.disabled = true;
|
||||
btn.textContent = 'Wird geprüft…';
|
||||
hideMessage();
|
||||
hideToken();
|
||||
|
||||
try {
|
||||
const hash = await sha256(password);
|
||||
const url = `/login?email=${encodeURIComponent(email)}&hash=${encodeURIComponent(hash)}`;
|
||||
const response = await fetch(url, { method: 'GET' });
|
||||
|
||||
if (response.ok) {
|
||||
currentToken = await response.text();
|
||||
showMessage('Login erfolgreich!', 'success');
|
||||
showToken(currentToken);
|
||||
if (response.status === 200) {
|
||||
const user = await response.json();
|
||||
sessionStorage.setItem('user', JSON.stringify(user));
|
||||
window.location.href = '/userhome.html';
|
||||
} else if (response.status === 204) {
|
||||
showMessage('E-Mail oder Passwort falsch.', 'error');
|
||||
btn.disabled = false;
|
||||
btn.textContent = 'Anmelden';
|
||||
} else {
|
||||
showMessage(`Fehler: HTTP ${response.status}`, 'error');
|
||||
btn.disabled = false;
|
||||
btn.textContent = 'Anmelden';
|
||||
}
|
||||
} catch (err) {
|
||||
showMessage('Server nicht erreichbar.', 'error');
|
||||
console.error(err);
|
||||
} finally {
|
||||
btn.disabled = false;
|
||||
btn.textContent = 'Anmelden';
|
||||
console.error(err);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -231,26 +95,6 @@
|
||||
function hideMessage() {
|
||||
document.getElementById('message').style.display = 'none';
|
||||
}
|
||||
|
||||
function showToken(token) {
|
||||
document.getElementById('tokenText').textContent = token;
|
||||
document.getElementById('tokenBox').style.display = 'block';
|
||||
}
|
||||
|
||||
function hideToken() {
|
||||
document.getElementById('tokenBox').style.display = 'none';
|
||||
currentToken = null;
|
||||
}
|
||||
|
||||
function copyToken() {
|
||||
if (currentToken) {
|
||||
navigator.clipboard.writeText(currentToken).then(() => {
|
||||
const btn = document.querySelector('.copy-btn');
|
||||
btn.textContent = 'Kopiert!';
|
||||
setTimeout(() => btn.textContent = 'Kopieren', 1500);
|
||||
});
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
111
xxxthegame/src/main/resources/static/registration.html
Normal file
111
xxxthegame/src/main/resources/static/registration.html
Normal file
@@ -0,0 +1,111 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="de">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>XXX The Game – Registrierung</title>
|
||||
<link rel="stylesheet" href="/css/style.css">
|
||||
</head>
|
||||
<body>
|
||||
<div class="card">
|
||||
<h1>XXX The Game</h1>
|
||||
<p class="subtitle">Neues Konto erstellen</p>
|
||||
|
||||
<label for="name">Name</label>
|
||||
<input type="text" id="name" placeholder="Dein Name" autocomplete="name" />
|
||||
|
||||
<label for="email">E-Mail</label>
|
||||
<input type="email" id="email" placeholder="deine@email.de" autocomplete="email" />
|
||||
|
||||
<label for="password">Passwort</label>
|
||||
<input type="password" id="password" placeholder="••••••••" autocomplete="new-password" />
|
||||
|
||||
<label for="passwordConfirm">Passwort wiederholen</label>
|
||||
<input type="password" id="passwordConfirm" placeholder="••••••••" autocomplete="new-password" />
|
||||
|
||||
<button class="full-width" id="registerBtn" onclick="register()">Registrieren</button>
|
||||
|
||||
<div class="message" id="message"></div>
|
||||
|
||||
<p style="text-align:center; margin-top:1.5rem; font-size:0.85rem;">
|
||||
Bereits registriert? <a href="/login.html" style="color:#e94560;">Anmelden</a>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
document.addEventListener('keydown', e => {
|
||||
if (e.key === 'Enter') register();
|
||||
});
|
||||
|
||||
async function sha256(text) {
|
||||
const encoder = new TextEncoder();
|
||||
const data = encoder.encode(text);
|
||||
const hashBuffer = await crypto.subtle.digest('SHA-256', data);
|
||||
const hashArray = Array.from(new Uint8Array(hashBuffer));
|
||||
return hashArray.map(b => b.toString(16).padStart(2, '0')).join('');
|
||||
}
|
||||
|
||||
async function register() {
|
||||
const name = document.getElementById('name').value.trim();
|
||||
const email = document.getElementById('email').value.trim();
|
||||
const password = document.getElementById('password').value;
|
||||
const passwordConfirm = document.getElementById('passwordConfirm').value;
|
||||
const btn = document.getElementById('registerBtn');
|
||||
|
||||
if (!name || !email || !password || !passwordConfirm) {
|
||||
showMessage('Bitte alle Felder ausfüllen.', 'error');
|
||||
return;
|
||||
}
|
||||
if (!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email)) {
|
||||
showMessage('Bitte eine gültige E-Mail-Adresse eingeben.', 'error');
|
||||
return;
|
||||
}
|
||||
if (password !== passwordConfirm) {
|
||||
showMessage('Die Passwörter stimmen nicht überein.', 'error');
|
||||
return;
|
||||
}
|
||||
|
||||
btn.disabled = true;
|
||||
btn.textContent = 'Wird verarbeitet…';
|
||||
hideMessage();
|
||||
|
||||
try {
|
||||
const passwordHash = await sha256(password);
|
||||
const response = await fetch('/registration', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ name, email, passwordHash })
|
||||
});
|
||||
|
||||
if (response.status === 202) {
|
||||
window.location.href = `/activate.html?email=${encodeURIComponent(email)}`;
|
||||
} else if (response.status === 400) {
|
||||
showMessage('Diese E-Mail-Adresse ist bereits registriert.', 'error');
|
||||
btn.disabled = false;
|
||||
btn.textContent = 'Registrieren';
|
||||
} else {
|
||||
showMessage(`Fehler: HTTP ${response.status}`, 'error');
|
||||
btn.disabled = false;
|
||||
btn.textContent = 'Registrieren';
|
||||
}
|
||||
} catch (err) {
|
||||
showMessage('Server nicht erreichbar.', 'error');
|
||||
btn.disabled = false;
|
||||
btn.textContent = 'Registrieren';
|
||||
console.error(err);
|
||||
}
|
||||
}
|
||||
|
||||
function showMessage(text, type) {
|
||||
const el = document.getElementById('message');
|
||||
el.textContent = text;
|
||||
el.className = `message ${type}`;
|
||||
el.style.display = 'block';
|
||||
}
|
||||
|
||||
function hideMessage() {
|
||||
document.getElementById('message').style.display = 'none';
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
23
xxxthegame/src/main/resources/static/userhome.html
Normal file
23
xxxthegame/src/main/resources/static/userhome.html
Normal file
@@ -0,0 +1,23 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="de">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>XXX The Game</title>
|
||||
<link rel="stylesheet" href="/css/style.css">
|
||||
</head>
|
||||
<body>
|
||||
<h1>XXX The Game</h1>
|
||||
<p id="greeting"></p>
|
||||
|
||||
<script>
|
||||
const userJson = sessionStorage.getItem('user');
|
||||
if (!userJson) {
|
||||
window.location.href = '/login.html';
|
||||
} else {
|
||||
const user = JSON.parse(userJson);
|
||||
document.getElementById('greeting').textContent = 'Willkommen, ' + user.name + '!';
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user