Skip to content

Commit 4a31c89

Browse files
committed
Use add_option for atomic fallback secret creation
1 parent c1af5ec commit 4a31c89

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

includes/class-gf-zero-spam-token.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,9 @@ public static function get_site_secret( int $salt_version ): string {
162162
if ( ! $fallback ) {
163163
$fallback = wp_generate_password( 64, true, true );
164164

165-
update_option( 'gf_zero_spam_fallback_secret', $fallback, false );
165+
if ( ! add_option( 'gf_zero_spam_fallback_secret', $fallback, '', false ) ) {
166+
$fallback = get_option( 'gf_zero_spam_fallback_secret' );
167+
}
166168
}
167169

168170
$auth_key = $fallback;

0 commit comments

Comments
 (0)