153 lines
6.3 KiB
PHP
153 lines
6.3 KiB
PHP
<?php
|
||
/*
|
||
Template Name: Benutzerdefinierte Authentifizierungsseite
|
||
*/
|
||
|
||
get_header(); ?>
|
||
|
||
<div class="container">
|
||
<div id="primary" class="content-area">
|
||
<main id="main" class="site-main">
|
||
<div class="custom-auth-container">
|
||
|
||
<?php if ( is_user_logged_in() ) : ?>
|
||
|
||
<!-- Eingeloggt -->
|
||
<div class="logged-in-message">
|
||
<h2><?php printf( __('Willkommen zurück, %s!', 'minecraft-modern-theme'), esc_html( wp_get_current_user()->display_name ) ); ?></h2>
|
||
<p><?php _e('Du bist bereits angemeldet.', 'minecraft-modern-theme'); ?></p>
|
||
<p>
|
||
<a href="<?php echo esc_url( wp_logout_url( home_url() ) ); ?>" class="button">
|
||
<i class="fas fa-sign-out-alt"></i> <?php _e('Abmelden', 'minecraft-modern-theme'); ?>
|
||
</a>
|
||
<a href="<?php echo esc_url( admin_url() ); ?>" class="button">
|
||
<i class="fas fa-tachometer-alt"></i> <?php _e('Zum Dashboard', 'minecraft-modern-theme'); ?>
|
||
</a>
|
||
</p>
|
||
</div>
|
||
|
||
<?php elseif ( get_option('users_can_register') ) : ?>
|
||
|
||
<!-- Registrierung erlaubt -->
|
||
<h1 class="auth-title"><?php printf( __('Willkommen auf %s', 'minecraft-modern-theme'), get_bloginfo('name') ); ?></h1>
|
||
<p class="auth-subtitle"><?php _e('Erstelle deinen Account und werde Teil unserer Community!', 'minecraft-modern-theme'); ?></p>
|
||
|
||
<?php
|
||
// Fehlermeldungen aus der Query-String (z.B. nach gescheiterter Registrierung)
|
||
if ( isset($_GET['registration']) && $_GET['registration'] === 'disabled' ) : ?>
|
||
<div class="auth-notice auth-notice-error">
|
||
<i class="fas fa-exclamation-circle"></i>
|
||
<?php _e('Die Registrierung ist zurzeit deaktiviert.', 'minecraft-modern-theme'); ?>
|
||
</div>
|
||
<?php endif;
|
||
|
||
if ( isset($_GET['checkemail']) && $_GET['checkemail'] === 'registered' ) : ?>
|
||
<div class="auth-notice auth-notice-success">
|
||
<i class="fas fa-check-circle"></i>
|
||
<?php _e('Registrierung erfolgreich! Prüfe deine E-Mails für das Passwort.', 'minecraft-modern-theme'); ?>
|
||
</div>
|
||
<?php endif; ?>
|
||
|
||
<?php
|
||
wp_register_form( array(
|
||
'redirect' => home_url('/login/?checkemail=registered'),
|
||
'form_id' => 'custom_registerform',
|
||
'label_username' => __('Benutzername', 'minecraft-modern-theme'),
|
||
'label_email' => __('E-Mail-Adresse', 'minecraft-modern-theme'),
|
||
'label_password' => __('Passwort', 'minecraft-modern-theme'),
|
||
'label_log_in' => __('Registrieren', 'minecraft-modern-theme'),
|
||
'id_username' => 'user_login',
|
||
'id_email' => 'user_email',
|
||
'id_submit' => 'wp-submit',
|
||
'value_username' => isset($_GET['user_login']) ? sanitize_user( $_GET['user_login'] ) : '',
|
||
) );
|
||
?>
|
||
|
||
<div class="login-form-link">
|
||
<p><?php _e('Schon einen Account?', 'minecraft-modern-theme'); ?>
|
||
<a href="<?php echo esc_url( wp_login_url() ); ?>">
|
||
<?php _e('Hier anmelden', 'minecraft-modern-theme'); ?>
|
||
</a>
|
||
</p>
|
||
</div>
|
||
|
||
<?php else : ?>
|
||
|
||
<!-- FIX: Registrierung deaktiviert – saubere Fehlermeldung statt kaputter Formulare -->
|
||
<div class="auth-registration-closed">
|
||
<div class="auth-icon"><i class="fas fa-lock fa-3x"></i></div>
|
||
<h2><?php _e('Registrierung geschlossen', 'minecraft-modern-theme'); ?></h2>
|
||
<p><?php _e('Neue Registrierungen sind derzeit nicht möglich. Bitte schau später wieder vorbei oder kontaktiere einen Administrator.', 'minecraft-modern-theme'); ?></p>
|
||
<a href="<?php echo esc_url( wp_login_url() ); ?>" class="button">
|
||
<i class="fas fa-sign-in-alt"></i> <?php _e('Zum Login', 'minecraft-modern-theme'); ?>
|
||
</a>
|
||
</div>
|
||
|
||
<?php endif; ?>
|
||
|
||
</div>
|
||
</main>
|
||
</div>
|
||
</div>
|
||
|
||
<?php
|
||
$auth_bg_image = get_theme_mod('login_background_image');
|
||
if ( $auth_bg_image ) : ?>
|
||
<style>
|
||
body {
|
||
background-image: url('<?php echo esc_url($auth_bg_image); ?>') !important;
|
||
background-size: cover !important;
|
||
background-position: center !important;
|
||
background-repeat: no-repeat !important;
|
||
}
|
||
body::before {
|
||
content: '';
|
||
position: fixed;
|
||
inset: 0;
|
||
background: rgba(20, 21, 26, 0.8);
|
||
z-index: -1;
|
||
}
|
||
</style>
|
||
<?php endif; ?>
|
||
|
||
<style>
|
||
/* Benachrichtigungen */
|
||
.auth-notice {
|
||
display: flex;
|
||
align-items: center;
|
||
gap: 10px;
|
||
padding: 14px 18px;
|
||
border-radius: 6px;
|
||
margin-bottom: 20px;
|
||
font-weight: 500;
|
||
}
|
||
.auth-notice-success {
|
||
background: rgba(0, 212, 100, 0.12);
|
||
border-left: 4px solid #00d464;
|
||
color: #00d464;
|
||
}
|
||
.auth-notice-error {
|
||
background: rgba(255, 60, 60, 0.1);
|
||
border-left: 4px solid #ff3c3c;
|
||
color: #ff3c3c;
|
||
}
|
||
|
||
/* Registrierung geschlossen */
|
||
.auth-registration-closed {
|
||
text-align: center;
|
||
padding: 60px 40px;
|
||
background: var(--card-bg);
|
||
border-radius: 10px;
|
||
max-width: 500px;
|
||
margin: 0 auto;
|
||
}
|
||
.auth-icon {
|
||
color: var(--primary-accent, #00d4ff);
|
||
margin-bottom: 20px;
|
||
opacity: 0.6;
|
||
}
|
||
.auth-registration-closed h2 { margin-bottom: 12px; }
|
||
.auth-registration-closed p { color: var(--text-muted, #a0a0a0); margin-bottom: 24px; }
|
||
</style>
|
||
|
||
<?php get_footer(); ?>
|