Home › Forums › Quform WordPress › Passwort forgotten form? › Reply To: Passwort forgotten form?
March 16, 2021 at 1:02 pm #32713
MGmeiner
Participant
Oky i got it also ->
add_action('quform_pre_display_6', function (Quform_Form $form) {
if ( !function_exists( 'check_password_reset_key' ) ) {
require_once ABSPATH . WPINC . '/user.php';
}
// Hash to validate sending user's password.
$key = $_REQUEST['key'];
// The user login.
$login = $_REQUEST['login'];
$user = check_password_reset_key($key, $login);
if ( ! $user || is_wp_error( $user ) ) {
if ( $user && $user->get_error_code() === 'expired_key' ) {
wp_redirect( home_url( 'expiredkey' ) );
} else {
wp_redirect( home_url( 'invalidkey' ) );
}
exit;
}
});