diff --git a/res/issue b/res/issue index 6a963d8..092a432 100644 --- a/res/issue +++ b/res/issue @@ -1,4 +1,4 @@ -########## Redox OS ########## +########## RedBear OS ########## # Login with the following: # # `user` # # `root`:`password` # diff --git a/res/motd b/res/motd index 5cd097a..df2f802 100644 --- a/res/motd +++ b/res/motd @@ -1,2 +1,2 @@ -Welcome to Redox OS! +Welcome to RedBear OS! diff --git a/src/bin/login.rs b/src/bin/login.rs index 08e178c..022fb47 100644 --- a/src/bin/login.rs +++ b/src/bin/login.rs @@ -120,6 +120,7 @@ fn load_config_schemes(user: &User) -> Option (author: "Jeremy Soller, Jose Narvaez") @@ -133,9 +134,13 @@ pub fn main() { } loop { + if consecutive_failures >= 3 { + let delay_secs = std::cmp::min(consecutive_failures as u64, 30); + std::thread::sleep(std::time::Duration::from_secs(delay_secs)); + } let user = liner::Context::new() .read_line( - liner::Prompt::from("\x1B[1mredox login:\x1B[0m "), + liner::Prompt::from("\x1B[1mRedBear Login:\x1B[0m "), None, &mut liner::BasicCompleter::new(Vec::::new()), ) @@ -150,11 +155,13 @@ pub fn main() { None => { stdout.write(b"\nLogin incorrect\n").r#try(&mut stderr); stdout.write(b"\n").r#try(&mut stderr); + consecutive_failures += 1; stdout.flush().r#try(&mut stderr); continue; } Some(user) => { if user.is_passwd_blank() { + consecutive_failures = 0; if let Ok(mut motd) = File::open(MOTD_FILE) { io::copy(&mut motd, &mut stdout).r#try(&mut stderr); stdout.flush().r#try(&mut stderr); @@ -185,6 +192,7 @@ pub fn main() { stdout.flush().r#try(&mut stderr); if user.verify_passwd(&password) { + consecutive_failures = 0; if let Ok(mut motd) = File::open(MOTD_FILE) { io::copy(&mut motd, &mut stdout).r#try(&mut stderr); stdout.flush().r#try(&mut stderr);