[wp-trac] [WordPress Trac] #46595: Allow more than one valid recovery mode link
WordPress Trac
noreply at wordpress.org
Wed Apr 3 19:44:05 UTC 2019
#46595: Allow more than one valid recovery mode link
------------------------------------+--------------------------------
Reporter: flixos90 | Owner: timothyblynjacobs
Type: defect (bug) | Status: assigned
Priority: normal | Milestone: 5.2
Component: Bootstrap/Load | Version: trunk
Severity: normal | Resolution:
Keywords: needs-patch servehappy | Focuses:
------------------------------------+--------------------------------
Comment (by pbearne):
Added a patch to support more than one link
Update Unit tests to match we may need some more
made it so a LINK can only be used ONCE
If a user request more than one link only the last will as the same nonce
is used as the key
this code doesn't clean the old tokens as not sure when to run the clean
up code
this code will clean it happy to add to patch
{{{#!php
<?php
/**
* Removes old recovery keys.
*
* @since 5.2.0
*
*
* @return null.
*/
public function clean_recovery_key_options(){
$records = get_option( 'recovery_key' );
foreach ( $records as $key => $record ){
if ( ! wp_verify_nonce( $key, 'recover_mode_token'
) ) {
unset( $records[ $key ] );
}
}
update_option( 'recovery_key', $records );
}
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/46595#comment:7>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list