From 19a10e5704fb4b605e291990220c71a26ec67972 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20G=C3=BCnther?=
+ +
++ +
+ add('first_name_error', 'FEHLER: Der Vorname ist erforderlich.'); + } + if (empty($_POST['last_name']) || !empty($_POST['last_name']) && trim($_POST['last_name']) == '') { + $errors->add('last_name_error', 'FEHLER: DEr Nachname ist erforderlich.'); + } + return $errors; + + + } +} \ No newline at end of file diff --git a/modules/Registration/Controllers/class-saveregistration.php b/modules/Registration/Controllers/class-saveregistration.php new file mode 100644 index 0000000..de0c537 --- /dev/null +++ b/modules/Registration/Controllers/class-saveregistration.php @@ -0,0 +1,76 @@ +set_role('standarduser'); + + // Send confirmation email + $user = get_userdata($user_id); + $code = sha1($user->user_registered); + update_user_meta($user_id, 'activation_code', $code); + + $activation_link = add_query_arg(array('key' => $code, 'user' => $user_id), get_site_url() . '/wp-login.php'); + + wp_mail($user->user_email, 'Bitte bestätige deine Anmeldung', 'Hallo, bitte bestätige deine Anmeldung über den folgenden Link: ' . $activation_link); + + // Notify admin + wp_mail(get_option('admin_email'), 'New User Registration', 'A new user has registered: ' . $user->user_login . PHP_EOL . 'First name:' . $user->first_name . PHP_EOL . 'Last name:' . $user->last_name ); + } + + public static function activate_user() { + if (isset($_GET['key']) && isset($_GET['user'])) { + $user_id = intval($_GET['user']); + $activation_code = get_user_meta($user_id, 'activation_code', true); + + if ($activation_code === $_GET['key']) { + delete_user_meta($user_id, 'activation_code'); + wp_redirect(home_url('/wp-login.php?checkemail=registered')); + exit; + } + } + } + + public static function check_user_activation($user, $username, $password) { + if (!is_a($user, 'WP_User')) { + return null; + } + $user_id = $user->ID; + $activation_code = get_user_meta($user_id, 'activation_code', true); + + if ($activation_code) { + return new WP_Error('not_activated', __('ERROR: You need to activate your account. Please check your email.', 'kompass')); + } + + return $user; + } + + public static function display_custom_message() { + if (isset($_GET['checkemail']) && $_GET['checkemail'] === 'registered') { + echo ' '; + } + } +} \ No newline at end of file diff --git a/modules/calendar/calendar.php b/modules/calendar/calendar.php index 07e6e37..1bf5c52 100644 --- a/modules/calendar/calendar.php +++ b/modules/calendar/calendar.php @@ -1,6 +1,4 @@ prefix . $table; + $sql = "SHOW TABLES LIKE '$sqlTable'"; + + $result = $wpdb->get_var( $sql ); + if ( $result == $sqlTable ) { + $show_menu = true; + } + } + + if (!$show_menu) { + return; + } + + add_menu_page( + __('Events (legacy)', BDP_LV_PLUGIN_SLUG), + __('Events (legacy)', BDP_LV_PLUGIN_SLUG), 'send_mails', 'kompass-events', [$this, 'router'], diff --git a/modules/security/classes/Security.class.php b/modules/security/classes/Security.class.php index a44806f..f86d810 100644 --- a/modules/security/classes/Security.class.php +++ b/modules/security/classes/Security.class.php @@ -28,8 +28,7 @@ class Security $loginUrl = get_option('whl_page', null) ?? 'bdp-login'; } - enable_option_rewrite_url($loginUrl); - enable_option_disable_xmlrpc(); + enable_option_disable_xmlrpc(); enable_option_block_authorscan(); enable_option_block_execution_in_uploads(); enable_option_prohibit_special_files(); @@ -83,12 +82,17 @@ class Security public static function SetPageFilters() { global $wp; - if (str_contains($_SERVER['REQUEST_URI'], 'wp-login.php?action=logout')) { - return; + add_action('template_redirect', [Security::class, 'protectAuthorScan']); + + if (null !== is_login_rewritten()) { + if (str_contains($_SERVER['REQUEST_URI'], 'wp-login.php?action=logout')) { + return; } - add_action('template_redirect', [Security::class, 'protectAuthorScan']); - Security::protectLoginSecurity(); + Security::protectLoginSecurity(); + } + + } public static function protectLoginSecurity() { diff --git a/modules/security/includes/settings_writer.php b/modules/security/includes/settings_writer.php index 6012da5..e06490f 100644 --- a/modules/security/includes/settings_writer.php +++ b/modules/security/includes/settings_writer.php @@ -86,12 +86,6 @@ function disable_option_disable_wp_debug() { WpConfigEditor::updateConfig('WP_DEBUG', 'true'); } -function enable_option_rewrite_url(?string $url = null) { - global $_POST; - $saveUrl = $url ?? $_POST['rewrite_login']; - update_option('kompass_sec_rewrite_login', $saveUrl); -} - function disable_option_rewrite_url() { update_option('kompass_sec_rewrite_login', null); } @@ -110,7 +104,6 @@ function kompass_sec_save_settings($settings) { 'option_prohibit_bot_access', 'option_block_directory_listing', 'option_disable_wp_debug', - 'option_rewrite_url', ]; $enableSettings = array_intersect($allPossibleSettings, $settings); diff --git a/modules/security/internal/site-health-tab.php b/modules/security/internal/site-health-tab.php index b7b3014..d9b2351 100644 --- a/modules/security/internal/site-health-tab.php +++ b/modules/security/internal/site-health-tab.php @@ -98,20 +98,6 @@ -Vielen Dank für deine Registrierung. Bitte überprüfen deine E-Mails, um deine Registrierung zu bestätigen.
'; } + + if ((isset($_GET['action']) && $_GET['action'] === 'laostpassword') || + isset($_GET['checkemail']) && $_GET['checkemail'] === 'confirm' + ){ + echo ' '; + } + + if (isset($_GET['action']) && $_GET['action'] === 'resetpass') { + echo ' '; + } } } \ No newline at end of file diff --git a/settings/views/mail-settings.php b/settings/views/mail-settings.php new file mode 100644 index 0000000..28da90a --- /dev/null +++ b/settings/views/mail-settings.php @@ -0,0 +1,147 @@ + + + + \ No newline at end of file -- 2.45.2 From 5b6b06e70d489675dc4a7af27c8a10a2ad2b06e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20G=C3=BCnther?=