Site icon Hip-Hop Website Design and Development

admin post redirects to localhost when not logged in

I have a form that i’m trying to run an action when it’s dont
I send it to admin-post like this:

<form action="<?php echo admin_url('admin-post.php'); ?>" method="post">
    <input type="hidden" name="action" value="asaf_reset_password">

    <p class="form-row form-row-wide">
        <label for="reset_password_email"><?php esc_html_e( 'email', 'tt' ); ?></label>
        <input class="input-text" type="text" name="reset_password_email" id="reset_password_email" />
    </p>
    
    <p class="form-row">
        <input type="submit" class="button btn btn-blue" value="<?php esc_attr_e( 'Reset password', 'woocommerce' ); ?>"></input>
    </p>
</form>

And the function that is supposed to happen when it runs

function reset_password_asaf_action()
{
    echo $_POST['reset_password_email'];
    die("test");
    wp_die();
}

add_action('admin_post_nopriv_asaf_reset_password', 'reset_password_asaf_action');
add_action('admin_post_asaf_reset_password', 'reset_password_asaf_action');

When i’m logged in everything works, but when im not logged in (it’s supposed to only trigger when not logged in) i get 302 from my form submission and redirected to localhost