diff --git a/crates/yabg3nml/src/server.rs b/crates/yabg3nml/src/server.rs index e085af6..185cd3a 100644 --- a/crates/yabg3nml/src/server.rs +++ b/crates/yabg3nml/src/server.rs @@ -67,15 +67,11 @@ pub fn server() -> io::Result { return ControlFlow::Break(()); } - // load current auth code - let passcode = AUTH.load(Ordering::Relaxed); + // load current auth code; also change auth code to always keep it randomized + let passcode = AUTH.swap(rand::random::(), Ordering::Relaxed); trace!(code, passcode, "verifying auth code"); - // change auth code to always keep it randomized - let auth_code = rand::random::(); - AUTH.store(auth_code, Ordering::Relaxed); - if passcode == code { ControlFlow::Continue(()) } else {