Minecraft-Modern-Theme/page-login.php aktualisiert
This commit is contained in:
@@ -1,208 +1,84 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
/*
|
||||||
Template Name: Minecraft Modern Theme
|
Template Name: Benutzerdefinierte Authentifizierungsseite
|
||||||
*/
|
*/
|
||||||
|
|
||||||
get_header(); ?>
|
get_header(); ?>
|
||||||
|
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div id="primary" class="content-area">
|
<div id="primary" class="content-area">
|
||||||
<main id="main" class="site-main">
|
<main id="main" class="site-main">
|
||||||
<div class="custom-login-container">
|
<div class="custom-auth-container">
|
||||||
<?php
|
<?php if (is_user_logged_in()) : ?>
|
||||||
// Wenn der Benutzer nicht angemeldet ist, zeige das Login-Formular
|
<!-- Wenn der Benutzer angemeldet ist, zeige eine Nachricht und einen Logout-Link -->
|
||||||
if (!is_user_logged_in()) {
|
<div class="logged-in-message">
|
||||||
// Custom Login Formular
|
<h2>Willkommen zurück, <?php echo esc_html(wp_get_current_user()->display_name); ?>!</h2>
|
||||||
$args = array(
|
<p>Du bist bereits angemeldet.</p>
|
||||||
'echo' => true,
|
<p>
|
||||||
'redirect' => admin_url(), // Weiterleitung zum Dashboard nach dem Login
|
<a href="<?php echo esc_url(wp_logout_url(home_url())); ?>" class="button">Abmelden</a>
|
||||||
'form_id' => 'custom_loginform',
|
<a href="<?php echo esc_url(admin_url()); ?>" class="button">Zum Dashboard</a>
|
||||||
'label_username' => __( 'Benutzername' ),
|
</p>
|
||||||
'label_password' => __( 'Passwort' ),
|
</div>
|
||||||
'label_remember' => __( 'Angemeldet bleiben' ),
|
<?php else : ?>
|
||||||
'label_log_in' => __( 'Anmelden' ),
|
<!-- Wenn der Benutzer nicht angemeldet ist, zeige das Registrierungsformular -->
|
||||||
'id_username' => 'user_login',
|
<h1 class="auth-title">Willkommen auf <?php bloginfo('name'); ?></h1>
|
||||||
'id_password' => 'user_pass',
|
<p class="auth-subtitle">Erstelle deinen Account und werde Teil unserer Community!</p>
|
||||||
'id_remember' => 'rememberme',
|
|
||||||
'id_submit' => 'wp-submit',
|
<?php
|
||||||
'remember' => true,
|
// Zeige das Registrierungsformular an
|
||||||
'value_username' => NULL,
|
$args = array(
|
||||||
'value_remember' => false
|
'echo' => true,
|
||||||
);
|
'redirect' => home_url('/login/?checkemail=registered'), // Weiterleitung nach der Registrierung
|
||||||
|
'form_id' => 'custom_registerform',
|
||||||
// Minecraft Avatar Container
|
'label_username' => __( 'Benutzername' ),
|
||||||
$avatar_uuid = get_theme_mod('login_avatar_uuid', '069a79f444e94726a5befca90e38eaf6');
|
'label_email' => __( 'E-Mail-Adresse' ),
|
||||||
if (!empty($avatar_uuid)) {
|
'label_password' => __( 'Passwort' ),
|
||||||
// === KORRIGIERT: Nutzen wir nun Minotar.net für den VOLLKÖRPER ===
|
'label_remember' => __( 'Angemeldet bleiben' ),
|
||||||
$avatar_url = "https://minotar.net/full/{$avatar_uuid}/256";
|
'label_log_in' => __( 'Registrieren' ),
|
||||||
echo '<div id="minecraft-avatar-container"><img src="' . esc_url($avatar_url) . '" alt="Minecraft Avatar"></div>';
|
'id_username' => 'user_login',
|
||||||
}
|
'id_email' => 'user_email',
|
||||||
|
'id_password' => 'user_pass',
|
||||||
// Login-Formular anzeigen
|
'id_remember' => 'rememberme',
|
||||||
wp_login_form($args);
|
'id_submit' => 'wp-submit',
|
||||||
} else {
|
'remember' => true,
|
||||||
// Wenn der Benutzer bereits angemeldet ist, zeige eine Nachricht und einen Logout-Link
|
'value_username' => NULL,
|
||||||
$current_user = wp_get_current_user();
|
'value_remember' => false
|
||||||
echo '<div class="logged-in-message">';
|
);
|
||||||
echo '<h2>Willkommen zurück, ' . esc_html($current_user->display_name) . '!</h2>';
|
wp_register_form($args);
|
||||||
echo '<p>Du bist bereits angemeldet.</p>';
|
?>
|
||||||
echo '<p><a href="' . esc_url(wp_logout_url(home_url())) . '" class="button">Abmelden</a></p>';
|
|
||||||
echo '<p><a href="' . esc_url(admin_url()) . '" class="button">Zum Dashboard</a></p>';
|
<div class="login-form-link">
|
||||||
echo '</div>';
|
<p>Schon hast du einen Account? <a href="<?php echo esc_url(wp_login_url()); ?>">Hier anmelden</a>.</p>
|
||||||
}
|
</div>
|
||||||
?>
|
<?php endif; ?>
|
||||||
</div>
|
</div>
|
||||||
</main>
|
</main>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
// Login-Hintergrundbild aus dem Customizer holen und als Inline-CSS ausgeben
|
// Hintergrundbild aus dem Customizer holen und als Inline-CSS ausgeben
|
||||||
$login_bg_image = get_theme_mod('login_background_image');
|
$auth_bg_image = get_theme_mod('login_background_image');
|
||||||
if ($login_bg_image):
|
if ($auth_bg_image):
|
||||||
?>
|
?>
|
||||||
<style>
|
<style>
|
||||||
body {
|
body.login, body.login-action-register {
|
||||||
background-image: url('<?php echo esc_url($login_bg_image); ?>') !important;
|
background-image: url('<?php echo esc_url($auth_bg_image); ?>') !important;
|
||||||
background-size: cover !important;
|
background-size: cover !important;
|
||||||
background-position: center !important;
|
background-position: center !important;
|
||||||
background-repeat: no-repeat !important;
|
background-repeat: no-repeat !important;
|
||||||
}
|
}
|
||||||
body::before {
|
body.login::before, body.login-action-register::before {
|
||||||
content: '';
|
content: '';
|
||||||
position: fixed;
|
position: fixed;
|
||||||
top: 0;
|
top: 0;
|
||||||
left: 0;
|
left: 0;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
background: rgba(20, 21, 26, 0.8);
|
background: rgba(20, 21, 26, 0.8);
|
||||||
z-index: -1;
|
z-index: -1;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
|
||||||
<style>
|
|
||||||
.custom-login-container {
|
|
||||||
max-width: 800px;
|
|
||||||
margin: 60px auto;
|
|
||||||
padding: 40px;
|
|
||||||
background-color: var(--card-bg, #252830);
|
|
||||||
border-radius: 8px;
|
|
||||||
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
|
|
||||||
border: 1px solid var(--border-color, #333);
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
gap: 40px;
|
|
||||||
}
|
|
||||||
|
|
||||||
#minecraft-avatar-container {
|
|
||||||
flex: 0 0 27.8%;
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
padding: 20px;
|
|
||||||
background-color: #1a1c23;
|
|
||||||
height: auto;
|
|
||||||
}
|
|
||||||
|
|
||||||
#minecraft-avatar-container img {
|
|
||||||
width: 100%;
|
|
||||||
height: auto;
|
|
||||||
max-height: 400px;
|
|
||||||
border-radius: 4px;
|
|
||||||
border: 3px solid var(--primary-accent, #00d4ff);
|
|
||||||
box-shadow: 0 4px 15px rgba(0, 212, 255, 0.4);
|
|
||||||
}
|
|
||||||
|
|
||||||
#custom_loginform {
|
|
||||||
flex: 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
#custom_loginform p {
|
|
||||||
margin-bottom: 20px;
|
|
||||||
}
|
|
||||||
|
|
||||||
#custom_loginform label {
|
|
||||||
display: block;
|
|
||||||
margin-bottom: 8px;
|
|
||||||
font-weight: 600;
|
|
||||||
color: var(--text-color, #e4e4e4);
|
|
||||||
}
|
|
||||||
|
|
||||||
#custom_loginform input[type="text"],
|
|
||||||
#custom_loginform input[type="password"] {
|
|
||||||
width: 100%;
|
|
||||||
padding: 14px;
|
|
||||||
background-color: var(--surface-color, #1e2029);
|
|
||||||
border: 1px solid var(--border-color, #333);
|
|
||||||
border-radius: 4px;
|
|
||||||
color: var(--text-color, #e4e4e4);
|
|
||||||
font-family: 'Raleway', sans-serif;
|
|
||||||
}
|
|
||||||
|
|
||||||
#custom_loginform .forgetmenot label {
|
|
||||||
display: inline-flex;
|
|
||||||
align-items: center;
|
|
||||||
font-weight: 400;
|
|
||||||
}
|
|
||||||
|
|
||||||
#custom_loginform .submit {
|
|
||||||
margin-top: 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
#custom_loginform input[type="submit"] {
|
|
||||||
width: 100%;
|
|
||||||
padding: 14px;
|
|
||||||
background-color: var(--primary-accent, #00d4ff);
|
|
||||||
border: none;
|
|
||||||
border-radius: 4px;
|
|
||||||
color: #fff;
|
|
||||||
font-weight: 600;
|
|
||||||
cursor: pointer;
|
|
||||||
transition: background-color 0.3s;
|
|
||||||
}
|
|
||||||
#custom_loginform input[type="submit"]:hover {
|
|
||||||
background-color: #00a8cc;
|
|
||||||
}
|
|
||||||
|
|
||||||
.logged-in-message {
|
|
||||||
text-align: center;
|
|
||||||
padding: 40px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.logged-in-message h2 {
|
|
||||||
margin-top: 0;
|
|
||||||
color: var(--primary-accent, #00d4ff);
|
|
||||||
}
|
|
||||||
|
|
||||||
.logged-in-message .button {
|
|
||||||
display: inline-block;
|
|
||||||
margin: 10px;
|
|
||||||
padding: 12px 25px;
|
|
||||||
background-color: var(--primary-accent, #00d4ff);
|
|
||||||
color: #fff;
|
|
||||||
text-decoration: none;
|
|
||||||
border-radius: 4px;
|
|
||||||
font-weight: 600;
|
|
||||||
transition: background-color 0.3s;
|
|
||||||
}
|
|
||||||
.logged-in-message .button:hover {
|
|
||||||
background-color: #00a8cc;
|
|
||||||
}
|
|
||||||
|
|
||||||
@media screen and (max-width: 768px) {
|
|
||||||
.custom-login-container {
|
|
||||||
flex-direction: column;
|
|
||||||
gap: 30px;
|
|
||||||
}
|
|
||||||
#minecraft-avatar-container {
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
#minecraft-avatar-container img {
|
|
||||||
max-height: 300px;
|
|
||||||
max-width: 200px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|
||||||
<?php get_footer(); ?>
|
<?php get_footer(); ?>
|
||||||
Reference in New Issue
Block a user