Skip to content

Commit

Permalink
change logout action username param
Browse files Browse the repository at this point in the history
  • Loading branch information
spencerwooo committed Dec 2, 2023
1 parent 24274ec commit 9f7c19d
Showing 1 changed file with 3 additions and 12 deletions.
15 changes: 3 additions & 12 deletions src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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);

Expand Down

0 comments on commit 9f7c19d

Please sign in to comment.