• Resolved aniketnt

    (@aniketnt)


    Hi,

    I am using a form which has some fileds to be posted and save but it requires login so after filling the form when user submit a popup occur asking for login after login i return the new nonce field and update the user form so that it can be submitted and checked for nonce but what i notice the nonce field return after the ajax login is the same as before login. so how to get rid of this situation please help me out

Viewing 3 replies - 1 through 3 (of 3 total)
  • Moderator bcworkz

    (@bcworkz)

    The nonces generated by WP are not true nonces. Given the same action seed, the nonce returned by a function like wp_create_nonce() will only change every 12 hours. Checking the nonce with wp_verify_nonce() will validate any nonce with an identical action seed for up to 24 hours. Such “nonces” can be used any number of times within that period.

    If the nature of your app demands a true nonce that can only be used once, you’ll need to implement your own nonce scheme.

    Thread Starter aniketnt

    (@aniketnt)

    hi bcworkz,

    Thanks fr your reply but my question is different, what i am facing issue is when i use login using wp_signon but i am achieving this using ajax now what i notice after login via wp_signon i request the new wp_nonce which must be different from the anonymous use code but wp_nonce_field return the old token that must be different after login so how can i achieve this if i am login using ajax and wp_signon i need to return a new wp_nnonce at the same time that must be a token after user login.

    Thread Starter aniketnt

    (@aniketnt)

    Hi,

    I got the solution after adding the below code in function.php it works

    function my_update_cookie( $logged_in_cookie ){
    $_COOKIE[LOGGED_IN_COOKIE] = $logged_in_cookie;
    }
    add_action( ‘set_logged_in_cookie’, ‘my_update_cookie’ );

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘After ajax login the new nonce field is not returned’ is closed to new replies.