Ask to confirm password for register + removed unnecessary clone

This commit is contained in:
Mahesh Bansod 2021-10-24 02:49:51 +05:30
parent 7419d0eee6
commit f2283f236c
2 changed files with 13 additions and 4 deletions

View File

@ -8,7 +8,7 @@ use crate::utils::*;
use error::MyFriendlyError;
// TODO: maybe try to remove ALL the expect calls and use only MyFriendlyError everywhere. + improve the MyFriendlyError
// TODO: add signal handling? + support for windows?
#[tokio::main]
async fn main() {
let args = Cli::from_args();
@ -70,9 +70,18 @@ async fn main() {
}
};
//TODO: don't login if already logged in for a username???
let username = prompt_stdin("New username: ");
let password = prompt_password("Enter password: ");
//TODO: validation and Maybe password strength check or sth ^^
let password = loop {
let password = prompt_password("Enter password: ");
let confirm_password = prompt_password("Enter password again: ");
if password == confirm_password {
break password;
} else {
//TODO: validation and Maybe password strength check or sth ^^
println!("Password don't match. Please try again or Ctrl+C to quit.");
}
};
let tos = sv
.get_terms_of_service()
.await

View File

@ -154,7 +154,7 @@ impl Client {
/// Get the current session key
pub fn get_current_session_key(&self) -> Option<usize> {
self.current_session.clone()
self.current_session
}
/// Gets a Session object for the current session