gesperte Wahl angepasst

This commit is contained in:
ProgrammGamer
2026-01-30 17:12:12 +01:00
parent 7a45a78753
commit e57ac1bd6d

View File

@@ -4,10 +4,6 @@ add_shortcode('konficastle_workshopwahl', function($atts) {
$wahl_id = intval($atts['wahl']); $wahl_id = intval($atts['wahl']);
global $wpdb; global $wpdb;
// Enqueue client-side validation JS
add_action('wp_footer', function() {
echo '<script src="' . esc_url(plugins_url('../assets/frontend-form.js', __FILE__)) . '"></script>';
});
// KRITISCHER TEST: Ausgabe ganz am Anfang // KRITISCHER TEST: Ausgabe ganz am Anfang
//$debug_output = '<div style="background:yellow;padding:20px;margin:20px 0;border:3px solid red;">'; //$debug_output = '<div style="background:yellow;padding:20px;margin:20px 0;border:3px solid red;">';
@@ -20,7 +16,7 @@ add_shortcode('konficastle_workshopwahl', function($atts) {
$wahl = $wpdb->get_row($wpdb->prepare("SELECT * FROM {$wpdb->prefix}kc_wahlen WHERE id=%d", $wahl_id)); $wahl = $wpdb->get_row($wpdb->prepare("SELECT * FROM {$wpdb->prefix}kc_wahlen WHERE id=%d", $wahl_id));
if(!$wahl || !$wahl->freigegeben) { if(!$wahl || !$wahl->freigegeben) {
return $debug_output . '<div class="kc-error-msg"></div>'; return $debug_output . '<div"></div>';
} }
// Ermittle erlaubte Workshops pro Phase für diese Wahl. // Ermittle erlaubte Workshops pro Phase für diese Wahl.
@@ -282,17 +278,8 @@ add_shortcode('konficastle_teamer_create', function($atts) {
} else { } else {
$pw = trim($_POST['kc_teamer_pw'] ?? ''); $pw = trim($_POST['kc_teamer_pw'] ?? '');
$saved_hash = get_option('kc_teamer_password_hash', ''); $saved_hash = get_option('kc_teamer_password_hash', '');
$valid_pw = false; if (empty($saved_hash) || !wp_check_password($pw, $saved_hash)) {
if (!empty($saved_hash)) { $msg = '<div class="kc-error-msg">Falsches Passwort.</div>';
if (password_verify($pw, $saved_hash)) {
$valid_pw = true;
} else if (function_exists('wp_check_password') && wp_check_password($pw, $saved_hash)) {
// Rückwärtskompatibilität: alter Hash
$valid_pw = true;
}
}
if (!$valid_pw) {
$msg = '<div class="kc-error-msg">Falsches Passwort.</div>';
} else { } else {
$vorname = sanitize_text_field($_POST['vorname'] ?? ''); $vorname = sanitize_text_field($_POST['vorname'] ?? '');
$nachname = sanitize_text_field($_POST['nachname'] ?? ''); $nachname = sanitize_text_field($_POST['nachname'] ?? '');