|
|
@ -72,7 +72,7 @@ fn get_prompt(question: &str) -> io::Result<PROMPT> { |
|
|
|
// TODO: change password functionality
|
|
|
|
// TODO: change password functionality
|
|
|
|
|
|
|
|
|
|
|
|
fn login() -> io::Result<String> { |
|
|
|
fn login() -> io::Result<String> { |
|
|
|
println!("Master password:"); |
|
|
|
println!("Enter passphrase: "); |
|
|
|
// TODO: check in db
|
|
|
|
// TODO: check in db
|
|
|
|
// TODO: return error if db is not inited
|
|
|
|
// TODO: return error if db is not inited
|
|
|
|
let password = rpassword::read_password()?; |
|
|
|
let password = rpassword::read_password()?; |
|
|
@ -91,9 +91,11 @@ fn init() -> io::Result<()> { |
|
|
|
if is_inited() { |
|
|
|
if is_inited() { |
|
|
|
return Err(io::Error::new(io::ErrorKind::AlreadyExists, "Reinitialization attempted")); |
|
|
|
return Err(io::Error::new(io::ErrorKind::AlreadyExists, "Reinitialization attempted")); |
|
|
|
} |
|
|
|
} |
|
|
|
println!("Enter master password"); |
|
|
|
print!("Enter passphrase for db: "); |
|
|
|
|
|
|
|
io::stdout().flush()?; |
|
|
|
let password = rpassword::read_password()?; |
|
|
|
let password = rpassword::read_password()?; |
|
|
|
println!("Enter master password again:"); |
|
|
|
print!("Reenter passphrase: "); |
|
|
|
|
|
|
|
io::stdout().flush()?; |
|
|
|
let password2 = rpassword::read_password()?; |
|
|
|
let password2 = rpassword::read_password()?; |
|
|
|
|
|
|
|
|
|
|
|
if password != password2 { |
|
|
|
if password != password2 { |
|
|
|