From 9f7c19da68f9a2e6892159a5cb2fc4ccb62f7cc9 Mon Sep 17 00:00:00 2001 From: spencerwooo Date: Sat, 2 Dec 2023 17:23:50 +0800 Subject: [PATCH] change logout action username param --- src/client.rs | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/src/client.rs b/src/client.rs index ba9bb01..7c44cd8 100644 --- a/src/client.rs +++ b/src/client.rs @@ -310,27 +310,18 @@ impl SrunClient { let logged_in_username = self.login_state.user_name.clone().unwrap_or_default(); if logged_in_username != self.username { println!( - "{} logged in user {} does not match yourself {}", + "{} logged in user {} does not match yourself {}, logging out anyway", "warning:".if_supports_color(Stdout, |t| t.yellow()), format!("({})", logged_in_username).dimmed(), format!("({})", self.username).dimmed() ); - - // tip to provide user override - println!( - "{:>8} provide username argument {} to override and logout current session", - "tip:".if_supports_color(Stdout, |t| t.cyan()), - format!("`--user {}`", logged_in_username) - .bold() - .bright_green() - ) } // check if ip match let logged_in_ip = self.login_state.online_ip; if logged_in_ip != self.ip { println!( - "{} logged in ip (`{}`) does not match `{}`", + "{} logged in ip (`{}`) does not match `{}`, things may not work as expected", "warning:".if_supports_color(Stdout, |t| t.yellow()), logged_in_ip .to_string() @@ -347,7 +338,7 @@ impl SrunClient { ("action", "logout"), ("ip", &self.ip.to_string()), ("ac_id", self.ac_id.as_str()), - ("username", self.username.as_str()), + ("username", logged_in_username.as_str()), ]; let url = format!("{}/cgi-bin/srun_portal", SRUN_PORTAL);